1 |
17 |
dinesha |
50 Most Frequently Used UNIX / Linux Commands (With Examples)
|
2 |
|
|
|
3 |
|
|
http://www.thegeekstuff.com/2010/11/50-linux-commands/
|
4 |
|
|
|
5 |
|
|
This article provides practical examples for 50 most frequently used commands in Linux / UNIX.
|
6 |
|
|
|
7 |
|
|
1. tar command examples
|
8 |
|
|
Create a new tar archive.
|
9 |
|
|
> tar cvf archive_name.tar dirname/
|
10 |
|
|
Extract from an existing tar archive.
|
11 |
|
|
> tar xvf archive_name.tar
|
12 |
|
|
View an existing tar archive.
|
13 |
|
|
> tar tvf archive_name.tar
|
14 |
|
|
2. grep command examples
|
15 |
|
|
Search for a given string in a file (case in-sensitive search).
|
16 |
|
|
> grep -i "the" demo_file
|
17 |
|
|
Print the matched line, along with the 3 lines after it.
|
18 |
|
|
> grep -A 3 -i "example" demo_text
|
19 |
|
|
Search for a given string in all files recursively
|
20 |
|
|
> grep -r "ramesh" *
|
21 |
|
|
3. find command examples
|
22 |
|
|
Find files using file-name ( case in-sensitve find)
|
23 |
|
|
# find -iname "MyCProgram.c"
|
24 |
|
|
Execute commands on files found by the find command
|
25 |
|
|
$ find -iname "MyCProgram.c" -exec md5sum {} \;
|
26 |
|
|
Find all empty files in home directory
|
27 |
|
|
# find ~ -empty
|
28 |
|
|
4. ssh command examples
|
29 |
|
|
Login to remote host
|
30 |
|
|
ssh -l jsmith remotehost.example.com
|
31 |
|
|
Debug ssh client
|
32 |
|
|
ssh -v -l jsmith remotehost.example.com
|
33 |
|
|
Display ssh client version
|
34 |
|
|
> ssh -V
|
35 |
|
|
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
|
36 |
|
|
5. sed command examples
|
37 |
|
|
When you copy a DOS file to Unix, you could find \r\n in the end of each line. This example converts the DOS file format to Unix file format using sed command.
|
38 |
|
|
> sed 's/.$//' filename
|
39 |
|
|
Print file content in reverse order
|
40 |
|
|
> sed -n '1!G;h;$p' thegeekstuff.txt
|
41 |
|
|
Add line number for all non-empty-lines in a file
|
42 |
|
|
> sed '/./=' thegeekstuff.txt | sed 'N; s/\n/ /'
|
43 |
|
|
6. awk command examples
|
44 |
|
|
Remove duplicate lines using awk
|
45 |
|
|
> awk '!($0 in array) { array[$0]; print }' temp
|
46 |
|
|
Print all lines from /etc/passwd that has the same uid and gid
|
47 |
|
|
> awk -F ':' '$3==$4' passwd.txt
|
48 |
|
|
Print only specific field from a file.
|
49 |
|
|
> awk '{print $2,$5;}' employee.txt
|
50 |
|
|
7. vim command examples
|
51 |
|
|
Go to the 143rd line of file
|
52 |
|
|
$ vim +143 filename.txt
|
53 |
|
|
Go to the first match of the specified
|
54 |
|
|
$ vim +/search-term filename.txt
|
55 |
|
|
Open the file in read only mode.
|
56 |
|
|
$ vim -R /etc/passwd
|
57 |
|
|
8. diff command examples
|
58 |
|
|
Ignore white space while comparing.
|
59 |
|
|
# diff -w name_list.txt name_list_new.txt
|
60 |
|
|
|
61 |
|
|
2c2,3
|
62 |
|
|
< John Doe --- > John M Doe
|
63 |
|
|
> Jason Bourne
|
64 |
|
|
9. sort command examples
|
65 |
|
|
Sort a file in ascending order
|
66 |
|
|
$ sort names.txt
|
67 |
|
|
Sort a file in descending order
|
68 |
|
|
$ sort -r names.txt
|
69 |
|
|
Sort passwd file by 3rd field.
|
70 |
|
|
$ sort -t: -k 3n /etc/passwd | more
|
71 |
|
|
10. export command examples
|
72 |
|
|
To view oracle related environment variables.
|
73 |
|
|
$ export | grep ORACLE
|
74 |
|
|
declare -x ORACLE_BASE="/u01/app/oracle"
|
75 |
|
|
declare -x ORACLE_HOME="/u01/app/oracle/product/10.2.0"
|
76 |
|
|
declare -x ORACLE_SID="med"
|
77 |
|
|
declare -x ORACLE_TERM="xterm"
|
78 |
|
|
To export an environment variable:
|
79 |
|
|
$ export ORACLE_HOME=/u01/app/oracle/product/10.2.0
|
80 |
|
|
11. xargs command examples
|
81 |
|
|
Copy all images to external hard-drive
|
82 |
|
|
# ls *.jpg | xargs -n1 -i cp {} /external-hard-drive/directory
|
83 |
|
|
Search all jpg images in the system and archive it.
|
84 |
|
|
# find / -name *.jpg -type f -print | xargs tar -cvzf images.tar.gz
|
85 |
|
|
Download all the URLs mentioned in the url-list.txt file
|
86 |
|
|
# cat url-list.txt | xargs wget -c
|
87 |
|
|
12. ls command examples
|
88 |
|
|
Display filesize in human readable format (e.g. KB, MB etc.,)
|
89 |
|
|
$ ls -lh
|
90 |
|
|
-rw-r----- 1 ramesh team-dev 8.9M Jun 12 15:27 arch-linux.txt.gz
|
91 |
|
|
Order Files Based on Last Modified Time (In Reverse Order) Using ls -ltr
|
92 |
|
|
$ ls -ltr
|
93 |
|
|
Visual Classification of Files With Special Characters Using ls -F
|
94 |
|
|
$ ls -F
|
95 |
|
|
13. pwd command
|
96 |
|
|
pwd is Print working directory. What else can be said about the good old pwd who has been printing the current directory name for ages.
|
97 |
|
|
14. cd command examples
|
98 |
|
|
Use "cd -" to toggle between the last two directories
|
99 |
|
|
15. gzip command examples
|
100 |
|
|
To create a *.gz compressed file:
|
101 |
|
|
$ gzip test.txt
|
102 |
|
|
To uncompress a *.gz file:
|
103 |
|
|
$ gzip -d test.txt.gz
|
104 |
|
|
Display compression ratio of the compressed file using gzip -l
|
105 |
|
|
$ gzip -l *.gz
|
106 |
|
|
compressed uncompressed ratio uncompressed_name
|
107 |
|
|
23709 97975 75.8% asp-patch-rpms.txt
|
108 |
|
|
16. bzip2 command examples
|
109 |
|
|
To create a *.bz2 compressed file:
|
110 |
|
|
$ bzip2 test.txt
|
111 |
|
|
To uncompress a *.bz2 file:
|
112 |
|
|
bzip2 -d test.txt.bz2
|
113 |
|
|
17. unzip command examples
|
114 |
|
|
To extract a *.zip compressed file:
|
115 |
|
|
$ unzip test.zip
|
116 |
|
|
View the contents of *.zip file (Without unzipping it):
|
117 |
|
|
$ unzip -l jasper.zip
|
118 |
|
|
Archive: jasper.zip
|
119 |
|
|
Length Date Time Name
|
120 |
|
|
-------- ---- ---- ----
|
121 |
|
|
40995 11-30-98 23:50 META-INF/MANIFEST.MF
|
122 |
|
|
32169 08-25-98 21:07 classes_
|
123 |
|
|
15964 08-25-98 21:07 classes_names
|
124 |
|
|
10542 08-25-98 21:07 classes_ncomp
|
125 |
|
|
18. shutdown command examples
|
126 |
|
|
Shutdown the system and turn the power off immediately.
|
127 |
|
|
# shutdown -h now
|
128 |
|
|
Shutdown the system after 10 minutes.
|
129 |
|
|
# shutdown -h +10
|
130 |
|
|
Reboot the system using shutdown command.
|
131 |
|
|
# shutdown -r now
|
132 |
|
|
Force the filesystem check during reboot.
|
133 |
|
|
# shutdown -Fr now
|
134 |
|
|
19. ftp command examples
|
135 |
|
|
Both ftp and secure ftp (sftp) has similar commands. To connect to a remote server and download multiple files, do the following.
|
136 |
|
|
$ ftp IP/hostname
|
137 |
|
|
ftp> mget *.html
|
138 |
|
|
To view the file names located on the remote server before downloading, mls ftp command as shown below.
|
139 |
|
|
ftp> mls *.html -
|
140 |
|
|
/ftptest/features.html
|
141 |
|
|
/ftptest/index.html
|
142 |
|
|
/ftptest/othertools.html
|
143 |
|
|
/ftptest/samplereport.html
|
144 |
|
|
/ftptest/usage.html
|
145 |
|
|
20. crontab command examples
|
146 |
|
|
View crontab entry for a specific user
|
147 |
|
|
# crontab -u john -l
|
148 |
|
|
Schedule a cron job every 10 minutes.
|
149 |
|
|
*/10 * * * * /home/ramesh/check-disk-space
|
150 |
|
|
21. service command examples
|
151 |
|
|
Service command is used to run the system V init scripts. i.e Instead of calling the scripts located in the /etc/init.d/ directory with their full path, you can use the service command.
|
152 |
|
|
Check the status of a service:
|
153 |
|
|
# service ssh status
|
154 |
|
|
Check the status of all the services.
|
155 |
|
|
service --status-all
|
156 |
|
|
Restart a service.
|
157 |
|
|
# service ssh restart
|
158 |
|
|
22. ps command examples
|
159 |
|
|
ps command is used to display information about the processes that are running in the system.
|
160 |
|
|
While there are lot of arguments that could be passed to a ps command, following are some of the common ones.
|
161 |
|
|
To view current running processes.
|
162 |
|
|
$ ps -ef | more
|
163 |
|
|
To view current running processes in a tree structure. H option stands for process hierarchy.
|
164 |
|
|
$ ps -efH | more
|
165 |
|
|
23. free command examples
|
166 |
|
|
This command is used to display the free, used, swap memory available in the system.
|
167 |
|
|
Typical free command output. The output is displayed in bytes.
|
168 |
|
|
$ free
|
169 |
|
|
total used free shared buffers cached
|
170 |
|
|
Mem: 3566408 1580220 1986188 0 203988 902960
|
171 |
|
|
-/+ buffers/cache: 473272 3093136
|
172 |
|
|
Swap: 4000176 0 4000176
|
173 |
|
|
If you want to quickly check how many GB of RAM your system has use the -g option. -b option displays in bytes, -k in kilo bytes, -m in mega bytes.
|
174 |
|
|
$ free -g
|
175 |
|
|
total used free shared buffers cached
|
176 |
|
|
Mem: 3 1 1 0 0 0
|
177 |
|
|
-/+ buffers/cache: 0 2
|
178 |
|
|
Swap: 3 0 3
|
179 |
|
|
If you want to see a total memory ( including the swap), use the -t switch, which will display a total line as shown below.
|
180 |
|
|
ramesh@ramesh-laptop:~$ free -t
|
181 |
|
|
total used free shared buffers cached
|
182 |
|
|
Mem: 3566408 1592148 1974260 0 204260 912556
|
183 |
|
|
-/+ buffers/cache: 475332 3091076
|
184 |
|
|
Swap: 4000176 0 4000176
|
185 |
|
|
Total: 7566584 1592148 5974436
|
186 |
|
|
24. top command examples
|
187 |
|
|
top command displays the top processes in the system ( by default sorted by cpu usage ). To sort top output by any column, Press O (upper-case O) , which will display all the possible columns that you can sort by as shown below.
|
188 |
|
|
Current Sort Field: P for window 1:Def
|
189 |
|
|
Select sort field via field letter, type any other key to return
|
190 |
|
|
|
191 |
|
|
a: PID = Process Id v: nDRT = Dirty Pages count
|
192 |
|
|
d: UID = User Id y: WCHAN = Sleeping in Function
|
193 |
|
|
e: USER = User Name z: Flags = Task Flags
|
194 |
|
|
........
|
195 |
|
|
To displays only the processes that belong to a particular user use -u option. The following will show only the top processes that belongs to oracle user.
|
196 |
|
|
$ top -u oracle
|
197 |
|
|
25. df command examples
|
198 |
|
|
Displays the file system disk space usage. By default df -k displays output in bytes.
|
199 |
|
|
$ df -k
|
200 |
|
|
Filesystem 1K-blocks Used Available Use% Mounted on
|
201 |
|
|
/dev/sda1 29530400 3233104 24797232 12% /
|
202 |
|
|
/dev/sda2 120367992 50171596 64082060 44% /home
|
203 |
|
|
df -h displays output in human readable form. i.e size will be displayed in GB's.
|
204 |
|
|
ramesh@ramesh-laptop:~$ df -h
|
205 |
|
|
Filesystem Size Used Avail Use% Mounted on
|
206 |
|
|
/dev/sda1 29G 3.1G 24G 12% /
|
207 |
|
|
/dev/sda2 115G 48G 62G 44% /home
|
208 |
|
|
Use -T option to display what type of file system.
|
209 |
|
|
ramesh@ramesh-laptop:~$ df -T
|
210 |
|
|
Filesystem Type 1K-blocks Used Available Use% Mounted on
|
211 |
|
|
/dev/sda1 ext4 29530400 3233120 24797216 12% /
|
212 |
|
|
/dev/sda2 ext4 120367992 50171596 64082060 44% /home
|
213 |
|
|
26. kill command examples
|
214 |
|
|
Use kill command to terminate a process. First get the process id using ps -ef command, then use kill -9 to kill the running Linux process as shown below. You can also use killall, pkill, xkill to terminate a unix process.
|
215 |
|
|
$ ps -ef | grep vim
|
216 |
|
|
ramesh 7243 7222 9 22:43 pts/2 00:00:00 vim
|
217 |
|
|
|
218 |
|
|
$ kill -9 7243
|
219 |
|
|
27. rm command examples
|
220 |
|
|
Get confirmation before removing the file.
|
221 |
|
|
$ rm -i filename.txt
|
222 |
|
|
It is very useful while giving shell metacharacters in the file name argument.
|
223 |
|
|
Print the filename and get confirmation before removing the file.
|
224 |
|
|
$ rm -i file*
|
225 |
|
|
Following example recursively removes all files and directories under the example directory. This also removes the example directory itself.
|
226 |
|
|
$ rm -r example
|
227 |
|
|
28. cp command examples
|
228 |
|
|
Copy file1 to file2 preserving the mode, ownership and timestamp.
|
229 |
|
|
$ cp -p file1 file2
|
230 |
|
|
Copy file1 to file2. if file2 exists prompt for confirmation before overwritting it.
|
231 |
|
|
$ cp -i file1 file2
|
232 |
|
|
29. mv command examples
|
233 |
|
|
Rename file1 to file2. if file2 exists prompt for confirmation before overwritting it.
|
234 |
|
|
$ mv -i file1 file2
|
235 |
|
|
Note: mv -f is just the opposite, which will overwrite file2 without prompting.
|
236 |
|
|
mv -v will print what is happening during file rename, which is useful while specifying shell metacharacters in the file name argument.
|
237 |
|
|
$ mv -v file1 file2
|
238 |
|
|
30. cat command examples
|
239 |
|
|
You can view multiple files at the same time. Following example prints the content of file1 followed by file2 to stdout.
|
240 |
|
|
$ cat file1 file2
|
241 |
|
|
While displaying the file, following cat -n command will prepend the line number to each line of the output.
|
242 |
|
|
$ cat -n /etc/logrotate.conf
|
243 |
|
|
1 /var/log/btmp {
|
244 |
|
|
2 missingok
|
245 |
|
|
3 monthly
|
246 |
|
|
4 create 0660 root utmp
|
247 |
|
|
5 rotate 1
|
248 |
|
|
6 }
|
249 |
|
|
31. mount command examples
|
250 |
|
|
To mount a file system, you should first create a directory and mount it as shown below.
|
251 |
|
|
# mkdir /u01
|
252 |
|
|
|
253 |
|
|
# mount /dev/sdb1 /u01
|
254 |
|
|
You can also add this to the fstab for automatic mounting. i.e Anytime system is restarted, the filesystem will be mounted.
|
255 |
|
|
/dev/sdb1 /u01 ext2 defaults 0 2
|
256 |
|
|
32. chmod command examples
|
257 |
|
|
chmod command is used to change the permissions for a file or directory.
|
258 |
|
|
Give full access to user and group (i.e read, write and execute ) on a specific file.
|
259 |
|
|
$ chmod ug+rwx file.txt
|
260 |
|
|
Revoke all access for the group (i.e read, write and execute ) on a specific file.
|
261 |
|
|
$ chmod g-rwx file.txt
|
262 |
|
|
Apply the file permissions recursively to all the files in the sub-directories.
|
263 |
|
|
$ chmod -R ug+rwx file.txt
|
264 |
|
|
33. chown command examples
|
265 |
|
|
chown command is used to change the owner and group of a file. \
|
266 |
|
|
To change owner to oracle and group to db on a file. i.e Change both owner and group at the same time.
|
267 |
|
|
$ chown oracle:dba dbora.sh
|
268 |
|
|
Use -R to change the ownership recursively.
|
269 |
|
|
$ chown -R oracle:dba /home/oracle
|
270 |
|
|
34. passwd command examples
|
271 |
|
|
Change your password from command line using passwd. This will prompt for the old password followed by the new password.
|
272 |
|
|
$ passwd
|
273 |
|
|
Super user can use passwd command to reset others password. This will not prompt for current password of the user.
|
274 |
|
|
# passwd USERNAME
|
275 |
|
|
Remove password for a specific user. Root user can disable password for a specific user. Once the password is disabled, the user can login without entering the password.
|
276 |
|
|
# passwd -d USERNAME
|
277 |
|
|
35. mkdir command examples
|
278 |
|
|
Following example creates a directory called temp under your home directory.
|
279 |
|
|
$ mkdir ~/temp
|
280 |
|
|
Create nested directories using one mkdir command. If any of these directories exist already, it will not display any error. If any of these directories doesn't exist, it will create them.
|
281 |
|
|
$ mkdir -p dir1/dir2/dir3/dir4/
|
282 |
|
|
36. ifconfig command examples
|
283 |
|
|
Use ifconfig command to view or configure a network interface on the Linux system.
|
284 |
|
|
View all the interfaces along with status.
|
285 |
|
|
$ ifconfig -a
|
286 |
|
|
Start or stop a specific interface using up and down command as shown below.
|
287 |
|
|
$ ifconfig eth0 up
|
288 |
|
|
$ ifconfig eth0 down
|
289 |
|
|
37. uname command examples
|
290 |
|
|
Uname command displays important information about the system such as - Kernel name, Host name, Kernel release number,
|
291 |
|
|
Processor type, etc.,
|
292 |
|
|
Sample uname output from a Ubuntu laptop is shown below.
|
293 |
|
|
$ uname -a
|
294 |
|
|
Linux john-laptop 2.6.32-24-generic #41-Ubuntu SMP Thu Aug 19 01:12:52 UTC 2010 i686 GNU/Linux
|
295 |
|
|
38. whereis command examples
|
296 |
|
|
When you want to find out where a specific Unix command exists (for example, where does ls command exists?), you can execute the following command.
|
297 |
|
|
$ whereis ls
|
298 |
|
|
ls: /bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz
|
299 |
|
|
When you want to search an executable from a path other than the whereis default path, you can use -B option and give path as argument to it. This searches for the executable lsmk in the /tmp directory, and displays it, if it is available.
|
300 |
|
|
$ whereis -u -B /tmp -f lsmk
|
301 |
|
|
lsmk: /tmp/lsmk
|
302 |
|
|
39. whatis command examples
|
303 |
|
|
Whatis command displays a single line description about a command.
|
304 |
|
|
$ whatis ls
|
305 |
|
|
ls (1) - list directory contents
|
306 |
|
|
|
307 |
|
|
$ whatis ifconfig
|
308 |
|
|
ifconfig (8) - configure a network interface
|
309 |
|
|
40. locate command examples
|
310 |
|
|
Using locate command you can quickly search for the location of a specific file (or group of files). Locate command uses the database created by updatedb.
|
311 |
|
|
The example below shows all files in the system that contains the word crontab in it.
|
312 |
|
|
$ locate crontab
|
313 |
|
|
/etc/anacrontab
|
314 |
|
|
/etc/crontab
|
315 |
|
|
/usr/bin/crontab
|
316 |
|
|
/usr/share/doc/cron/examples/crontab2english.pl.gz
|
317 |
|
|
/usr/share/man/man1/crontab.1.gz
|
318 |
|
|
/usr/share/man/man5/anacrontab.5.gz
|
319 |
|
|
/usr/share/man/man5/crontab.5.gz
|
320 |
|
|
/usr/share/vim/vim72/syntax/crontab.vim
|
321 |
|
|
41. man command examples
|
322 |
|
|
Display the man page of a specific command.
|
323 |
|
|
$ man crontab
|
324 |
|
|
When a man page for a command is located under more than one section, you can view the man page for that command from a specific section as shown below.
|
325 |
|
|
$ man SECTION-NUMBER commandname
|
326 |
|
|
Following 8 sections are available in the man page.
|
327 |
|
|
1. General commands
|
328 |
|
|
2. System calls
|
329 |
|
|
3. C library functions
|
330 |
|
|
4. Special files (usually devices, those found in /dev) and drivers
|
331 |
|
|
5. File formats and conventions
|
332 |
|
|
6. Games and screensavers
|
333 |
|
|
7. Miscellaneous
|
334 |
|
|
8. System administration commands and daemons
|
335 |
|
|
For example, when you do whatis crontab, you'll notice that crontab has two man pages (section 1 and section 5). To view section 5 of crontab man page, do the following.
|
336 |
|
|
$ whatis crontab
|
337 |
|
|
crontab (1) - maintain crontab files for individual users (V3)
|
338 |
|
|
crontab (5) - tables for driving cron
|
339 |
|
|
|
340 |
|
|
$ man 5 crontab
|
341 |
|
|
42. tail command examples
|
342 |
|
|
Print the last 10 lines of a file by default.
|
343 |
|
|
$ tail filename.txt
|
344 |
|
|
Print N number of lines from the file named filename.txt
|
345 |
|
|
$ tail -n N filename.txt
|
346 |
|
|
View the content of the file in real time using tail -f. This is useful to view the log files, that keeps growing. The command can be terminated using CTRL-C.
|
347 |
|
|
$ tail -f log-file
|
348 |
|
|
More tail examples: 3 Methods To View tail -f output of Multiple Log Files in One Terminal
|
349 |
|
|
43. less command examples
|
350 |
|
|
less is very efficient while viewing huge log files, as it doesn't need to load the full file while opening.
|
351 |
|
|
$ less huge-log-file.log
|
352 |
|
|
One you open a file using less command, following two keys are very helpful.
|
353 |
|
|
CTRL+F - forward one window
|
354 |
|
|
CTRL+B - backward one window
|
355 |
|
|
More less examples: Unix Less Command: 10 Tips for Effective Navigation
|
356 |
|
|
44. su command examples
|
357 |
|
|
Switch to a different user account using su command. Super user can switch to any other user without entering their password.
|
358 |
|
|
$ su - USERNAME
|
359 |
|
|
Execute a single command from a different account name. In the following example, john can execute the ls command as raj username. Once the command is executed, it will come back to john's account.
|
360 |
|
|
[john@dev-server]$ su - raj -c 'ls'
|
361 |
|
|
|
362 |
|
|
[john@dev-server]$
|
363 |
|
|
Login to a specified user account, and execute the specified shell instead of the default shell.
|
364 |
|
|
$ su -s 'SHELLNAME' USERNAME
|
365 |
|
|
45. mysql command examples
|
366 |
|
|
mysql is probably the most widely used open source database on Linux. Even if you don't run a mysql database on your server, you might end-up using the mysql command ( client ) to connect to a mysql database running on the remote server.
|
367 |
|
|
To connect to a remote mysql database. This will prompt for a password.
|
368 |
|
|
$ mysql -u root -p -h 192.168.1.2
|
369 |
|
|
To connect to a local mysql database.
|
370 |
|
|
$ mysql -u root -p
|
371 |
|
|
If you want to specify the mysql root password in the command line itself, enter it immediately after -p (without any space).
|
372 |
|
|
46. yum command examples
|
373 |
|
|
To install apache using yum.
|
374 |
|
|
$ yum install httpd
|
375 |
|
|
To upgrade apache using yum.
|
376 |
|
|
$ yum update httpd
|
377 |
|
|
To uninstall/remove apache using yum.
|
378 |
|
|
$ yum remove httpd
|
379 |
|
|
47. rpm command examples
|
380 |
|
|
To install apache using rpm.
|
381 |
|
|
# rpm -ivh httpd-2.2.3-22.0.1.el5.i386.rpm
|
382 |
|
|
To upgrade apache using rpm.
|
383 |
|
|
# rpm -uvh httpd-2.2.3-22.0.1.el5.i386.rpm
|
384 |
|
|
To uninstall/remove apache using rpm.
|
385 |
|
|
# rpm -ev httpd
|
386 |
|
|
48. ping command examples
|
387 |
|
|
Ping a remote host by sending only 5 packets.
|
388 |
|
|
$ ping -c 5 gmail.com
|
389 |
|
|
49. date command examples
|
390 |
|
|
Set the system date:
|
391 |
|
|
# date -s "01/31/2010 23:59:53"
|
392 |
|
|
Once you've changed the system date, you should syncronize the hardware clock with the system date as shown below.
|
393 |
|
|
# hwclock -systohc
|
394 |
|
|
|
395 |
|
|
# hwclock --systohc -utc
|
396 |
|
|
50. wget command examples
|
397 |
|
|
The quick and effective method to download software, music, video from internet is using wget command.
|
398 |
|
|
$ wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gz
|
399 |
|
|
Download and store it with a different name.
|
400 |
|
|
$ wget -O taglist.zip http://www.vim.org/scripts/download_script.php?src_id=7701
|
401 |
|
|
|
402 |
|
|
|