140 + Linux Server Commands List – Worth Learning

Linux Server Commands

In this article you will learn most frequently used Basic Linux Commands with examples. We tried to cover as many Linux Server Commands as we can.

Try TNP HOST VPS Servers 

File Commands

1. The following Linux Command take you to the ‘/ home’ directory

2. This command go back one level

3.  This command takes you two folders back.

4. This command take you to home directory

5. This command takes you to the user’s home directory

6. This command takes you to the previous directory

“COPY” Commands in Linux

7. This command helps you copy one file to another

8. Copy all files of a directory within the current work directory

9. Copy a directory within the current work directory

10. Copy a directory

11. Outputs the mime type of the file as text

Linux Commands about Symlink

12. Linux Command to create a symbolic link to file or directory

13. Create a physical link to file or directory

14. View files of directory

15. View files of directory

16. Show details of files and directory

17. Show hidden files

18. Show files and directory containing numbers

19. Show files and directories in a tree starting from root

20. Create a directory called ‘dir1’

21. Create two directories simultaneously

22. Create a directory tree

23. Move a file or directory

24. Show the path of work directory

25. Delete file called ‘file1’

26. Remove a directory called ‘dir1’ and contents recursively

27. Remove two directories and their contents recursively

28. Delete directory called ‘dir1’

30. Modify timestamp of a file or directory – (YYMMDDhhmm)

31. Show files and directories in a tree starting from root(1)

Linux Commands for Process Management

32. The top command gives you information on the processes that currently exist.

33. The htop command is like top, but prettier and smarter.

34. Use the ps command to list running processes (top and htop list all processes whether active or inactive).

35. A step up from the simple ps command, pstree is used to display a tree diagram of processes      that also shows relationships that exist between them.

36. The who command will display a list of all the users currently logged into your Linux system.

37. As its name suggests, kill can be used to terminate a process with extreme prejudice.

38. The pkill and killall commands can kill a process, given its name.

39. pgrep returns the process IDs that match it.

40. With the help of nice command, users can set or change the priorities of processes in Linux.

41. It is similar to nice command. Use this command to change the priority of an already running process.

42. Gives the Process ID (PID) of a process

43. Gives free hard disk space on your system

44. Gives free RAM on your system

File Permissions

45.  chmod the command for changing permissions

Syntax: chmod permission dir/file

Different File Permissions

7 = 4+2+1 (read/write/execute)

6 = 4+2 (read/write)

5 = 4+1 (read/execute)

4 = 4 (read)

3 = 2+1 (write/execute)

2 = 2 (write)

1 = 1 (execute)

Briefing about Permissions in Linux

There is a huge importance with Linux Commands when we discuss about  Permissions. No restrictions on permissions. Anybody may do anything. Generally not a desirable setting.

The file’s owner may read, write, and execute the file. All others may read and execute the file. This setting is common for programs that are used by all users.

The file’s owner may read, write, and execute the file. Nobody else has any rights. This setting is useful for programs that only the owner may use and must be kept private from others.

All users may read and write the file.

The owner may read and write a file, while all others may only read the file. A common setting for data files that everybody may read, but only the owner may change.

The owner may read and write a file. All others have no rights. A common setting for data files that the owner wants to keep private.

How to use “Find Command”

The below Linux Commands gives you better Idea on find commands. You can also check more Find Commands in our other article too.

46. To find a file by name

47. To find a file by name, but ignore the case of the “File1”

48. To search all files that end in “.conf”

49. To find all files that are exactly 50 bytes

50. To find all files less than 50 bytes

51. To Find all files more than 700 Megabytes

52. To find files that have a modification time of a day ago

53. To find files that were accessed in less than a day ago

54. To find files that last had their meta information changed more than 3 days ago

55. To find files that were accessed in less than a minute ago

56. If we want to match an exact set of permissions

57. If we want to specify anything with at least those permissions

Linux Commands to check Word Count

58. Prints the number of lines in a file.

59. Prints the number of words in a file.

60.  Displays the count of bytes in a file.

61. Prints the count of characters from a file.

62. Prints only the length of the longest line in a file.

Compression Commands (tar, tar.gz, tar.bz2 and zip

Options to use the above Linux Commands

  • c – create a archive file.
  • x – extract a archive file.
  • v – show the progress of archive file.
  • f – filename of archive file.
  • t – viewing content of archive file.
  • j – filter archive through bzip2.
  • z – filter archive through gzip.
  • r – append or update files/directories to existing archive file.
  • w – verify a archive file.

About TAR Command

63. To Create tar Archive File

64. To List Content of tar Archive File

65. To Untar tar Archive File

66. To Untar tar Archive File in a specific directory

67. Untar Single file from tar File

68. Untar Multiple files from tar

69. Extract Group of Files using Wildcard from tar Archive

70. To Add Files or Directories to tar Archive File

About TAR.GZ

71. To Create tar.gz Archive File

72. To List Content tar.gz Archive File

73. To Untar tar.gz Archive File

74. To Untar tar.gz Archive File in a specific directory

75. Untar Single file from tar.gz File

76. Untar Multiple files from tar.gz

77. Extract Group of Files using Wildcard from tar.gz Archive

78. To Add Files or Directories to tar.gz

About TAR.BZ2

79. To Create tar.bz2 Archive File

80. To List Content tar.bz2 Archive File

81. To Uncompress tar.bz2 Archive File

82. Untar Single file from tar.bz2 File

83. Untar Multiple files from tar.bz2

84. Extract Group of Files using Wildcard from tar.bz2 Archive

85. To Add Files or Directories to tar.bz2

86. To Verify tar, tar.gz and tar.bz2 Archive File

Linux Commands for ZIP

ZIP (The extension .zip is not mandatory and this is useful only to identify the file zip file)

87. To zipping a file or folder.

88. To Zip individual files to a zip archive

Zipping a folder is a tricky thing as by default zip will not zip entire folder content such as sub folders and files

89. To zip first level of folder content use * as shown below

90. If there are sub folders and files in 1 folder, in order to zip all content of a folder use -r option

91. To list all the files stored in a zip file. Any of the below commands can be used and they give the same results.

92. To delete a file in an archive without extracting entire zip file.

93. To extract your files from a zip folder.

94. To extract to a specific directory use -d option

95. To extract specific file from an archive

Linux Commands for Special Attributes on Files

96. Allows write opening of a file only append mode

97. Allows that a file is compressed / decompressed automatically by the kernel

98. Makes sure that the program ignores Dump the files during backup

99. Makes it an immutable file, which can not be removed, altered, renamed or linked

100. Allows a file to be delete safely

101. Makes sure that if a file is modified changes are written in synchronous mode as with sync

102. Allows you to recover the contents of a file even if it is canceled

103. Show specials attributes on file/folder

Linux Commands to know System Information

104. To know only system name, you can use uname command

105. To view your network hostname

106. To get information about kernel-version

107. To get the information about your kernel release

108. To get the information about your kernel release

109. To print your machine hardware name

110. All this information can be printed at once. The below two commands gives same result.

111. Find out information about the Linux distribution and version

112. To gather information about file system partitions

113. To view mounted file systems.

114. To view information about your CPU architecture such as number of CPU’s, cores, CPU family model, CPU caches, threads, etc. Either of the two below commands gives same output

115. To view information about block devices

Extract Information about Hardware Components using “dmidecode

116. To print information about memory. You can get the similar output with all the below commands.

117. To print information about system

118. To print information about BIOS

119. To print information about processor

120. To dump all hardware information

Network Commands

121. PING (Packet Internet Groper) command sends packet requests to the address you specify to test the connectivity between 2 nodes.

122. Ifconfig  utility is used to configure network interface parameters. Mostly we use this command to check the IP address assigned to the system.

123. traceroute print the route packets take to network host. Destination host or IP is mandatory parameter to use this utility

124. route command is the tool used to display or modify the routeing table.

125. dig (Domain Information Groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name servers.

126.  Whois To know the information about domain like

127. Host Command to find name to IP or IP to name

128. telnet connect destination host:port via a telnet protocol if connection establishes means connectivity between two hosts is working fine.

130. Tracepath traces the path of the network to the destination you have provided. It attempts to list the series of hosts through which your packets travel on their way to a given destination.

131. nslookup is a program to query Internet domain name servers.

132. netstat command allows you a simple way to review each of your network connections and open sockets. netstat with head output is very helpful while performing web server troubleshooting.

133. scp allows you to secure copy files to and from another host in the network.

134. nmap is a very powerful command, which checks the opened port on the server.

SSH Commands

135. Connect to host as user

136. connect to host on port

KeyBoard Shortcuts

137. Halts the current command

138. Stops the current command, resume with fg in the foreground or bg in the background

139. Log out of current session, similar to exit

140. Erases one word in the current line

141. Erases the whole line

142. Type to bring up a recent command. You need to type the first letter of the command you are searching for.

143. Log out of current session

Conclusion

Hope you will get better with the Linux Commands we covered in this article. Leave your comments in the below comment box.

Was this post helpful?

Leave A Comment?

This site uses Akismet to reduce spam. Learn how your comment data is processed.