Advertisement
dubtrotters

The Linux Command Line Cheat Sheet

Jan 24th, 2019
4,157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.27 KB | None | 0 0
  1. The Linux Command Line Cheat Sheet
  2.  
  3.  
  4. TERMINAL
  5.  
  6. clear Clear the terminal screen.
  7. history Display recently used commands. You can also view these commands via the Up and Down keys.
  8.  
  9. ! Repeat a recently used command. You can use !n to repeat the n-th command in history or !-n to repeat what happened n commands ago.
  10.  
  11. man Display the manual for a terminal program.
  12.  
  13. whatis Display a brief description of a terminal program. A simpler alternative to the man command.
  14.  
  15. alias Create a shortcut to a command or, when combined with the cd command, directory.
  16.  
  17. exit Exit or close the terminal.
  18.  
  19.  
  20. NAVIGATION & FILE MANAGEMENT
  21.  
  22. cd Change directory. Used to navigate between folders.
  23.  
  24. pwd Display current directory.
  25.  
  26. cd Change current directory.
  27.  
  28. ls Display a list of files in the current directory.
  29.  
  30. cp Makes a copy of a file. Defaults to the current directory unless you specify a specific one.
  31.  
  32. mv Move a file from one directory to another.
  33.  
  34. rm Remove a file or set of files.
  35.  
  36. stat Display when a file was last accessed, modified, or changed.
  37.  
  38. touch Change the date accessed or date modified time of a given file to right now.
  39.  
  40. rm Delete a file or files.
  41.  
  42. mkdir Create a directory. Defaults to the current directory, but you can also specify one.
  43.  
  44. rmdir Delete a directory. Defaults to the current directory, but you can also specify one. The target directory must be completely empty.
  45.  
  46. rename Change the name of a file or set of files.
  47.  
  48. find Search a specific directory (or your entire PC) to find files that match designated criteria.
  49.  
  50. locate Search for files or directories. Faster than the find command, but has fewer options.
  51.  
  52. grep Search a specific file or set of files to see if a string of text exists and where.
  53.  
  54. mount Attach a separate filesystem (such as an external hard drive or USB stick) to your system's main filesystem.
  55.  
  56. umount Detach a separate filesystem from your system's main filesystem.
  57. cat Display the contents of a text file. Also works with multiple files.
  58.  
  59. chmod Modify the read, write, and execute permissions of a file.
  60.  
  61. chown Change the user or group that owns a file.
  62.  
  63.  
  64. USERS
  65.  
  66. su Switch user. Unless you desigate a specific user, this command will attempt to sign in as the root user (which you can think of as the system administrator).
  67.  
  68. whoami Displays the current user name.
  69. id Display current user and group.
  70.  
  71. passwd Create or update a user's password.
  72.  
  73.  
  74. SYSTEM ADMINISTRATION
  75.  
  76. uname Displays core system information such as kernel version, hardware, and operating system.
  77.  
  78. sudo Enter before a command to perform the command as a system administrator. User must have administrator priveleges for this to work.
  79.  
  80. apt/dnf/pacman Programs for installing software and updates. Which one to use depends on your Linux-based operating system. Each requires administrator rights and additional instructions, such as sudo apt install program-name.
  81.  
  82. jobs Display the status of all current jobs. A job is a representation of a running process or group of processes.
  83.  
  84. bg Send a job to the background.
  85.  
  86. fg Send a job to the foreground.
  87.  
  88. kill End a process according to its process ID (which you can get using the ps command.
  89.  
  90. killall End all processes whose names match your query.
  91.  
  92. ps Display a list of running processes. Defaults to processes started by the current user.
  93.  
  94. top Displays a list of running processes, sorted by how much CPU each uses. Unlike ps, the command updates in real-time.
  95.  
  96. uptime Displays time since last boot.
  97.  
  98. whereis Finds the executable file for a program.
  99.  
  100. df Displays how much disk space is used and free on your system.
  101.  
  102. free Displays how much RAM is used and free on your system.
  103.  
  104.  
  105. NETWORK MANAGEMENT
  106.  
  107. ip Displays you IP address, network interfaces, bandwidth usage, and more.
  108.  
  109. ping Send or receive data from another computer on a network. Often used to test whether a network connection is established and the speed of that connection.
  110.  
  111. dig Look up a domain's DNS address
  112.  
  113. wget Download a file.
  114.  
  115. ssh Secure Shell. Connect and login to a remote network location.
  116.  
  117.  
  118. MISCELLANEOUS
  119.  
  120. echo Display a line of text. Often used in programs and
  121.  
  122. scripts to relay information to users.
  123.  
  124. factor Displays possible factors of a decimal number.
  125.  
  126. expr Solve math equations.
  127.  
  128. look Look up a word in the dictionary.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement