Header Ads

Top 100 Linux Commands Cheatsheet for Devops

Top 100 Linux Commands Cheatsheet for Devops

Here's our 100 commands long cheat-sheet for Linux terminal use. Most commands should work on all Linux distributions, including Ubuntu and Debian based distributions. Had we missed any, share with us on the comments section below.

1. Display manual pages for commands

whatis [option] [argument]

Usage info:

`whatis -help`

2. Exit from a process


Usage info:

`man exit`

3. Clear the terminal

To clear the screen of the terminal working on


4. Display reference manuals

To view online reference manuals

man [option] [args]

Usage info:

`man -help`

5. Search text files

To search and view text files

less [option] [arguement]

Usage info:

`less --help`

6. Print directory name

To print the current directory's name.

pwd [option] [arguement]

Usage info:

`pwd --help`

7. List files

To list files in a directory

ls[option] [arguement]

Usage info:

ls -h

8. Change directory

To change the current working directory

cd [directory]

Usage info:

`cd --help`

9. Interact with terminal

bash [option] [file]

Usage info:

`bash -help`

10. Output contents of a file

cat [filename]

Usage info:

`cat --help`

11. Display command type and location

type [file] [command name]

Usage info:

`type --help`

12. Customize a command

alias [-p] name[=value]

Usage info:

`alias --help`

13. Display current user's name

whoami [options]

Usage info:

`whoami --help`

14. Locate binaries/source codes

whereis [options] filename

Usage info:


15. Display system date

date[options] [format]

Usage info:

`date --help`

16. Update file timestamps

touch filename

Usage info:

`touch --help`

17. Display text and variables

echo [options] [string]

Usage info:

`man echo`

18. Nano text editor

nano [options] filename

Usage info:

`nano --help`

19. Make file/directory links.

mkdir [option] [directories]

Usage info:

`mkdir --help`

20. Copy files/directories

cp [option] source destination

Usage info:

`cp --help`

21. Move or rename files/directories.

mv [option] source destination

Usage info:

`mv --help`

22. Remove files/directories

rm [option] filename

Usage info:

`rm --help`

23. Count lines/words/bytes

wc [option] filename

Usage info:

`wc --help`

24. Print first lines of a file

head [option] filename

Usage info:

`head --help`

25. Print last lines of a file

tail [option] filename

Usage info:

tail --h

26. Search manual titles and descriptions.

To search a particular keyword

apropos [option] keyword

Usage info:

`apropos -help`

27. Search for files within directories

find [where to start searching]

Usage info:

`find --help`

28. Sorts lines within text files

sort filename.txt

Usage info:

`sort --help`

29. Find repeating consecutive lines

uniq [option] [input] [output]

Usage info:

`uniq --help`

30. Compares lines of text files

diff [option] file1 file2

Usage info:

`diff --help`

31. Compares two files

comm [option] file1 file2

Usage info:

`comm --help`

32. Compare & merge two files

sdiff: -

[-1] [-s] [-o outfile]

Usage info:

`sdiff --help`

33. Combine lines from two files

paste [option] [files]

Usage info:

`paste --help`

34. Displays a calendar

cal [month] year

Usage info:

`cal -help`

35. Pauses for a specified amount of time

sleep number [suffix]

Usage info:

`sleep --help`

36. Prints a snapshot of current processes

ps [options]

Usage info:

`ps --help`

37. Print environment variables

printenv [option] [variable]

Usage info:

`printenv --help`

38. Pass environment variables to other places

export [-f] [-n] name [=value]

Usage info:

`export --help`

39. Set shell and environment variables

set [option]

Usage info:

`set --help`

40. Remove variables/functions


Usage info:

`unset --help`

41. Edit text files

vim [options] filelist

Usage info:

`vim --help`

42. Review command history

history [options] [arguments]

Usage info:

`history --help`

43. Send a signal to process

kill -1

Usage info:

`kill --help`

44. Move a process to the background

bg [job_spec]

Usage info:

`bg --help`

45. Display system information

uname [options]

Usage info:

`uname --help`

46. Shows jobs in the terminal

jobs [option] [job id]

Usage info:

`jobs --help`

47. Manage software packages

dpkg -i/ debpackage

Usage info:

`dpkg --help`

48. Compress files

gzip [options] [filename]

Usage info:

`gzip --help`

49. Decompress files

gunzip [option] [archive_name]

Usage info:

`gunzip --help`

50. Archive files/directories

tar [options] [archive file] [file to be archived]

Usage info:

`tar --help`

51. Synchronize file systems

rsync local file

Usage info:

`rsync --help`

52. Change file permissions

chmod [reference] [operator] [mode]

Usage info:

`chmod --help`

53. Change file owner & group

chown [option] [owner] [group] filename

Usage info:

`chown --help`

54. Shows user & group info

id [option] [user]

Usage info:

`id --help`

55. Temporarily substitute user

su [option] [username[arguements] ]

Usage info:

`su --help`

56. Run a command as admin

sudo [option] [command]

Usage info:

`sudo --help`

57. Change user passwords

passwd [option] [username]

Usage info:

`passwd --help`

58. Adds user and groups

adduser [option] [username]

Usage info:

`adduser --help`

59. Sends data packets to hosts

sudo ping -v

Usage info:

`ping -help`

60. Show the route to hosts

traceroute [option] host_address[path]

Usage info:

`traceroute --help`

61. Get help from remote server

(Domain Information Groper) is a network administration command-line tool for querying Domain Name System (DNS) name servers

dig -v

Usage info:

`dig -help`

62. Downloading files

wget [option] [url]

Usage info:

`wget --help`

63. Show command execution time

time [option] [command]

Usage info:

`man time`

64. Builds & executes commands

xargs [option] [commands]

Usage info:

`xargs --help`

65. Create formatted output

printf (-v) format (arguments)

Usage info:

`printf --help`

66. Evaluates an expression

test condition

67. Builds a branch in a script

if command; then commands

68. Creates a script within a script

function name(commands)

69. Creates a program loop

while command; do command; done

Usage info:

`while -help`

70. Builds a program name



71. Creates a program

for NAME (in words); do command

72. Wrap text to a specified width

fold [option] [file]

Usage info:

`fold --help`

73. Shows file/ file systems status

stat [option] file

Usage info:

`stat --help`

74. Show disk utilization by file/directory

du [option] file

Usage info:

`du --help`

75. Displays memory in a system RAM

free [option]

Usage info:

`free --help`

76. Displays text files page by page

pg [-number] [-p string] [-cefnr]

77. Retrieve information

To retrieve files URLs


Usage info:

`curl --help`

78. List the open files

Lsof shows that httpd listens on port 80


Usage info:

`lsof -help`

79. Shutdown system


80. Network status

shows network ports in use and their incoming connections.


81. Command Line Interface for package


Usage info:

`apt --help`

82. Architecture

To print the computer architecture

arch [OPTION]

Usage info:

`arch --help`

83. Display of pending jobs

atq [-V] [-q queue]

84. Change password for multiple users





Usage info:

`chpasswd --help`

85. Change the root directory

chroot /path/to/new/root command

Usage info:

`chroot --help`

86. Takes input from a keyboard/file


Usage info:

`read -help`

87. Evaluate arithmetic expressions.

dc [option [file ...]

Usage info:

`dc --help`

88. Obtaining the DNS(Domain Name System) name

hostname -[option] [file]

Usage info:

`hostname --help`

89. Control Linux system hostname

To provide a proper API

hostnamectl [options] command

Usage info:

`hostnamectl -help`

90. Capturing a screenshot for any of the active pages

import [options] output-file

91. Reads documentation

info [option]... [menu-item]

92. Copy files and set attributes

install [OPTION]... [-T] SOURCE DEST


install [OPTION]... -t DIRECTORY SOURCE...

install [OPTION]... -d DIRECTORY...

Usage info:

`install --help`

93. Restart system

reboot [options]

Usage info:

`reboot --help`

94. Restoring files from a backup

restore -C [-b blocksize] [-D filesystem] [-f file] [-s fileno][-T directory]

95. Remove directories

rmdir [filename]

Usage info:

`rmdir --help`

96. Delete a user account

userdel [options] login

Usage info:

`userdel --help`

97. Display the user names

To show currently logged in users

users [option] file

Usage info:

`users --help`

98. Active status

To find out how long the system is active

uptime [-options]

Usage info:

`uptime --help`

99. Joins lines from two files

join [option] file1 file2

Usage info:

`join --help`

100. Search for text patterns in a file

grep [option] pattern [file]

Usage info:

`grep --help`

100+. Communicate with other users

To allow a user to communicate with other users, by copying lines from one user's terminal to others

write user [tty]

Usage info:

`write -help`


No comments