Linux is an open-source OS based on the UNIX operating system and its one of the most popular operating systems in the world. Linux is known for its stability, security, flexibility, and is free making it a popular choice for everything from web servers to mobile devices to enterprise.
Another factor contributing to Linux’s popularity is its flexibility and open source. Linux has become increasingly popular in recent years, particularly in the enterprise and cloud computing industry. Additionally, Linux is often the operating system of choice for developers and IT professionals, due to its flexibility, reliability, and powerful command-line tools.
Why you need to learn most commonly used Linux commands
Knowing the commonly used Linux commands is essential for anyone who uses Linux, whether they are a developer, system administrator, or casual user. If you are a system administrator then it’s become more important to learn these commands to speed up server setup and/or fixing the servers issues remotely.
Benefits of using Top Linux Commands:
- Efficiency and improve productivity
- Automation of tasks – It is possible to perform complex tasks with a single command
- Makes server troubleshooting faster
- Security – ensuring that only authorized users have access to sensitive files and data
- Collaboration – facilitate collaboration among team members, makes it easier to share files, troubleshoot issues, and perform routine maintenance tasks.
So without a further ado, here is the list of top 25 most commonly used Linux commands divided in different categories.
Top 25 Most Commonly used Linux Commands every System Admins & IT professional should Learn
Linux Navigation Commands
1. cd – Change Directory
Change directory command is used to navigate between directories in the Linux system. For example, if you want to move to the home directory, simply type “cd ~” and hit enter.
2. ls – List Files and Directories
List command is used to list the files and directories in the current directory. For example, “ls -l” command will list the files in a detailed format.
3. pwd – Print Working Directory
The pwd command output the current working directory path from the root directory of the system. Just type “pwd” in command prompt to know which directory you are currently in.
4. mkdir – Make Directory
Make directory command is used to create new directory (folder) in the Linux system. For example, “mkdir NewFolder” will create a new directory named NewFolder in the current directory.
5. rmdir – Remove Directory
This command will delete the directory you specified from the system. Note that directory must be empty before you can remove it, and you must have write permission in its parent directory. The below command will remove “My_Folder” directory from your Linux system.
Linux File Manipulation Commands
6. cat – Concatenate Files
cat command in Linux OS is used to combines multiples files into a single file, apart from adding multiple files cat command also used for other purpose but that should a be separate topic/article. Below command will display content of multiple files together in terminal
cat sample1.txt sample2.txt
7. touch – Create a File
Touch command is used to create new files or update the timestamp of existing files. For example, “touch new_file.txt” will create a new file named “new_file.txt” in the current directory.
8. cp – Copy a File
Copy command is used to copy files and directories from one location to another. For example, “cp file.txt /home/user/NewFolder” will copy the file.txt to a new directory named NewFolder in the home directory.
cp file.txt /home/user/NewFolder
9. mv – Move or Rename a File
Move command is used to move files and directories from one location to another. For example, “mv file.txt /home/user/NewFolder” will move the file.txt to a new directory named NewFolderin the home directory.
mv file.txt /home/user/NewFolder
10. rm – Remove a File
Remove command is used to delete files and directories from the system. For example, “rm file.txt” will delete the file named file.txt from the current directory.
Linux System Monitoring Commands
11. top – Display System Processes
Top command is used to monitor the system processes in real-time. For example, typing “top” in the command line will show a live view of the system processes.
12. ps – Display Running Processes
Process status command is used to display information about the running processes on the system. For example, “ps -ef” will display a list of all running processes on the system.
13. netstat – Show Network Connections
Network statistics command is used to display information about the network connections and statistics in the system. For example, “netstat -an” will display all active network connections in the system.
14. df – Display Free Disk Space
Disk free command is used to display information about the available disk space in the system. For example, “df -h” will display the available disk space in human-readable format.
15. du – Display Disk Usage
Disk usage command is used to display information about the disk usage of files and directories in the system. For example, “du -sh /home/user/my_folder” will display the disk usage of my_folder directory in a human-readable format.
du -sh /home/user/my_folder
User and Permissions Commands
16. whoami – Display Current User
This command outputs the currently logged-in user name at the Linux terminal.
17. sudo – Execute a Command with Superuser Privileges
This command normally used as a prefix to some commands that only admin or superuser are allowed to execute. If you prefix any command with “sudo”, it will run that command with elevated privileges.
18. chown – Change Ownership of a File or Directory
Change owner command is used to change the owner of files and directories in the system. For example, “chown user:group file.txt” will change the owner of file.txt to user and the group to group.
chown user:group file.txt
19. chmod – Change File or Directory Permissions
Change mode command is used to change the permissions of files and directories in the system. For example, “chmod 755 file.txt” will set the permissions of the file.txt to read, write, and execute for the owner, read and execute for the group, and read and execute for others.
chmod 755 file.txt
20. passwd – Change User Password
This command will let you change your password. If you are superuser you can also change password for other users.
Linux Package Management Commands
21. apt – Advanced Package Tool
APT is a popular package management system, the package manager is the most popular and easiest-to-learn package managing utility. If you want to install anything other then the system provided apps you will use the apt command. The following command will install Apache web server on your Linux OS.
apt-get install apache2
22. yum – Yellowdog Updater Modified
YUM is also a package manager, this command allows for automatic updates and package and dependency management on RPM-based Linux systems. The command in the next line will install the apache web server.
yum install httpd
Apart from these top Linux commands below are some more useful commands that you should also learn to make yourself a Linux master.
Global regular expression print command is used to search for specific text in files and directories in the system. For example, “grep ‘search_text’ file.txt” will search for the ‘search_text’ in the file.txt.
grep 'search_text' file.txt
Find command is used to search for files and directories in the system based on specific criteria. For example, “find /home/user -name ‘*.txt'” will search for all files with a .txt extension in the /home/user directory.
find /home/user -name '*.txt'
used to create compressed archive files in the system. For example, “tar -czvf archive.tar.gz /home/user/my_folder” will create a compressed archive file of the my_folder directory in the current directory.
tar -czvf archive.tar.gz /home/user/my_folder
Unzip command is used to extract compressed archive files in the system. For example, “unzip archive.zip” will extract the contents of archive.zip file in the current directory.
Secure shell command is used to remotely access and manage a Linux system. For example, “ssh user@server_address” will establish a secure shell connection to the server with the provided user and server_address.
Secure copy command is used to securely copy files between two Linux systems. For example, “scp file.txt user@server_address:/home/user” will copy the file.txt to the /home/user directory on the server with the provided user and server_address.
scp file.txt user@server_address:/home/user
wget: Web get command is used to download files from the internet in the Linux system. For example, “wget https://example.com/file.txt” will download the file.txt from the example.com website.
Ping command is used to test the network connectivity between two systems. For example, “ping 192.168.0.1” will test the connectivity between the local system and the IP address 192.168.0.1.
Interface configuration command is used to display information about the network interfaces in the system. For example, “ifconfig” will display information about all the network interfaces in the system.
Unix name command is used to display information about the system kernel and operating system. For example, “uname -a” will display the detailed information about the system kernel and operating system.
History command is used to display the list of previously executed commands in the system. For example, “history 10” will display the list of last 10 executed commands in the system.
These top 25 Linux commands are essential and helpful for quick and fast navigating, managing, and monitoring a Linux system. The commands range from basic navigation and file management commands to more advanced system management and network troubleshooting commands such as top, ps, kill, ssh, and ping etc.
Learn these commands to improve your productivity and efficiency when working with Linux systems. By mastering these commands, you can quickly perform common tasks and troubleshoot issues in the Linux OS.
Overall, understanding and utilizing these common and most used Linux commands will make you a more proficient Linux system admin or a Linux power user and enable you to maximize the potential of your Linux system.