Wednesday, September 10, 2008

Shell Programming (SPR720)

SPR720 - Lab02

# Program to run through each readable file and ask if user wants to print mail or ignore

#echo "P for printing, M for mailing and I to ignore"

for FILE in /home/*
if [ -r "$FILE" -a -f "$FILE" ]
echo "Accessing >> $FILE"

echo -n "P for printing, M for mailing and I to ignore : "
read YN
if [ "$YN" = "M" -o "$YN" = "m" ]
echo "Sending mail to"
mail -s "$FILE" < "$FILE"
sleep 1

elif [ "$YN" = "P" -o "$YN" = "p" ]
echo "Printing $FILE"
lpr $FILE

elif [ "$YN" = "I" -o "$YN" = "i" ]
echo "IGNORE"

echo "Please Wait . . . "
sleep 1

/bin >> 105
/usr/bin/ >> 1926
/sbin/ >> 252
/usr/sbin/ >> 394


1>look command displays line beginning with a given string. The utility displays any lines in file which contains a given string. It performs a binary search.
-f > Ignore case of alphanumeric characters
-t > Specify a termination character

2> tree -- Tree command lists contents of directories in a tree like format.

3> lustering -- userinfo is a graphical tool to allow user to conveniently change their finger information.

4> xkill -- xkill forces a utility to close. It is generally used with resourse identifier you want to abort, if the id is not given it displays a special cursor to kill the process. This command is very useful when you want to kill a process which is not responding.

5> yes -- yes command outputs a string repetedly untill it is killed. it repetedly outputs 'y' on screen

6> shred -- shred command is used to overwrite the file to hide it and also optionally delete it. It overwrite the file repeatedly to make it harder to recover data.

7> host -- host command is used to convert names to IP addresses and vice versa. When no options are given it prints a short summary of its comand line.

8> sum -- checks sum and counts the blocks in the file

9> talk -- talk command enables one user to talk to another user. it is a visual communication program which copies lines from your terminal to that of another user.

10> top -- top command displays information of list of tasks running on hte system.

11> uptime -- uptime command gives you the information of how long the system has been running.
It tells you the current time, how long have the system been running, how many users have been currently logged in, and the system load average

12> wall -- send a message to everybodys terminal. everybody logged in with their mesg' permission 'yes'

13> arp -- arp stands for address resolution protocol. arp manipulates the system arp cache

14> id -- id command is used to print the user identity

15> lp -- lp command is used to send the file to the printer and print it.

16> quota -- the quota command displays the disk usage and the limits for a user

17> last -- the last command shows the listing of the last logged on users

18> whereis -- locates that where and in which directory the command is. It locates the binary , source, and manual page files for a command

19> logname -- prints the user logname

20> finger -- finger command is used to look up for the users information

21> hunspell -- hunspell is a spellchecker, it is most commonly used as "hunspell "

22> halt -- halt command is used to either reboot or power off the pc

23> cancle -- cancle command is used to cancle all the jobs that are running, eg cancle all the print jobs

24> xclock -- xclock command brings the disply of analog clock

25> free -- free command display the amount of free and used memory in the system

No comments: