Nearly all the things has a good looking consumer interface today. Simply level and click on to get issues carried out. So we virtually by no means want the command line.
However the second you join a VPS, you’ll want to be taught these important Linux instructions, otherwise you’ll be left looking at a black display, questioning what the heck to do subsequent.
Whereas there are literally thousands of Linux instructions, I’ve filtered all the way down to the 30 most-used instructions for day-to-day server administration.
Perceive Your Present Proficiency With Linux Instructions
Relying on how typically you employ Linux instructions, you’ll fall into one among these 4 proficiency ranges.
- Basis stage: You possibly can SSH into your server and navigate directories, however you aren’t comfy with system adjustments. You in all probability copy-paste instructions from tutorials with out absolutely understanding what they do. File permissions are nonetheless complicated, and when one thing breaks, you don’t know the place to start out trying.
- Skilled stage: You’re comfy with primary file operations and might troubleshoot easy points, however complicated issues nonetheless ship you looking for assist. You possibly can handle growth environments however lack the boldness to optimize efficiency or implement safety measures.
- Infrastructure stage: You possibly can diagnose efficiency bottlenecks and deal with safety configurations, however automation feels overwhelming. You perceive how particular person instructions work, however aren’t fluent sufficient but to mix them into environment friendly workflows.
- Professional stage: You possibly can assume systematically about server structure and might rapidly establish the basis reason behind complicated points. You automate routine duties and might optimize servers for particular use circumstances with out counting on exterior assets.
I’ve categorized the Linux instructions beneath, conserving in thoughts these precise proficiency ranges.
Basis Degree: Instructions Each Developer Should Grasp
The primary time you SSH right into a VPS, you’ll want to know how you can navigate round and take a look at recordsdata. These instructions enable you do this with out feeling fully misplaced.
Navigation and File Inspection
1. Is: Reveals the contents of your present listing
The command with out parameters lists (get it? ls = checklist!) all seen recordsdata and folders in your present location.
However when managing web sites, you want extra detailed info, so you need to use ls -la to see permissions, possession, file sizes, and hidden recordsdata that begin with dots.
ls -la /var/www/html
The output reveals all the things you want:

The primary column reveals file permissions, the third and fourth present who owns the file, and the final reveals when it was modified.
The desk reveals detailed details about all recordsdata in your net listing, together with hidden configuration recordsdata like .htaccess that may trigger web site points.
2. pwd: Reveals your present location within the listing construction
The command stands for “print working listing” and shows the complete path of the place you’re presently positioned. When managing a number of web sites on one VPS, this prevents you from by accident enhancing the unsuitable web site’s recordsdata. Simply kind in:
pwd
This may return one thing like /var/www/site1, confirming you’re working within the right web site listing.
3. cd: Change listing, which adjustments your present listing to a unique location
The fundamental syntax is “cd /path/to/listing.”
You should use shortcuts like “cd” alone to go dwelling, “cd -” to return to your earlier listing, and “cd ..” to maneuver up one stage.
cd /var/www/html

This strikes you on to your web site’s essential listing, the place most recordsdata are saved.
File and Listing Administration
4. mkdir: Creates new directories
It stands for “Make Listing,” and the essential syntax is “mkdir directory-name” to create a single folder.
You should use “mkdir -p” to create nested listing constructions in a single command, and it gained’t error if directories exist already.
mkdir -p /var/www/newsite/{public,logs,backups,ssl}

This creates a whole listing construction for a brand new web site with separate folders for public recordsdata, logs, backups, and SSL.
5. cp: Copies recordsdata and directories from one location to a different
The fundamental syntax is:
cp
Nonetheless, by default, the cp command doesn’t copy recordsdata inside folders and even nested folders.
You’ll want to make use of “cp -r” to repeat total listing bushes recursively, which handles all subdirectories and their contents.
cp -r /var/www/manufacturing /var/www/staging
This creates a whole copy of your manufacturing web site for testing adjustments earlier than deploying them dwell.
6. mv: Strikes recordsdata and directories, or renames them
In contrast to copying, this removes the unique file, and you may transfer to completely different directories or rename recordsdata in the identical location.
Right here’s the essential syntax:
mv
To maneuver the file elsewhere, you’ll want to specify the complete vacation spot path as beneath:
mv wordpress-6.3.2.zip /var/www/downloads/
If you wish to rename a file, you possibly can simply “transfer” the file from one title to a different title in the identical listing:
mv nginx.conf nginx.conf.backup

File Content material Operations
7. cat: Shows your entire contents of a file in your terminal (Brief for concatenate)
The fundamental syntax is cat filename. This command is ideal for studying brief configuration recordsdata or checking the contents of scripts with out opening a textual content editor.
cat /var/www/html/wp-config.php
This shows your WordPress configuration file so you possibly can confirm database credentials or examine for syntax errors.
8. head: Reveals the primary few strains of a file
The default is 10 strains, however you possibly can specify a unique quantity with “head -n 20.” That is helpful for checking massive log recordsdata with out displaying 1000’s of strains in your terminal.
head -n 50 /var/log/nginx/entry.log
This reveals the primary 50 entries out of your net server’s entry log to examine current visitors patterns.
9. tail: Reveals the previous couple of strains of a file
The tail command with none parameters reveals 10 strains, however “tail -f” constantly shows new strains as they’re added to the file. This makes it invaluable for monitoring log recordsdata in real-time whereas troubleshooting.
tail -f /var/log/nginx/error.log
This follows your error log in real-time, exhibiting new error messages instantly as they happen throughout web site operations.
Skilled Degree: Instructions for Managing Growth Workflows
As soon as you already know your method round, these professional-level instructions offer you management over the dynamic elements of your server. You possibly can monitor what’s working, handle processes, and deal with system assets like a professional.

Course of Management and Monitoring
10. ps: Reveals presently working processes in your system
Working “ps aux” shows all processes with detailed info, together with CPU and reminiscence utilization.
- a reveals processes for all customers.
- u supplies a user-friendly format.
- x contains processes not connected to terminals.
| the “pipe” passes the output from “ps aux” to the “grep” command, and I’ll cowl it within the file looking out part later.
ps aux | grep nginx

This full command outputs all NGINX-related processes, serving to you confirm your net server is working and establish any resource-heavy processes.
11. high: Shows real-time system efficiency and working processes
In contrast to “ps,” this command updates constantly, exhibiting dwell CPU, reminiscence, and course of info. Press q to give up, okay to kill processes, and M to kind by reminiscence utilization.
high

When your web site hundreds slowly, this reveals which processes are consuming assets. The load common and reminiscence utilization statistics assist establish system bottlenecks.
12. htop: Enhanced model of high with higher visible interface
This supplies the identical performance as high however with shade coding, mouse assist, and simpler navigation. You could want to put in it first with a sudo command, which we cowl down beneath.
htop

The colour-coded show makes it simpler to identify drawback processes at a look, and you may scroll by way of the method checklist extra simply.
13. kill: Terminates processes by their course of ID
Use kill
kill 1234
When a PHP course of will get caught consuming an excessive amount of CPU, discover its PID with ps aux or high, then use kill to terminate it.
14. killall: Terminates all processes with a particular title
You gained’t at all times know the PID since service names can differ from app names. The killall
killall php-fpm
This stops all PHP-FPM employee processes — helpful when you’ll want to restart your PHP handler fully.
System Useful resource Monitoring
15. df: Reveals disk area utilization for all mounted filesystems
Working “df -h” shows disk utilization in human-readable format (GB, MB as an alternative of kibibytes). The above command will help you retain observe of disk utilization so you possibly can keep away from disk full errors.
df -h

Should you see the “use%” column with greater than 70% for any disk, it’s time to scrub up the disk area or improve to bigger storage.
16. free: Shows reminiscence utilization together with RAM and swap area
With out parameters, the free command will present you knowledge in kibibytes (1 kibibyte is 1024 bytes).
Use “free -h” to see reminiscence statistics in human-readable format. This helps establish memory-related efficiency points earlier than they crash your functions.
free -h

If “obtainable” reminiscence drops close to zero, your server will grow to be unresponsive. This indicator tells you when so as to add extra RAM or optimize your functions.
17. du: Reveals disk utilization for particular directories
Working du -sh
du -sh /var/www/*
Should you’re working a number of web sites in your VPS, the above command will present you which ones web site consumes probably the most area and helps you establish directories that would use cleanup
3. File Looking out and Textual content Processing
18. grep: Searches for textual content patterns inside recordsdata
Grep stands for “international common expression print.” I used the “grep” command with our “ps aux” command earlier than. Let me clarify what it truly does.
This command can be utilized to search for textual content or regex patterns in massive textual content. Use grep “search time period”
grep -r "database_name" /var/www/html/
This finds all recordsdata containing your database title, important for monitoring configuration references or troubleshooting connection points.
19. discover: Searches for recordsdata and directories primarily based on varied standards
This command helps you discover recordsdata in your path that match a particular title or sample.
You should use discover
discover /var/www -name "*.log" -size +100M
This finds log recordsdata bigger than 100MB, serving to establish recordsdata that want rotation or cleanup to free disk area.
20. chmod: Adjustments file and listing permissions
File permissions on Linux will be complicated, and I can not clarify them intimately right here, however Pink Hat wrote a complete article explaining file permissions.
When you perceive file permissions, you need to use the “chmod” command to replace them.
Use chmod
“Permissions,” on this case, use numeric notation the place” 7=learn+write+execute,” “6=learn+write,” “4=learn solely.”
chmod 644 /var/www/html/wp-config.php
Giving 777 permissions to crucial recordsdata opens your server to safety vulnerabilities.
So that you want to concentrate on what permissions are completely mandatory and solely present these. Internet recordsdata usually want 644 permissions, whereas web site directories want 755 to run appropriately.
Infrastructure Degree: Instructions for Manufacturing Environments

Once you’re required to deal with the networking side of your servers, these instructions can rapidly separate competent directors from those that battle when actual points hit manufacturing web sites.
Community Diagnostics and Administration
21. ping: Exams community connectivity and measures response time
The “ping” command checks in case your server can join to a different web site or server. You possibly can ping both a website title or an IP deal with.
Utilizing simply ping
ping -c 4 yourdomain.com

If ping fails totally, both DNS is damaged or there’s a community connectivity situation and you can begin narrowing down the difficulty from right here.
22. curl: Transfers knowledge to or from servers utilizing varied protocols
Once you’re within the terminal, fetching a web site and downloading packages is sort of tough. You don’t have a browser or a UI related.
This command has a wide range of parameters, so you could need to undergo this official curl utilization tutorial to grasp it fully.
However for checking if a web site is responding, you solely want the “-I” (that’s uppercase i) parameter. This parameter helps curl fetch HTTP headers as an alternative of fetching the complete HTML from the web site.
curl -I https://yourdomain.com

This reveals HTTP standing codes (“200=success,” “404=not discovered,” “500=server error”) and response headers, revealing points browsers may conceal.
23. netstat: Reveals community connections and listening providers
Netstat is one more intensive command that helps you monitor your community connections, examine which ports are open in your server, which providers are listening on which particular ports, and much more.
Right here’s a easy information from IBM that reveals you some widespread netstat utilization.
For server use, you’d largely want the “netstat -tlnp command” to show listening community connections.
The flags imply:
- “-t” TCP connections
- “-l” listening solely
- “-n” numerical addresses
- “-p” course of IDs
netstat -tlnp | grep :80
This confirms your net server is listening on port 80. If nothing seems, your net server isn’t working or configured correctly.
24. ss: A contemporary alternative for netstat with higher efficiency
Whereas netstat has been the legacy software that continues to work, it may be slower should you’re on a particularly busy server. The “ss” command got here in to repair that.
You should use related parameters as netstat with the ss command and obtain the output a lot quicker.
ss -tlnp | grep :443
This checks in case your net server is listening for SSL connections on port 443, important for HTTPS web sites.
Safety and Entry Management
25. sudo: Executes instructions with elevated privileges
Sudo, brief for “tremendous consumer do,” enables you to carry out administrative duties with out switching to the basis consumer fully. It helps run instructions with accountability and decreased threat.
Should you swap to the “root” account, you will have full management over your server and might by accident delete recordsdata, together with with the ability to delete the working system, whereas it’s working.
So, sudo saves us from “suc” accidents. Simply prepend the command to any admin command and it’ll ask you in your password.
sudo systemctl restart nginx
Administrative duties like restarting providers require elevated privileges. Utilizing sudo is safer than logging in as root straight.
Do be aware that your consumer must have the sudo permissions earlier than utilizing the sudo command.
26. chown: Adjustments file and listing possession
In Linux, each file is owned by a consumer and a gaggle. You possibly can at all times change who owns the file through the use of the chown command. You should use chown
For example, net servers have to personal web site recordsdata to serve them correctly.
chown -R www-data:www-data /var/www/html/
This command is useful if you’re importing recordsdata through FTP. These recordsdata can are available in with the unsuitable possession, and you need to use chown to alter that.
27. ssh-keygen: Generates SSH key pairs for safe authentication
SSH keys are far more safe than passwords for server entry. The SSH key sits in your laptop with out ever being despatched to the server, so a hacker watching your community won’t ever see the important thing that helped you log in.
Working “ssh-keygen -t rsa -b 4096” creates private and non-private key recordsdata.
ssh-keygen -t rsa -b 4096 -C "your@electronic mail.com"
This creates a “4096-bit RSA” key pair. Copy the general public key to servers for passwordless authentication and automatic deployments.
28. ufw: Ubuntu’s uncomplicated Firewall for primary server safety
Each server wants a very good firewall setup. Most Linux servers include the ufw firewall, or it may be simply put in.
After getting it, run the ufw allow command to activate the firewall, then ufw permit
ufw allow
ufw permit 22
ufw permit 80
ufw permit 443
This enables SSH (22), HTTP (80), and HTTPS (443) visitors whereas blocking all the things else, offering primary however efficient server safety.
Professional Degree: Instructions for Automation and Scale
These instructions enable you with automation and superior system administration for managing web sites at scale.

Service Administration
29. systemctl: Controls systemd providers on fashionable Linux distributions
Use systemctl
systemctl standing nginx
systemctl restart mysql
The primary command reveals detailed NGINX standing together with current log entries. The second restarts your database server to use any configuration adjustments you might need made to the “mysql” configuration.
30. crontab: Schedules automated duties to run at particular instances
You don’t need to get up in the midst of the night time to run server instructions. Cron jobs can do this for you.
To edit your private cron desk, run crontab -e and also you’ll see all of your present cron entries.
Duties are specified utilizing the format: minute, hour, day, month, weekday, and command.
0 2 * * * /usr/native/bin/backup-website.sh
For example, the above cron job runs a backup script (“backup-website.sh”) day by day at 2 a.m.
You should use cron jobs for automated backups, log rotation, and upkeep duties and a lot extra in your manufacturing environments.
Superior Textual content Processing
31. sed: Stream editor for filtering and reworking textual content
Use sed ‘s/previous/new/g’
sed -i 's/old_database/new_database/g' /var/www/html/wp-config.php
This replaces all occurrences of “old_database” with “new_database” in your WordPress config file; helpful for database migrations.
32. awk: Sample scanning and knowledge extraction software
Working awk ‘{print $1}’
awk '{print $1}' /var/log/nginx/entry.log | kind | uniq -c | kind -nr | head -10
This extracts IP addresses from entry logs, counts them, and reveals the highest 10 guests to your web site.
Actual-World Utility Situations
Let’s have a fast evaluate, after which put these instructions collectively for widespread conditions you’ll face managing your VPS.
Command Immediate: | Stands For: | What It Does: |
ls | Checklist | Lists the contents of your present listing |
pwd | Print working listing | Shows the complete path of the place you might be positioned |
cd | Change Listing | Adjustments your present listing to the indicated location |
mkdir | Make Listing | Creates a listing (a folder) within the requested location |
cp | Copy | Copies recordsdata and directories from level A to level B |
mv | Transfer | Strikes (or renames) recordsdata and directories |
cat | Concatenate | Shows all of the contents of a file in your terminal |
head | – | Reveals the primary 10 strains of a file |
tail | – | Reveals the final 10 strains of a file |
ps | Course of Standing | Reveals the processes working in your system on the time it was run |
high | – | Shows a dynamic, real-time view of the processes working in your system |
htop | – | A extra UI targeted model of “high” |
kill | – | Terminates the required course of |
df | Disk Free | Shows the disk area utilization for all mounted file methods |
free | Shows the quantity of free and used reminiscence within the system | |
du | Disk Utilization | Shows the disk utilization for a particular listing |
grep | International Common Expression Print | Searches for textual content patterns inside recordsdata |
discover | – | Finds recordsdata and directories primarily based in your standards |
chmod | Change Mode | Modifies file system permissions |
ping | Packet Web Groper (however most individuals simply say “Ping”) | Checks in case your server can join to a different web site or server |
curl | Shopper URL | Transfers knowledge to or from servers |
netstat | Community Statistics | Shows community connections and listening providers. |
ss | Socket Statistics | An up to date model of netstat |
sudo | Tremendous Consumer Do | Executes instructions with elevated privileges |
chown | Change Proprietor | Adjustments file and listing possession |
ssh-keygen | Safe Shell Key Era | Generates SSH Key pairs for safer authentication |
ufw | Uncomplicated Firewall | A user-friendly firewall for primary server safety |
systemctl | System Management | Controls systemd providers on fashionable Linux distros |
crontab | Cron Desk | An inventory of all of the automated duties (crons) presently scheduled |
sed | Stream Editor | Filters and adjusts textual content in recordsdata |
awk | Named after its builders | Sample scanning and knowledge extraction software |
When Your Web site Masses Slowly
Begin by checking what’s consuming your server assets.
Run high or htop to see which processes are utilizing probably the most CPU and reminiscence. You’re on the lookout for any processes consuming over 50% of your assets and if any of them will be killed.
If useful resource utilization appears regular, examine your obtainable disk area with “df -h.” Should you discover utilization exceeding 90% on any filesystem, unencumber area as quickly as doable. Every part drastically slows down when your server is full.
Subsequent, confirm your net server is definitely working correctly.
Use ps aux | grep nginx (or ps aux | grep apache should you’re utilizing Apache) to verify your net server processes are lively and responding.
Examine your error logs whereas testing your web site.
Run tail -f /var/log/nginx/error.log in a single terminal, then go to your web site in a browser window. If there are any errors working your web site, it is best to see them instantly seem in your terminal.
Lastly, take a look at your web site’s response time straight from the server with curl -I https://yoursite.com. This bypasses any community points and tells you precisely how lengthy your server takes to reply.
Setting Up a Safe Growth Setting
Create a devoted consumer account for growth work as an alternative of utilizing root for all the things:
sudo adduser devuser
Arrange a correct listing construction in your staging web site. This retains growth recordsdata organized and separate from manufacturing:
mkdir -p /var/www/staging/{public,logs,backups}
Repair the possession so your net server can entry the recordsdata correctly:
chown -R devuser:www-data /var/www/staging
Set applicable permissions – 755 permits the proprietor to learn/write/execute whereas giving others learn and execute entry:
chmod -R 755 /var/www/staging
Configure your firewall to permit solely important providers. Begin by permitting SSH so that you don’t lock your self out:
sudo ufw permit 22
Permit net visitors on the usual HTTP and HTTPS ports:
sudo ufw permit 80
sudo ufw permit 443
Allow the firewall to start out blocking unauthorized connections:
sudo ufw allow
Command Mixtures That Present Actual Proficiency
Superior customers mix instructions to unravel complicated issues:
The beneath command finds nginx processes, extracts their PIDs, and kills them multi function line:
ps aux | grep nginx | awk '{print $2}' | xargs kill -9
This discover command robotically removes log recordsdata older than 7 days to free disk area:
discover /var/log -name "*.log" -mtime +7 -delete
This mixed du command reveals the 5 largest directories in your net root, sorted by measurement:
du -sh /var/www/* | kind -hr | head -5
Should you’re getting 404 errors, run this command to rely them in your entry log to establish damaged hyperlinks:
grep -c "404" /var/log/nginx/entry.log
So, What Comes Subsequent
When you’re comfy with these 30 instructions, you’ll desire a high quality VPS supplier that’s quick and versatile whereas offering full management in your rising abilities.
DreamHost’s VPS internet hosting provides simply that. You get full root entry to experiment safely, SSD storage that makes file operations lightning-fast, and scalable assets when your initiatives outgrow their present limits.
We additionally embody automated backups so you possibly can experiment fearlessly, and our assist group understands Linux environments whenever you need assistance with complicated configurations.
Take Cost with Versatile VPS Internet hosting
Right here’s how DreamHost’s VPS providing stands aside: 24/7 buyer assist, an intuitive panel, scalable RAM, limitless bandwidth, limitless internet hosting domains, and SSD storage.
Did you take pleasure in this text?