Beruflich Dokumente
Kultur Dokumente
Technology, Tiruchirappalli
UNIX COMMANDS
Red Hat Enterprise Linux Workstation release 6.2 (Santiago)
Kernel 2.6.32-220.el6.x86_64 on an x86_64
login: mcalab27
Password:
Last login: Fri Feb 5 09:15:27 from 10.1.21.141
[mcalab27@localhost ~]$
[mcalab27@localhost ~]$ mkdir dir1
[mcalab27@localhost ~]$ ls
a.out dead.letter dir1 jinendra sh shell sjfp.c
1) who COMMAND with all options.
a) -a, --all
tty2
2016-02-05 09:13
2630 id=2
LOGIN
tty3
2016-02-05 09:13
2632 id=3
LOGIN
tty4
2016-02-05 09:13
2634 id=4
LOGIN
tty5
2016-02-05 09:13
2636 id=5
LOGIN
tty6
2016-02-05 09:13
2644 id=6
3051 (:0)
root
+ tty1
root
+ pts/0
3468 (:0.0)
mcalab10 + pts/1
3486 (10.1.21.94)
mcalab25 + pts/2
3488 (cap.octa.edu)
pts/13
2016-02-05 09:19
mcalab43 + pts/5
mcalab55 + pts/12
pts/10
2016-02-05 09:15 .
2016-02-05 09:16 .
2016-02-05 09:17
3578 id=13
term=0 exit=0
3623 (10.1.21.143)
3575 (10.1.21.149)
3701 id=10
term=0 exit=0
mcalab31 + pts/3
2016-02-05 09:16 .
3705 (10.1.21.102)
mcalab68 + pts/7
2016-02-05 09:17 .
3715 (10.1.21.64)
mcalab07 + pts/14
mcalab42 + pts/6
2016-02-05 09:17 .
3754 (10.1.21.158)
3712 (10.1.21.144)
mcalab03 + pts/16
2016-02-05 09:18 .
3936 (10.1.21.148)
mcalab05 + pts/10
2016-02-05 09:18 .
3943 (10.1.21.150)
mcalab82 + pts/4
mcalab90 + pts/11
4017 (10.1.21.151)
4057 (10.1.21.142)
mcalab27 + pts/8
2016-02-05 09:20 .
4101 (10.1.21.141)
mcalab32 + pts/9
2016-02-05 09:21 .
4195 (10.1.21.103)
pts/13
2016-02-05 09:23
4254 id=13
term=0 exit=0
tty2
2016-02-05 09:13
2630 id=2
LOGIN
tty3
2016-02-05 09:13
2632 id=3
LOGIN
tty4
2016-02-05 09:13
2634 id=4
LOGIN
tty5
2016-02-05 09:13
2636 id=5
LOGIN
tty6
2016-02-05 09:13
2644 id=6
3051 (:0)
root
+ tty1
root
+ pts/0
3468 (:0.0)
mcalab10 + pts/1
3486 (10.1.21.94)
mcalab25 + pts/2
3488 (cap.octa.edu)
pts/13
2016-02-05 09:19
mcalab43 + pts/5
mcalab55 + pts/12
pts/10
3578 id=13
2016-02-05 09:15 .
3623 (10.1.21.143)
2016-02-05 09:16 .
2016-02-05 09:17
term=0 exit=0
3575 (10.1.21.149)
3701 id=10
term=0 exit=0
mcalab31 + pts/3
2016-02-05 09:16 .
3705 (10.1.21.102)
mcalab68 + pts/7
2016-02-05 09:17 .
3715 (10.1.21.64)
mcalab07 + pts/14
mcalab42 + pts/6
mcalab03 + pts/16
2016-02-05 09:17 .
2016-02-05 09:17 00:03
2016-02-05 09:18 .
3754 (10.1.21.158)
3712 (10.1.21.144)
3936 (10.1.21.148)
mcalab05 + pts/10
mcalab82 + pts/4
mcalab90 + pts/11
2016-02-05 09:18 .
3943 (10.1.21.150)
4017 (10.1.21.151)
4057 (10.1.21.142)
mcalab27 + pts/8
2016-02-05 09:20 .
4101 (10.1.21.141)
mcalab32 + pts/9
2016-02-05 09:21 .
4195 (10.1.21.103)
pts/13
2016-02-05 09:23
b) -b, --boot
4254 id=13
term=0 exit=0
2016-02-05 09:19
3578 id=13
term=0 exit=0
pts/10
2016-02-05 09:17
3701 id=10
term=0 exit=0
pts/13
2016-02-05 09:23
4254 id=13
term=0 exit=0
2016-02-05 09:19
3578 id=13
term=0 exit=0
pts/10
2016-02-05 09:17
3701 id=10
term=0 exit=0
pts/13
2016-02-05 09:23
4254 id=13
term=0 exit=0
LINE
TIME
COMMENT
root
tty1
root
pts/0
mcalab10 pts/1
mcalab25 pts/2
mcalab43 pts/5
mcalab55 pts/12
mcalab31 pts/3
mcalab68 pts/7
mcalab07 pts/14
mcalab42 pts/6
mcalab03 pts/16
mcalab05 pts/10
mcalab82 pts/4
mcalab90 pts/11
mcalab27 pts/8
mcalab32 pts/9
mcalab50 pts/17
mcalab25 pts/15
e) --ips
Print IP addresses instead of hostnames. with --lookup,
canonicalizes based on stored IP, if available, rather than stored
hostname.
[mcalab27@localhost ~]$ who -lps
LOGIN
tty2
LOGIN
tty3
LOGIN
tty4
LOGIN
tty5
LOGIN
tty6
tty2
2016-02-05 09:13
2630 id=2
LOGIN
tty3
2016-02-05 09:13
2632 id=3
LOGIN
tty4
2016-02-05 09:13
2634 id=4
LOGIN
tty5
2016-02-05 09:13
2636 id=5
LOGIN
tty6
2016-02-05 09:13
2644 id=6
--help
[mcalab27@localhost ~]$ ls -a
. a.out
shell .swp
.bash_logout .bashrc
dir1
.bash_logout .bashrc
dir1
[mcalab27@localhost ~]$ ls -f
.
.bash_profile .prime.swn .prime.swo .prime.swp dir1 .mozilla
.bash_history ..
.bash_logout
.viminfo .bashrc
jinendra
dead.letter .gnome2
sjfp.c
sh
k) -F, --classify
append indicator (one of */=>@|) to entries
[mcalab27@localhost ~]$ ls -F
a.out* dead.letter dir1/ jinendra/ sh shell/ sjfp.c
[mcalab27@localhost ~]$ ls -g
total 28
-rwxrwxr-x. 1 mcalab27 8978 Oct 26 16:12 a.out
-rw-------. 1 mcalab27
0 Aug 10 14:48 sh
.swp
shell
a.out
[mcalab27@localhost ~]$ ls -h
a.out dead.letter dir1 jinendra sh shell sjfp.c
[mcalab27@localhost ~]$ ls -H
a.out dead.letter dir1 jinendra sh shell sjfp.c
[mcalab27@localhost ~]$ ls -m
a.out, dead.letter, dir1, jinendra, sh, shell, sjfp.c
[mcalab27@localhost ~]$ ls -n
total 28
-rwxrwxr-x. 1 530 530 8978 Oct 26 16:12 a.out
-rw-------. 1 530 530
0 Aug 10 14:48 sh
0 Aug 10 14:48 sh
5) Operations in a directory.
a) Create a new directory dir1
mkdir
[mcalab27@localhost ~]$ mkdir dir1
[mcalab27@localhost ~]$ ls
dir1 odr u work
Creating Parent Directories
[mcalab27@localhost ~]$mkdir -p /home/205114027/dir1/new/new1/new2
[mcalab27@localhost ~]$cd $HOME
[mcalab27@localhost ~]$ls
dir1 dir2 odr u work
[mcalab27@localhost ~]$cd dir1
[mcalab27@localhost ~]$ls
new
[mcalab27@localhost ~]$cd new
[mcalab27@localhost ~]$ls
new1
[mcalab27@localhost ~]$cd new1
[mcalab27@localhost ~]$ls
new2
mkdir with -m option is used to control the permissions of new directories
[mcalab27@localhost ~]$ mkdir -m 077 dir2
[mcalab27@localhost ~]$ ls
dir1 dir2 odr u work
Here 077 means 0=user 7=group and 7=others
7=All read write and execute permissions
0=No permissions at all.
b) Try to read the directory dir2(having no read permission to user)
[mcalab27@localhost ~]$ cd dir2
-bash: cd: dir2: Permission denied
dir3
[mcalab27@localhost ~]$cd /home/205114027
[mcalab27@localhost ~]$ls
dir1 dir2 odr u work
[mcalab27@localhost ~]$cd /home/205114027/dir1
[mcalab27@localhost ~]$ls
dir3
b) Removing Directories
For Empty Directories
[mcalab27@localhost ~]$ls
dir dir1 dir2 odr u work
[mcalab27@localhost ~]$cd dir1
[mcalab27@localhost ~]$ls
dir3 new
[mcalab27@localhost ~]$rmdir dir3
[mcalab27@localhost ~]$ls
New
If directory isnt empty you must use command rm rf to remove it with
the content.
[mcalab27@localhost ~]$rm rf dir3
[mcalab27@localhost ~]$ls