Monday, January 20, 2014

Unix and Shell Programming - Basic Unix Commands

with 0 Comment
While true
do
echo “Basic Unix Commands”
echo “*******************”
echo “1.Present Working Directory”
echo “2.User for all working directory”
echo “3.User for current working directory”
echo “4.Display Long Listing”
echo “5.Display Long Listing for column wise”
echo “6.Display Long Listing for row wise”
echo “7.Display Current Date”
echo “8.Display Calendar”
echo “9.Display Unix Details”
echo “10.Move the Cursor Position”
echo “11.Exit”
echo “Enter your Choice”
read n
case $n in

1)
echo “Present working directory”
echo “**********************”
echo
pwd
;;

2)
echo “User for all Working Directory”
echo “*************************”
echo
who
;;

3)
echo “User for Current Directory”
echo “**********************”
echo
who am i
;;

4)
echo “Display Long Listing”
echo “*****************”
echo
ls
ls -l
;;

5)
echo "Display Long Listing Column Wise"
echo "********************"
echo
ls -c
;;

6)
echo "Display Long Listing Row wise"
echo "******************"
echo
ls -x
;;

7)
echo "Display Current Date"
echo "************"
echo
date
;;

8)
echo "Display Calendar"
echo "**********"
echo
read m
read y
cal $m $y
;;

9)
echo "Display Unix Details"
echo "************"
echo
uname
uname -a
;;

10)
echo "Move the Cursor Position"
echo "***************"
echo
echo "Enter the row & column"
read r
read c
tput cup $r $c
echo "Welcome To All"
;;

11)
echo "Exit"
exit
;;
esac
done

---------
Output :
******
Basic Unix Commands
*******************
1.Present Working Directory
2.User for all working directory
3.User for Current working Directory
4.Display Long Listing
5.Display Long Listing for Column wise
6.Display Long Listing for row wise
7.Display Current date
8.Display Calendar
9.Display Unix Details
10.Move the Cursor Position
11.Exit

Enter your Choice
1
Present Working Directory
**********************
/home/smca13

Enter your Choice
2
User for all Working Directory
*************************
smca21 pts/2          Aug 1       14:27(192.168.1.121)
smca20 pts/6          Aug 1       14:27(192.168.1.120)
smca17 pts/3          Aug 1       14:27(192.168.1.137)
smca19 pts/9          Aug 1       14:27(192.168.1.119)

Enter your choice
3
User for Current Directory
**********************
smca13 pts/8          Aug 1       14:27(192.168.1.133)


Enter your choice
4
Display Long Listing
******************
a   depa   guna   muruges   sample1.sh   sasi    test1
aaaa   dhars    hari    navani    sample2.sh   sathya  vani
total 308
drwxrwxr-x   2 smca13   smca13   4096  Jul 26 12:59 aaaa
-rw-rw-r--   1  smca13  smca13   2 Jul 16 15:46 alph1.sh

Enter your choice
5
Display Long Listing Column wise
*****************************
sample.sh   dhars   siva   sasi   priya.sh   friends  priya   muru
do.sh   a   vidhya1   raji   sam.sh   selvi   fruits  sathya


Enter your choice
6
Display Long Listing Row wise
**************************
a    aaaa    alph1.sh   alpha1.sh    alpha.sh    anbu   a.out
asd   ball dad dddd deepa depa dhars
do.sh durga ebill.sh employee f3 fdf friends

Enter your choice
7
Display Current Date
******************
Wed Aug  1  16:09:18  IST 2012


Enter your choice
8
Display Calendar
**************
12
2012


December 2012
Su  Mo  Tu  We  Th  Fr Sa
                 1
2   3     4   5    6   7  8
9 10   11 12  13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31


Enter your choice
9
Display Unix Details
*****************
Linux
Linux SRNM 2.4.21-4.EL #1 Fri Oct 3 18:13:58 EDT 2003 i686 i686
i386 GNU/Linux


Enter your choice
10

Move the cursor position
********************
Enter your row & column
100
5
   Welcome To All

Enter your choice
11
Exit

0 comments:

Post a Comment

Powered by Blogger.

Blog Archive