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:
- ls
List files in a directory, for instance, details of files: ls -al - cd
Change working directory, for instance: cd /var/www - cp
Copy files, for instance, copy file to another directory: cp myfile.txt /var/www/ - rm
Remove files, for instance: rm myfile.txt - mkdir
Create directory, for instance: mkdir /var/www/newdir - mv
Move and rename files, for instance: mv myfile.txt yourfile.txt - more
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) - tail
Display contents of a file from the end, for instance: tail -n100 myfile.txt (last 100 lines) - nano
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.
- ls
- man
Display the manual for a command, for instance: man mkdir. - cat
Display contents of a file. - touch
Updates the datestamp of a file. - pwd
Display the directory path where you are in the file system. - cd
- rm
- cp
- mkdir
- ps
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.