60 Essential Linux Commands for System Administrators
System administrators commonly use commands to manage Linux servers. Commands are more efficient and allow users to automate various tasks more quickly.
Prerequisites
Before proceeding, access the command-line interface of your Linux desktop or virtual private server (VPS). If you use a remote system, connect to it using an SSH client like PuTTY or Terminal.
If you don’t have a Linux machine, we recommend purchasing Hostinger’s VPS hosting plan. Our Browser terminal feature lets you connect to your server directly from the web browser to simplify the process.
Moreover, Hostinger’s Kodee AI assistant can write commands based on your needs. It helps beginners learn Linux utilities more efficiently, as they don’t need to open documentation for references.
1. ls command
The ls command lists the content of a folder, including files and directories. Here’s the syntax:
ls [options] [directory_or_path]
If you omit the path, the ls command will check the content of your current directory. To list items inside subfolders, add the -R option. Meanwhile, use -a to show hidden content.
2. pwd command
To check the full path of your current working directory, use the pwd command. Its syntax is as follows:
pwd [options]
The pwd command has only two options. The -L option prints environment variable content, like shortcuts, instead of the actual path of your current location. Meanwhile, -P outputs the exact location.
3. cd command
Use cd to navigate between directories in your Linux VPS. It doesn’t have any option, and the syntax is simple:
cd [path_or_directory]
Depending on your location, you might only need to specify the parent directory. For example, omit path from path/to/directory if you are already inside one. The cd command has several shortcuts:
- cd– returns to the current user’s home directory.
- cd ..– moves a directory up.
- cd –– goes back to the previous directory.
4. mkdir command
The mkdir command lets you create one or multiple directories. The syntax looks like this:
mkdir [options] directory_name1 directory_name2
To create a folder in another location, specify the full path. Otherwise, this command will make the new item in your current working directory.
5. rmdir command
Run rmdir to delete empty directories in your Linux system. The command syntax looks like this:
rmdir [options] directory_name
The rmdir command won’t work if the directory contains subfolders. To force the deletion, add the -p option. Note that you must own the item you want to remove or use sudo instead.
6. rm command
The rm command deletes files from a directory. You must have the write permission for the folder or use sudo. Here’s the syntax:
rm [options] file1 file2
You can add the -r option to remove a folder and its contents, including subdirectories. Use the -i flag to display a confirmation message before the removal or -f to deactivate it completely.
7. cp command
Use the cp command to copy files from your current directory to another folder. The syntax looks like this:
cp file1 file2 [target_path]
You can also use cp to duplicate the content of one file to another using this syntax. If the target is in another location, specify the full path like so:
cp source_file /path/to/target_file
Additionally, cp lets you duplicate a directory and its content to another folder using the -R option:
cp -R /path/to/folder /target/path/to/folder_copy
8. mv command
The main usage of the mv command is to move a file or folder to another location. Here’s the syntax:
mv file_or_directory [target_directory]
You can also use the mv command to rename files in your Linux system. Here’s an example:
mv old_name.txt new_name.txt
If you specify the full path, you can simultaneously rename files and move them to a new location like this example:
mv old/location/of/old_name.txt new/path/for/new_name.txt
9. touch command
Run the touch command to create a new empty file in a specific directory. The syntax is as follows:
touch [options] [path_and_file_name]
If you omit the path, the touch command will create a new file in your current working directory.
10. file command
The file command checks a file type, such as TXT, PDF, or other. The syntax is as follows:
file [file_name]
If you use this command on a symbolic link, it will output the actual file connected to the shortcut. You can add the -k option to print more detailed information about the item.
11. zip and unzip commands
The zip command compresses one or multiple files into a ZIP archive, reducing their size. Here’s the syntax:
zip [options] zip_file_name file1 file2
To extract a compressed file into your current working directory, use the unzip command like so:
unzip [options] zip_file_name
12. tar command
The tar command bundles multiple files or directories into an archive without compression. The syntax looks as follows:
tar [options] tar_file_name file1 file2
To create a new TAR file, you must add the -c option. Then, use the -f flag to specify the archive’s name.
13. nano, vi, and jed command
nano, vi, and jed commands let you edit files. They have the same syntax, except at the beginning, where you specify the name of the tool:
nano/vi/jed file_name
If the target file doesn’t exist, these commands will create a new one. Since your system might not have these text processing utilities pre-installed, configure them using your package manager.
14. cat command
The concatenate or cat command has various usages. The most basic one is printing the content of a file. Here’s the syntax:
cat file_name
To print the content in reverse order, use tac instead. If you add the standard output operator symbol ( > ), the cat command will create a new file. You can also use cat with the operator to combine the content of multiple files into a new item.
15. grep command
Global regular expression print or grep lets you search specific lines from a file using keywords. It is useful for filtering large data like logs. The syntax looks as follows:
grep [options] keyword [file]
You can also filter data from another utility by piping it to the grep command.
16. sed command
Use the sed command to search and replace patterns in files quickly. The basic syntax looks like this:
sed [options] 'subcommand/new_pattern/target_pattern' input_file
You can replace a string in multiple files simultaneously by listing them. Here’s an example of a sed command that changes red in colors.txt and hue.txt with blue:
sed 's/red/blue' colors.txt hue.txt
17. head command
Use the head command to print the first few entries of a file. The basic syntax is as follows:
head [options] file_name
You can also print the first few lines of another command’s output by piping it like so:
command | head [options]
18. tail command
The tail command is the opposite of head, allowing you to print the last few lines from files or another utility’s output. Here are the syntaxes:
tail [options] file_name
command | tail [options]
19. awk command
The awk command searches and manipulates regular expression patterns in a file. Here’s the basic syntax:
awk '/regex pattern/{action}' input_file.txt
You can run multiple actions by listing them according to their execution order, separated by a semicolon (;).
20. sort command
Use the sort command to rearrange a file’s content in a specific order. Its syntax looks as follows:
sort [options] [file_name]
21. cut command
The cut command selects specific sections from a file and prints them as a Terminal output. The syntax looks like this:
cut options file
22. diff command
The diff command compares two files and prints their differences. Here’s the syntax:
diff file_name1 file_name2
23. tee command
The tee command outputs another command’s results to both the Terminal and a file. Here’s the syntax:
command | tee [options] file_name
24. locate command
The locate command searches for a file and prints its location path. Here’s the syntax:
locate [options] [keyword]
25. find command
The find command searches for a file within a specific directory. Here’s the syntax:
find [path] [options] expression
26. sudo command
The sudo command enables non-root users who are part of the sudo group to execute administrative commands. Simply add it at the beginning of another utility like so:
sudo [options] your_command
27. su and whoami commands
The su command lets you switch to another user in the Terminal session. The syntax looks as follows:
su [options] [username]
You can check the currently logged-in user from the Linux command-line shell. Alternatively, use the whoami command:
whoami
28. chmod command
The chmod command lets you change the permissions of files or directories. The basic syntax looks as follows:
chmod [options] [permission] [file_or_directory]
29. chown command
The chown command lets you change the ownership of files, directories, or symbolic links. Here’s the syntax:
chown [options] newowner:newgroup file1 file2
30. useradd, passwd, and userdel command
Use the useradd command to create a new account in your Linux system. The syntax is as follows:
useradd [options] new_username
To set up a password and other details during the account creation process, use the adduser command instead.
31. df command
The df command checks your Linux system’s disk usage, displaying the used space in percentage and kilobyte (KB). The syntax looks like this:
df [options] [file system]
32. du command
To check the size of a directory and its content, use the du command. Here’s the syntax:
du [directory]
33. top command
The top command displays all running processes in your system and their hardware consumption. The syntax looks like this:
top [options]
34. htop command
Like top, the htop command lets you display and manage processes in your Linux server. It also shares the same syntax:
htop [options]
35. ps command
The ps command summarizes the status of all running processes in your Linux system at a specific time. Unlike top and htop, it doesn’t update the information automatically. Here’s the syntax:
ps [options]
36. uname command
The unix name or uname command displays detailed information about your Linux machine, including hardware, name, and operating system kernel. Its basic syntax looks as follows:
uname [options]
37. hostname command
Use the hostname command to check your VPS hostname and other related information. Here is the syntax:
hostname [options]
38. time command
The time command measures the execution time of commands or scripts to gain insights into your system performance. The basic syntax looks as follows:
time command_or_script
39. systemctl command
The systemctl command is used to manage services in your Linux system. Here’s the basic syntax:
systemctl subcommand [service_name] [options]
40. watch command
The watch command lets you continuously run a utility at a specific interval to monitor changes in the output. Here’s the basic syntax:
watch [options] command_name
41. jobs command
Jobs are tasks or commands that are running in your current shell. To check them, use the jobs command with the following syntax:
jobs [options] [Job_ID]
42. kill command
Use the kill command to terminate a process using its ID. Here’s the basic syntax:
kill [signal_option] Process_ID
43. shutdown command
The shutdown command lets you turn off or restart your Linux system at a specific time. Here’s the syntax:
shutdown [option] [time] [message]
44. ping command
The ping command sends packets to a target server and fetches the responses. It is helpful for network diagnostics. The basic syntax looks like the following:
ping [option] [hostname_or_IP_address]
45. wget command
The wget command lets you download files from the internet via HTTP, HTTPS, or FTP protocols. Here’s the syntax:
wget [options] [URL]
46. cURL command
Use the cURL command to transfer data from or to a server by specifying its URL. The basic syntax looks as follows:
curl [options] URL
47. scp command
The scp command lets you securely copy files and directories between systems over a network. The syntax looks as follows:
scp [option] [source username@IP]:/[directory and file name] [destination username@IP]:/[destination directory]
48. rsync command
The rsync command syncs files or folders between two destinations to ensure they have the same content. The syntax looks as follows:
rsync [options] source destination
49. ip command
The ip utility lets you list and manage your system’s network parameters, similar to the ifconfig command in older Linux distros. Here’s the syntax:
ip [options] object command
50. netstat command
The netstat command displays information about your system’s network configuration. The syntax is simple:
netstat [options]
51. traceroute command
The traceroute command tracks a packet’s path when traveling between hosts, providing information like the transfer time and involved routers. Here’s the syntax:
traceroute [options] destination
52. nslookup command
The nslookup command requests a domain name system (DNS) server to check a domain linked to an IP address or vice versa. Here’s the syntax:
nslookup [options] domain-or-ip [dns-server]
53. dig command
The dig command displays information about a domain. It is similar to nslookup but more comprehensive. The syntax looks as follows:
dig [options] [server] [type] name-or-ip
54. history command
Run the history command to check previously run utilities. Here’s its syntax:
history [options]
55. man command
The man or manual command displays a comprehensive guide of another utility. The syntax looks like the following:
man [options] [section_number] command_name
56. echo command
Use echo to print text in your command as a Terminal output. Here’s the syntax:
echo [options] [text]
57. ln command
The ln command links files or directories with a shortcut. The syntax looks as follows:
ln [options] source target
58. alias and unalias command
The alias command lets you set another name for a string that belongs to a file, text, program, or command name. Here’s the syntax:
alias name='string'
59. cal command
The cal command displays a calendar in your Linux command-line interface. Here’s the syntax:
cal [options] [month] [year]
60. apt and dnf command
The apt command lets you manage advanced package tool (APT) libraries in Debian-based operating systems such as Ubuntu and Kali Linux. The syntax looks like this:
apt [options] subcommand
Running both apt and dnf requires superuser privileges, which you can only obtain with sudo or via root.
Conclusion
Linux commands enable system administrators to manage their servers more efficiently. They provide capabilities like scripting, variables, and automation that graphical user interfaces need to improve.
In this tutorial, we have explained the 60 most commonly used Linux commands. These will be invaluable for various tasks, including file management, user administration, navigation, and network configuration.
Take advantage of the Kodee AI assistant to use these commands more efficiently. It lets you use simple prompts to write various utilities and scripts according to your task to save time and effort.
How to Configure and Manage Ubuntu Firewall with the UFW Command
How to Install and Use the Linux Screen Command
How to List Users in Ubuntu with Linux Commands
Essential Linux commands FAQ
What are the basic Linux commands?
Basic commands in Linux include navigation utilities like cd and su. File manipulation commands like cat, echo, nano, and grep are also commonly used in system administration.
Where can I find all the Linux commands?
To list all Linux commands, run compgen -c, help, or man -e in your Terminal screen. Run the utility with the –help flag to check a command’s manual and options.
How to learn Linux commands quickly?
Use a Linux command cheat sheet and use Terminal often. Reading VPS tutorials and practicing the steps can also familiarize you with various utilities more quickly.
Which is the most commonly used command in Linux?
Navigation utilities like cd and su are commonly used commands since system admins often work in different directories or use another account. File management utilities like cat, mv, or nano are also essential for server administration tasks.
Aris Sentika
Aris is a Content Writer specializing in Linux and WordPress development. He has a passion for networking, front-end web development, and server administration. By combining his IT and writing experience, Aris creates content that helps people easily understand complex technical topics to start their online journey. Follow him on LinkedIn.
👉
Start your website with Hostinger – get fast, secure hosting here 👈
🔗 Read more from MinimaDesk:
- How Many WordPress Plugins Are Too Many? Best Practices for Performance Optimization
- How to Fix Broken Permalinks in WordPress: A Step-by-Step Guide
- How to Install WordPress with Nginx: A Step-by-Step Guide
- The Best WordPress Theme Frameworks for 2025
🎁 Download free premium WordPress tools from our Starter Tools page.