Tuesday, 6 November 2012

executing all file and directory handling commands


executing all file and directory handling commands

[root@domain30 984D-171A]# cal
    October 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

[root@domain30 984D-171A]# date
Fri Oct 19 19:20:27 IST 2012

[root@domain30 984D-171A]# echo "welcome to MIT"
welcome to MIT

[root@domain30 984D-171A]# printf "this is IT department"
this is IT department

[root@domain30 984D-171A]# who
MAHESH   tty1         2012-10-19 19:18 (:0)
MAHESH   pts/0        2012-10-19 19:19 (:0.0)


[root@domain30 984D-171A]# who am i
MAHESH   pts/0        2012-10-19 19:19 (:0.0)

[root@domain30 984D-171A]# uname
Linux

[root@domain30 984D-171A]# tty
/dev/pts/0

[root@domain30 mahesh]# pwd
/mahesh

[root@domain30 mahesh]# ls
2.txt  7  fifth.sh  op2.txt  op.txt  secound.sh  sixth.sh  third.sh

[root@domain30 mahesh]# ls -l
total 28
-rw-r--r--. 1 root   root    19 Oct 18 14:07 2.txt
-rw-r--r--. 1 root   root     0 Oct 18 14:30 7
-rw-r--r--. 1 root   root   170 Oct 12 21:44 fifth.sh
-rw-r--r--. 1 root   root   148 Oct 18 21:05 op2.txt
-rw-r--r--. 1 root   root   148 Oct 18 14:09 op.txt
-rw-r--r--. 1 root   root   667 Oct 18 21:03 secound.sh
-rwxr-xr-x. 1 MAHESH MAHESH 558 Oct 13 16:46 sixth.sh
-rwxr-xr-x. 1 MAHESH MAHESH 500 Oct 12 23:43 third.sh

[root@domain30 mahesh]# mkdir MIT
[root@domain30 mahesh]# ls
2.txt  7  fifth.sh  MIT  op2.txt  op.txt  secound.sh  sixth.sh  third.sh

[root@domain30 mahesh]# rmdir MIT
[root@domain30 mahesh]# ls
2.txt  7  fifth.sh  op2.txt  op.txt  secound.sh  sixth.sh  third.sh



[root@domain30 mahesh]# mkdir ITSE

[root@domain30 mahesh]# mv  ITSE MIT1

[root@domain30 mahesh]# cd ITSE
bash: cd: ITSE: No such file or directory

[root@domain30 mahesh]# rmdir MIT1/

[root@domain30 mahesh]# mkdir ITSE
[root@domain30 mahesh]# vim ITSE/MIT1
[root@domain30 mahesh]# ls ITSE/
MIT1


[root@domain30 mahesh]# more sixth.sh
echo "1.Display the pid of login shell "
echo "2.Display process status "
echo "3.Display detailed listing of processes "
echo "4.Display process of user "
echo "5.Display all users processes "
printf "Enter choice : "
read choice
if [ $choice == 1 ]
then
echo "PID of current shell is : $$"
fi
if [ $choice == 2 ]
then
ps
fi
if [ $choice == 3 ]
then
ps -f
fi
if [ $choice == 4 ]
then
printf "Enter user name : "
read user
ps -u $usr
fi
if [ $choice == 5 ]
then
ps -a
fi
if [ $choice == 6 ]
then
ps -e
else [ $choice > 7 ]
echo "Incorrect choice !"
fi

[root@domain30 mahesh]# file sixth.sh
sixth.sh: ASCII English text

[root@domain30 mahesh]# wc sixth.sh
 41 123 558 sixth.sh

[root@domain30 mahesh]# wc -l sixth.sh
41 sixth.sh


[root@domain30 mahesh]# vim mahi.txt
[root@domain30 mahesh]# od mahi.txt
0000000 064164 071551 064440 020163 064563 070155 062554 063040
0000020 066151 005145
0000024

[root@domain30 mahesh]# cat mahi.txt
this is simple file

[root@domain30 mahesh]# cat mahi.txt
this is simple file
[root@domain30 mahesh]# cat mahi1.txt
it secound simple file
[root@domain30 mahesh]# cmp mahi.txt mahi1.txt
mahi.txt mahi1.txt differ: byte 1, line 1

[root@domain30 mahesh]# comm mahi.txt mahi1.txt
it secound simple file
this is simple file

[root@domain30 mahesh]# diff mahi.txt mahi1.txt
1c1
< this is simple file
---
> it secound simple file


[root@domain30 mahesh]# chmod 421 mahi.txt

[root@domain30 mahesh]# ls -l
total 40
-rw-r--r--. 1 root   root     19 Oct 18 14:07 2.txt
-rw-r--r--. 1 root   root      0 Oct 18 14:30 7
-rw-r--r--. 1 root   root    170 Oct 12 21:44 fifth.sh
drwxr-xr-x. 2 root   root   4096 Oct 19 19:26 ITSE
-rw-r--r--. 1 root   root     23 Oct 19 19:30 mahi1.txt
-r---w---x. 1 root   root     20 Oct 19 19:29 mahi.txt
-rw-r--r--. 1 root   root    148 Oct 18 21:05 op2.txt
-rw-r--r--. 1 root   root    148 Oct 18 14:09 op.txt
-rw-r--r--. 1 root   root    667 Oct 18 21:03 secound.sh
-rwxr-xr-x. 1 MAHESH MAHESH  558 Oct 13 16:46 sixth.sh
-rwxr-xr-x. 1 MAHESH MAHESH  500 Oct 12 23:43 third.sh

No comments:

Post a Comment