If you are a System Administrator, you must know that the terminal is your single best friend. Part of your task is, therefore, to master the Linux/Unix commands so that you can control everything from the terminal itself. In this post, we look at some of the most popular and powerful Linux commands. Linux Commands […]
If you are a System Administrator, you must know that the terminal is your single best friend. Part of your task is, therefore, to master the Linux/Unix commands so that you can control everything from the terminal itself. In this post, we look at some of the most popular and powerful Linux commands.
The most important command in Linux, man shows information about other commands. You can start by running “man man” to find more about the man command.
This command tells you how long your system has been running for.
This command shows who is logged into your system and what they are currently doing.
This shows you the usernames of users who are currently logged in to your system.
Prints the username of the user that you are currently logged in as.
Finds text in files and outputs the neighbouring text along with file names. You can recursively search in multiple files using -r. You can output only file names using -l.
If the case your output of a command or file contests are more your screen can accomodate, you can view it in parts using less. The output of the previous command using less is the following.
This helps in displaying, copying or combining text files.
Prints the absolute path of the current working directory.
This commands helps you connect to a remote host. You can either connect as
Copy files securely and remotely over servers.
Use this to run any command as the superuser (root). It is prefixed to the commands.
You can use it to perform tasks on different services, which runs scripts for the corresponding services. For instance, to restart apache2 web server, we use service apache2 restart. A sudo is prefixed to run as root because all users do not have permission to run the scripts.
Do note that some do not require sudo.
Find files on your system by name.
Chmod changes file permissions in Linux. You can set which users or user groups have what kind of access to a particular file. The topic of file permissions in Linux is a huge one in itself and beyond the scope of this post. You can, however, look at this thread for further reading.
Change ownership of a file to a user or a user group.
Kill a process using this command.
This is a program that is used to manage cron jobs in Linux. To list existing cron jobs, run crontab -l.
You use an alias when you are in need to shorten a command.
Aliases are not saved after you close the current terminal session. To do that you need to create an alias in ~/.bashrc.
Display or output text. Used in making bash scripts.
This command compares two files byte by byte.
Mounts a filesystem. There are different options in this command that you can use which enables you to mount even remote file systems.
This command is used to show the memory map of a process. You can get the process id (pid) by running
ps aux | grep <process_name>
Then run pmap -x <pid>
Downloads a file from a network.
This command is used to configure a network’s interface. Just writing the command displays the configuration.
With this, we come to the end of the list of the important commands. We hope that it was educational for you. If you have any issues, feel free to comment below!