Whatever the first command I typed into the Linux command prompt was, it was like going back to the era of mainframe computers or MS-DOS. Well, my guess is that it was either ls (list directory) or cd (change directory), but since then I have learned the raw power of commands available in a Linux system. Everyone has to start from somewhere, and to shorten your learning curve, here are top 10 most frequently used Linux commands that are worth mastering thoroughly.
Here is my top 10:
List files in a directory, for instance, details of files: ls -al
Change working directory, for instance: cd /var/www
Copy files, for instance, copy file to another directory: cp myfile.txt /var/www/
Remove files, for instance: rm myfile.txt
Create directory, for instance: mkdir /var/www/newdir
Move and rename files, for instance: mv myfile.txt yourfile.txt
Display contents of a file in screen-size segments, for instance: more myfile.txt (continue to the next screen by pushing space bar or enter)
Display contents of a file from the end, for instance: tail -n100 myfile.txt (last 100 lines)
Editor that is easier to use than other default editors in Linux, for instance: nano myfile.txt
- systemctl or service
Manage programs, scripts and applications, for instance: systemctl restart apache2 – or – service apache2 restart
The inspiration for my list of the 10 most frequently used Linux commands came from Ken Hess at Red Hat who posted his top ten list on the company blog. Here are his most used Linux commands.
Display the manual for a command, for instance: man mkdir.
Display contents of a file.
Updates the datestamp of a file.
Display the directory path where you are in the file system.
List processes running in the system, for instance: ps aux.
Naturally, it depends on the tasks each Linux user wants to achieve on the system which commands are important for him or her. A programmer, database administrator, security researcher, networking expert, and WordPress admin all have different sets of top 10 commands.