Anyone working with a Linux server will sooner or later end up at the command line. Whether you log in via SSH to fix a problem or are simply curious, a few basic commands can already help you enormously. In this article, we explain the most important commands for navigating, managing files, setting permissions, and viewing processes, with concrete examples you can use right away.
Navigating through directories
The first step in the terminal is knowing where you are and how to get somewhere else. You use these commands for that:
pwdβ shows the directory you’re currently in (print working directory).lsβ shows the contents of the current directory. Withls -layou also see hidden files and details such as permissions and size.cd directorynameβ moves you to another directory. Usecd ..to go up one level andcd ~to go back to your home directory.findβ searches for files by name, for examplefind /var/www -name "*.log".
On shared hosting you usually manage files via Plesk, but for VPS or dedicated server management, the terminal remains indispensable.
Managing files and directories
Once you know where you are, you’ll probably want to create, copy, or delete files. These are the commands you’ll use daily:
touch file.txtβ creates a new, empty file.mkdir directorynameβ creates a new directory.cp source destinationβ copies a file. Add-rto copy an entire directory.mv source destinationβ moves or renames a file or directory.rm fileβ deletes a file. Withrm -r directorynameyou delete a directory including its contents. Be careful with this, as there is no trash bin.cat fileβ displays the contents of a file in the terminal.nano fileorvim fileβ opens a file in a text editor to edit it.
Understanding file permissions
Linux works with a permissions system that determines who may read, write, or execute a file. This is especially important when managing a website, as incorrect permissions can lead to error messages or security risks.
ls -lβ shows permissions as a series of letters, for example-rwxr-xr--. The first three letters are the owner’s permissions, the next three are the group’s, and the last three are for other users.chmodβ changes permissions, for examplechmod 755 file.phpgives the owner full rights and others read and execute rights.chown user:group fileβ changes the owner of a file or directory.
For web hosting, the general rule is: directories 755 and files 644, unless a script requires specific write permissions. If you’re unsure about the correct setting, check the knowledge base or contact support.
Viewing processes and system info
Sometimes you want to know what’s running in the background, for example if a server is responding slowly. These commands provide insight:
toporhtopβ shows active processes and their resource usage in real time.ps auxβ gives an overview of all running processes.df -hβ shows the available disk space per partition.free -hβ shows the server’s memory usage.kill PIDβ stops a process based on its process ID, which you can find viaps aux.
These commands are especially relevant if you manage a VPS or dedicated server. With regular web hosting, you can handle many of these tasks conveniently via Plesk, without needing a terminal.
Log in via SSH
Use an SSH client such as PuTTY or your operating system’s terminal to log in to your server with your username and password or SSH key.
Orient yourself with pwd and ls
Check which directory you’re starting in and view its contents before making any changes.
Make a backup before changing anything
Copy important files to a separate directory with cp before editing or deleting them.
Run your command
Use the appropriate command for your task, for example chmod for permissions or nano to edit a configuration file.
Check the result
Use ls -l or cat to verify the change was applied correctly.
Frequently Asked Questions
Do I need SSH access to use these commands?
Yes, you need an SSH connection to your server to run commands in the terminal. With a VPS or dedicated server, you get this access by default.
Can I recover a deleted file with rm?
No, rm deletes files immediately without a trash bin. Recovery is only possible via a backup.
What’s the difference between chmod 644 and 755?
644 gives the owner read and write permissions and others only read permissions, while 755 also gives the owner execute permissions and others read and execute permissions. 755 is often used for directories and scripts.
Do these commands also work on shared web hosting?
On shared hosting you usually don’t have direct SSH access and manage files via Plesk instead. However, the logic behind permissions and directory structure remains the same.
How do I know if my server has enough memory or disk space?
Use free -h for memory usage and df -h for disk space. This immediately shows whether a shortage of space is looming.
Conclusion
With commands like pwd, ls, cp, chmod, and top, you can already handle many management tasks on a Linux server yourself. Start slowly, always test in a safe directory first, and make a backup before implementing changes. If you still get stuck, our 24/7 support is ready for you via WhatsApp, ticket, or email.