DEV Community

Cover image for 20 Helpful Linux Commands You Should Know
sahra 💫
sahra 💫

Posted on

20 Helpful Linux Commands You Should Know

Linux offers a ton of commands that can be used to perform various operations, ranging from simply creating a new file, to complex system controls, all from your terminal. Today we will be looking at 20 of these helpful commands. Let's go!

  1. lscpu - Lists the CPU info of device.

  2. apt list - Lists all available packages. Add (--installed) to search for only the installed ones.

  3. cmatrix - Creates a cool matrix look in your terminal (( apt install cmatrix )).

  4. ps - Lists all the running processes.

  5. top - Displays info of all the running processes in your terminal.

  6. ps aux - Prints out the complete proccess table of the kernel

  7. ps -A - List all current process

  8. kill - stops a process. (( kill [process id] ))

  9. exit  - Terminates the current open proccess.

  10. chsh - Changes the login shell ((shell that boots up first in the terminal))

  11. echo $$ - Prints the calling parent proccess id.

  12. echo $PID_MAX - Prints out the maximum number of proccess that can be run simultaneously in the machine.

  13. ls -F - Lists contents of the current directory, and also adds / to the end of each directory name, to signify it's a directory.

  14. echo $PATH | sed 's/:/\n/g' - Prints each directory contained in the the environment PATH variable, one directory per line.

  15. echo off - Disable visibility of characters entered in the terminal(can be used for password input). The opposite is used to turn it back on.

  16. whereis - Prints out the file path(whereabout)of a linux command or file i.e (whereis command) .

  17. uname - Prints out the name of the operating system.

  18. cat /etc/*os-release - Prints out the details of the distro u're using.

  19. echo $? - Prints out the exit code of the previous command.

  20. diff - Shows the difference between the two files specified.

That is all for this article. Hope you've been able to learn something new today 😊. If you have any questions or suggestions, don't hesitate to drop them in the comment section. Till then, happy coding!🤗

Top comments (0)