DEV Community

loading...
Cover image for 🐧 Linux Commands - A Complete Handbook for beginners πŸ’»

🐧 Linux Commands - A Complete Handbook for beginners πŸ’»

Kaiwalya Koparkar
🌐 Open Source Enthusiast | πŸ’» Full Stack Developer | πŸ“ŽBlogger | Engineering Smiles πŸ’»
・Updated on ・3 min read

Hello folks,
You might be working on GUI based interfaces to do your daily tasks. But do you know that you can do the same and some advance tasks just using the terminal but more efficiently. Also having a deep understanding of the terminal commands comes handy when you want to be more productive and fast. Terminal commands can do more than just installing the softwares on your Linux distro. In this blog I have share commands which you should definitely try and use in you daily life. I guarantee you that you will feel the power of terminal commands after you use them couple of times.

Without wasting anymore time let's jump into it.

  1. cd directory_name ==> Changes the path to directory_name
  2. cd .. ==> Go back to previous directory
  3. cd or cd ~ ==> Go back to root directory
  4. mkdir directory_name ==> Makes a new directory at that location
  5. rmdir directory_name ==> This will delete the directory (Cannot be undone)
  6. ls ==> Lists all the directories in the location
  7. touch file_name ==> Creats a file of file_name (File extension is compulsary)
  8. echo random_text ==> Will print random_text on the terminal screen
  9. echo random_text > file_name ==> It will put the random_text into the file_name instead of printing on the terminal screen
  10. man command_name ==> This will display all the information about the specific terminal command_name
  11. help ==> This will help you by providing some comman commands if you are unable to recall them
  12. history ==> Shows all the history of your commands
  13. ps ==> This will show all the processes running on you machine
  14. pwd ==> This will show your current path in terminal
  15. cat file_name ==> Prints all the content in the given file_name.
  16. cp file_name location ==> This will copy the file at the specific location
  17. cp file_name copyed_file_name ==> This makes the copy of the file_name with name as copyed_file_name.
  18. mv file_name location ==> This will move the file_name to the given location.
  19. mv file_name new_file_name ==> This will rename the file_name to new_file_name.
  20. rm -rf directory_name ==> This will recursively(-r) and forcefully (-f) will delete the directory
  21. find . ==> Finds everything in the directory.
  22. find directory_name/ ==> Finds everything in the given directory_name.
  23. find directory_name -type d ==> Finds only directory in the directory_name
  24. find directory_name -type f ==> Finds only file_name in the directory_name
  25. find . -type f -name "file_name" ==> Finds everything with type file and name as file_name
  26. find . -type f -name "*.txt" ==> Finds everything with type file and whatever has extention as .txt
  27. find . -empty ==> Finds all the directories and files that are empty
  28. clear ==> clears the terminal screen
  29. grep "random_text" file_name ==> Finds the random_text in the file_name only if the exact word is found (it is case sensitive as well)
  30. grep "random_text" file_name -w ==> Finds the random_text in the file_name only prints if random_text is found as a whole word(-w)
  31. grep "random_text" file_name -i ==> Finds the random_text in the file_name and prints regardless of the case sensitiveness. It doesn't mind the case sensitiveness if (-i) is added
  32. grep "random_text" file_name -n ==> Finds the random_text in the file_name and prints the the line number (-n) as well.
  33. grep "random_text" -win ./*.txt ==> Finds the random text in all the text (.txt) files in the directory and ensure that the word found is whole word (-w), regardless of case sensitiveness (-i), and with line number (-n)
  34. diff file_1 file_2 ==> Shows the difference in two files
  35. ping www.example_website.com ==> This will show your internet speed for recieving the pacakages.
  36. curl www.example_website.com ==> This will show the html of that example_website
  37. top ==> This will show cpu usage, memory usage etc at current time
  38. nslookup -type=type service_name ==> Change the type of the information query
  39. nslookup -debug example_website ==> used to find the IP address that corresponds to a host, or the domain name that corresponds to an IP address.
  40. curl -O pdf_url_on_internet ==> It downloads the media from the url to the location

❀️ Thank you for reading ❀️

🌏 Like | Follow | Share 🌏

Discussion (18)

Collapse
cyberjack profile image
CyberJack • Edited

cd or cd ~ does not go to the root directory, but to the users home directory. They may be the same, but this is highly unlikely.

In addition,cd - goes back the the previous directory. So, when in a project, type cd to go the your home directory, and cd - to go back to the project directory.

Collapse
peter279k profile image
peter279k

Correct. Thanks for your detailed explanation so that I don't need to do that :).

Collapse
kaiwalyakoparkar profile image
Kaiwalya Koparkar Author

Thanks, I am learning too. Thanks for the detailed explaination. I will edit the blog soon! :)

Collapse
peter279k profile image
peter279k • Edited

This rmdir directory_name ==> This will delete the directory (Cannot be undone) explanation should change into: rmdir directory_name ==> This will delete the directory (Cannot be undone if the directory is not empty.).

And it will be better than previous explanation.

The curl command is not installed on Linux distribution by default. It should use the package install command (such as apt-get, yum and dnf commands) to install that before using the curl www.example_website.com command.

Collapse
kaiwalyakoparkar profile image
Kaiwalya Koparkar Author

Thanks for that I would rephrase that soon! Thanks for the comment, I appreciate that

Collapse
anscarlett profile image
anscarlett

I think you need to rename your article

Collapse
myleftshoe profile image
myleftshoe

Yes, this is every possible linux command in one handbook! Not complete and not a handbook. Maybe the title should be "Some basic, useful linux commands"

Collapse
leob profile image
leob

Yup nice article but "complete handbook" is a bit of a stretch ;)

Thread Thread
kaiwalyakoparkar profile image
Kaiwalya Koparkar Author

Sorry for the inconvinience. I meant "Complete hadbook for beginners", as this commands are more than enough to get started as beginner. btw thanks for your comment I appreciate that!

Thread Thread
leob profile image
leob

No worries! It's useful anyway

Collapse
kaiwalyakoparkar profile image
Kaiwalya Koparkar Author

Sorry for the inconvinience. I meant "Complete hadbook for beginners", as this commands are more than enough to get started as beginner. btw thanks for your comment I appreciate that!

Collapse
kaiwalyakoparkar profile image
Kaiwalya Koparkar Author

Sorry for the inconvinience. I meant "Complete hadbook for beginners", as this commands are more than enough to get started as beginner. btw thanks for your comment I appreciate that!

Collapse
hanpari profile image
Pavel Morava

An incomplete handbook is it? :)

The first half of these commands is pretty basic.

sudo apt install mc
Enter fullscreen mode Exit fullscreen mode

Midnight Commander may help you to get rid of them if you feel like this.

Collapse
kaiwalyakoparkar profile image
Kaiwalya Koparkar Author

Sorry for the inconvinience. I meant "Complete hadbook for beginners", as this commands are more than enough to get started as beginner. btw thanks for your comment I appreciate that!

Collapse
Sloan, the sloth mascot
Comment deleted
Collapse
kaiwalyakoparkar profile image
Kaiwalya Koparkar Author

Sorry for the inconvinience. I meant "Complete hadbook for beginners", as this commands are more than enough to get started as beginner. btw thanks for your comment I appreciate that!

Collapse
thorstenhirsch profile image
Thorsten Hirsch

"complete" ...yeah, sure. :-)

Collapse
kaiwalyakoparkar profile image
Kaiwalya Koparkar Author

Sorry for the inconvinience. I meant "Complete hadbook for beginners", as this commands are more than enough to get started as beginner. btw thanks for your comment I appreciate that!