Professional Documents
Culture Documents
Objectives
to learn processing,compression,comparison and coding commands.
1. sleep, uptime,w ,top and watch
2. ifconfig, netstate, nslookup and ping
3. md5sum ,mcrypt and mdecrypt
4. zip ,unzip,compress and uncompress
5. diff
6. comm
7. lsof,sed
Command: uptime
Purpose: How long the system has been running since the last bootSYNTAX: sleep NUMBER
SYNTAX: uptime
Examples:
uptime
Command: w
Purpose: Displays the current process running in each shell for al logged-in users.
SYNTAX: w [ -s]
Examples:
w
w -s
Command: top
Purpose: Displays the current state of the system.
SYNTAX: top [ -cqSs]
Examples:
top
top -s
Command: watch
Purpose: Executes a given command at a regular interval.
SYNTAX: watch [ -ndv]
Examples:
watch –n 10 date
watch –v
Command: netstat
Purpose: To display information about all the TCP/IP sockets .
SYNTAX: netstat
Examples:
netstat -a
Command: nslookup
Purpose: To lookup the numerical address .
SYNTAX: nslookup
Examples:
nslookup www.bimcs.edu.pk
Command: ping
Purpose: To determine external internet service.
SYNTAX: ping
Examples:
ping www.bims.edu.pk
Command: md5sum
Purpose: Didplays or checks an MD5 checksum on the specified filename.
SYNTAX: md5sum [ -bct]
Examples:
md5sum a1.txt
md5sum –t fun.sh
Command: mcrypt
Purpose: Encrypt the specified filenamel.
SYNTAX: mcrypt [ -auz]
Examples:
mcrypt –u a1.txt
mcrypt –z secret.doc
Command: mdecrypt
Purpose: mdecrypts a filename.
SYNTAX: mdecrypt
Examples:
mdecrypt secret.doc.enc
Command: unzip
Purpose: decompresses the archives.
SYNTAX: unzip zipped-filename
Examples:
unzip documents “*.doc”
Command: compress
Purpose: compresses the specified filename.
SYNTAX: compress [-vf] filename
Examples:
compress -v bigfile.exe
Command: uncompress
Purpose: decompresses the specified filename.
SYNTAX: uncompress [-vf] filename
Examples:
uncompress myfile.txt.Z
Examples:
diff file1.txt file2.txt
Command: comm
Purpose: Compare sorted files FILE1 and FILE2 line-by-line
SYNTAX: comm file1 file2
Examples:
comm file1.txt file2.txt
With no options, comm produces three-column output. Column one contains lines unique to
FILE1, column two contains lines unique to FILE2, and column three contains lines common to
both files. Each of these columns can be suppressed individually with options.
OPTIONS:
-1 Suppress column 1(lines unique to file 1)
-2 Suppress column 2(lines unique to file 2)
-3 Suppress column 3(lines that appear in both files)
Command: lsof
Purpose: to take list of open files.
Examples:
lsof
lsof +D/var/log
lsof -u abcd
Command: sed
Purpose: Stream editor will print the desired line
Exercises
Revision Exercises