1. OTHER USEFUL COMMAND OF UBUNTU SERVER
BASIC COMMANDS OF LINUX
BASIC COMMANDS OF LINUX
sudo ("superuser do"): A very common expression which indicates that the taken action must be verified
with the admin password.
Now over to some help commands, When you need information about a command,
type "<command name>-h" or "<command name>--help"
man: This manual page tells you about the manual page itself.
intro: Gives you a brief introduction to Linux Commands.
info: Introduces you to the info pages
1. adduser: Add a user to the system
2. addgroup: Add a group to the system
3. alias: Create an alias
4. apropos: Search Help manual pages (man -k)
5. apt-get: Search for and install software packages (Debian/Ubuntu)
6. aptitude: Search for and instal l software packages (Debian/Ubuntu)
7. aspell: Spell Checker
8. awk: Find and Replace text, database sort/validate/index
9. basename: Strip directory and suffix from filenames
10. bash: GNU Bourne-Again SHell
11. bc: Arbitrary precision calculator language
12. bg: Send to background
13. break: Exit from a loop
14. bui ltin: Run a shel l bui ltin
15. bzip2: Compress or decompress named fi le(s)
16. cal: Display a calendar
17. case: Conditional ly perform a command
18. cat: Display the contents of a file
19. cd: Change Directory
20. cfdisk: Partit ion table manipulator for Linux
21. chgrp: Change group ownership
22. chmod: Change access permissions
23. chown: Change fi le owner and group
24. chroot: Run a command with a di fferent root directory
2. 25. chkconfig: System services (runlevel)
26. cksum: Print CRC checksum and byte counts
27. clear: Clear terminal screen
28. cmp: Compare two fi les
29. comm: Compare two sorted fi les line by line
30. command: Run a command - ignoring shel l functions
31. continue: Resume the next iteration of a loop
32. cp: Copy one or more fi les to another locat ion
33. cron: Daemon to execute scheduled commands
34. crontab: Schedule a command to run at a later time
35. csplit: Spl it a file into context -determined pieces
36. cut: Divide a file into several parts
37. date: Display or change the date & t ime
38. dc: Desk Calculator
39. dd: Convert and copy a fi le, write disk headers, boot records
40. ddrescue: Data recovery tool
41. declare: Declare variables and give them attributes
42. df: Display free disk space
43. diff: Display the di fferences between two fi les
44. diff3: Show di fferences among three files
45. dig: DNS lookup
46. dir: Briefly l ist directory contents
47. dircolors: Colour setup for `ls'
48. dirname: Convert a full pathname to just a path
49. dirs: Display list of remembered directories
50. dmesg: Print kernel & driver messages
51. du: Estimate file space usage
52. echo: Display message on screen
53. egrep: Search file(s) for lines that match an extended expression
54. eject: Eject removable media
55. enable: Enable and disable bui ltin shell commands
56. env: Environment variables
57. ethtool: Ethernet card settings
58. eval: Evaluate several commands/arguments
59. exec: Execute a command
60. exit: Exit the shell
61. expect: Automate arbitrary appl icat ions accessed over a terminal
62. expand: Convert tabs to spaces
63. export: Set an environment variable
3. 64. expr: Evaluate expressions
65. false: Do nothing, unsuccessful ly
66. fdformat: Low-level format a floppy disk
67. fdisk: Partition table manipulator for Linux
68. fg: Send job to foreground
69. fgrep: Search file(s) for lines that match a fixed string
70. file: Determine file type
71. find: Search for files that meet a desired criteria
72. fmt: Reformat paragraph text
73. fold: Wrap text to fit a speci fied width.
74. for: Expand words, and execute commands
75. format: Format disks or tapes
76. free: Display memory usage
77. fsck: File system consistency check and repair
78. ftp: Fi le Transfer Protocol
79. function: Define Function Macros
80. fuser: Identi fy/kil l the process that is accessing a file
81. gawk: Find and Replace text within file(s)
82. getopts: Parse positional parameters
83. grep: Search file(s) for lines that match a given pat tern
84. groups: Print group names a user is in
85. gzip: Compress or decompress named file(s)
86. hash: Remember the full pathname of a name argument
87. head: Output the first part of fi le(s)
88. help: Display help for a built -in command
89. history: Command History
90. hostname: Print or set system name
91. id: Print user and group id's
92. if: Condit ionally perform a command
93. ifconfig: Configure a network interface
94. ifdown: Stop a network interface
95. ifup: Start a network interface up
96. import: Capture an X server screen and save the image to file
97. install: Copy fi les and set attributes
98. jobs: List active jobs
99. join: Join l ines on a common field
100. kil l: Stop a process from running
101. kil lall: Kill processes by name
102. less: Display output one screen at a time
4. 103. let: Perform arithmetic on shell variables
104. ln: Make links between files
105. local: Create variables
106. locate: Find files
107. logname: Print current login name
108. logout: Exit a login shel l
109. look: Display lines beginning with a given string
110. lpc: Line printer control program
111. lpr: Off l ine print
112. lprint: Print a fi le
113. lprintd: Abort a print job
114. lprintq: List the print queue
115. lprm: Remove jobs from the print queue
116. ls: List information about fi le(s)
117. lsof: List open files
118. make: Recompi le a group of programs
119. man: Help manual
120. mkdir: Create new folder(s)
121. mkfi fo: Make FIFOs (named pipes)
122. mkisofs: Create an hybrid ISO9660/JOLIET/HFS fi lesystem
123. mknod: Make block or character special files
124. more: Display output one screen at a time
125. mount: Mount a file system
126. mtools: Manipulate MS-DOS files
127. mtr: Network diagnost ics (traceroute/ping)
128. mv: Move or rename files or directories
129. mmv: Mass Move and rename (files)
130. netstat: Networking information
131. nice: Set the priority of a command or job
132. nl: Number lines and write files
133. nohup: Run a command immune to hangups
134. not ify-send: Send desktop not i fications
135. nslookup: Query Internet name servers interactively
136. open: Open a file in its default application
137. op: Operator access
138. passwd: Modi fy a user password
139. paste: Merge lines of fi les
140. pathchk: Check fi le name portabi lity
141. ping: Test a network connect ion
5. 142. pki ll: Stop processes from running
143. popd: Restore the previous value of the current directory
144. pr: Prepare fi les for printing
145. printcap: Printer capabi lity database
146. printenv: Print environment variables
147. print f: Format and print data
148. ps: Process status
149. pushd: Save and then change the current directory
150. pwd: Print Working Directory
151. quota: Display disk usage and l imits
152. quotacheck: Scan a fi le system for disk usage
153. quotact l: Set disk quotas
154. ram: ram disk device
155. rcp: Copy files between two machines
156. read: Read a line from standard input
157. readarray: Read from stdin into an array variable
158. readonly: Mark variables/functions as readonly
159. reboot: Reboot the system
160. rename: Rename files
161. renice: Alter priority of running processes
162. remsync: Synchronize remote fi les via email
163. return: Exit a shel l function
164. rev: Reverse lines of a file
165. rm: Remove files
166. rmdir: Remove folder(s)
167. rsync: Remote fi le copy (Synchronize file trees)
168. screen: Multiplex terminal, run remote shells via ssh
169. scp: Secure copy (remote file copy)
170. sdi ff: Merge two fi les interact ively
171. sed: Stream Editor
172. select: Accept keyboard input
173. seq: Print numeric sequences
174. set: Manipulate shell variables and funct ions
175. sftp: Secure File Transfer Program
176. shi ft: Shi ft positional parameters
177. shopt: Shell Options
178. shutdown: Shutdown or restart l inux
179. sleep: Delay for a speci fied time
180. slocate: Find files
6. 181. sort: Sort text fi les
182. source: Run commands from a fi le
183. split: Split a file into fixed-size pieces
184. ssh: Secure Shel l client (remote login program)
185. strace: Trace system calls and signals
186. su: Subst itute user identity
187. sudo: Execute a command as another user
188. sum: Print a checksum for a fi le
189. suspend: Suspend execution of this shell
190. symlink: Make a new name for a file
191. sync: Synchronize data on disk with memory
192. tail: Output the last part of files
193. tar: Tape Archiver
194. tee: Redirect output to mult iple files
195. test: Evaluate a conditional expression
196. time: Measure Program running t ime
197. times: User and system times
198. touch: Change fi le timestamps
199. top: List processes running on the system
200. traceroute: Trace Route to Host
201. trap: Run a command when a signal is set(bourne)
202. tr: Translate, squeeze, and/or delete characters
203. true: Do nothing, successfully
204. tsort: Topological sort
205. tty: Print filename of terminal on stdin
206. type: Describe a command
207. ulimit: Limit user resources
208. umask: Users file creation mask
209. umount: Unmount a device
210. unalias: Remove an alias
211. uname: Print system information
212. unexpand: Convert spaces to tabs
213. uniq: Uniqui fy fi les
214. units: Convert units from one scale to another
215. unset: Remove variable or funct ion names
216. unshar: Unpack shell archive scripts
217. until: Execute commands (until error)
218. useradd: Create new user account
219. usermod: Modi fy user account
7. 220. users: List users currently logged in
221. uuencode: Encode a binary file
222. uudecode: Decode a file created by uuencode
223. v: Verbosely list directory contents (`ls -l -b')
224. vdir: Verbosely list directory contents (`ls -l -b')
225. vi: Text Editor
226. vmstat: Report virtual memory statistics
227. watch: Execute/display a program periodically
228. wc: Print byte, word, and line counts
229. whereis: Search the user's $path, man pages and source fi les for a program
230. which: Search the user's $path for a program file
231. while: Execute commands
232. who: Print all usernames currently logged in
233. whoami: Print the current user id and name (`id -un')
234. Wget: Retrieve web pages or fi les via HTTP, HTTPS or FTP
235. write: Send a message to another user
236. xargs: Execute uti lity, passing constructed argument list(s)
237. xdg-open: Open a fi le or URL in the user's preferred appl icat ion
Add new user
sudo adduser username
Enter password of current user
Enter new unix password for username
Retype new unix password for username
Remove a user
sudo userdel username
Enter password of current user
Change password of user
sudo passwd username
Enter new unix password for username
Retype new unix password for username
Enable root
sudo passwd root
Enter new unix password for root
Retype new unix password for root
Change user to root
su
Show network interface configuration
8. ifconfig
Show all network interface configuration
ifconfig –a
Down Ethernet
ifdown eth0
Up Ethernet
ifup eth0
Down and up ethernet
ifdown eth0 && ifup eth0
To stop networking service
sudo service networking stop or sudo /etc/init.d/networking stop
To start networking service
sudo service networking start or sudo /etc/init.d/networking start
To restart networking service
sudo service networking restart or sudo /etc/init.d/networking restart
To restart networking service for desktop
sudo service network-manager restart
Ip address for Ethernet eth0
sudo ifconfig eth0 XXX.XXX.XXX.XXX netmask XXX.XXX.XXX.XXX
Default gateway for Ethernet eth0
sudo route add default gw XXX.XXX.XXX.XXX eth0
DNS or Name server
nameserver XXX.XXX.XXX.XXX
nameserver XXX.XXX.XXX.XXX
Edit Ip address via editor
vi /etc/network/interfaces
Ethernet eth0 static to dhcpclient
sudo dhclient eth0
Disable IPv6 if not needed.
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
sysctl –p
ifconfig
9. To stop any service
sudo service stop servicename
sudo /etc/init.d/ servicename stop
To start any service
sudo service start servicename
sudo /etc/init.d/ servicename start
To restart any service
sudo service restart servicename
sudo /etc/init.d/ servicename restart
Add any service to startup
initctl start servicename
Remove any service from startup
initctl stop servicename
To see the list of the startup service
initctl list
To see the status of the startup service
initctl status servicename
Update your Ubuntu Server Using the Software Updater
sudo apt-get update && sudo apt-get dist-upgrade