A. Unix Basic Commands

FILE CREATION USING CAT:

[system]$ cat > samp.txt

welcome
to
little drops @ i.thiyagaraaj.com

DISPLAY FILE CONTENTS:

[system]$ cat samp.txt

welcome
to
little drops @ i.thiyagaraaj.com

LISTING FILES IN A DIRECTORY:

[system]$ ls

a.out atex.c~ forchild fork.c id.c jmp.c~ pipe.c~ procmask.c sam.txt sel.c slide.c atex.c ffor.c forchild.c get.c jmp.c pipe.c pmask.c procmask.c~ sat

APPENDIND CONTENTS TO A FILE:

[system]$ cat >> samp.txt
website collection
[system]$ cat samp.txt
Welcome to
little drops @ i.thiyagaraaj.com
website collection

WORD COUNT:

[system]$ wc sam.txt

8 14 51 sam.txt

[system]$ wc -w sam.txt

14 sam.txt

CREATING EMPTY DIRECTORY:

[system]$ touch empty.txt

[system]$ cat empty.txt

REMOVING EMPTY DIRECTORY:

[system]$ rm empty.txt

VIEWING FILE PERMISSION:

[system]$ ls -l

total 180

-rwxrwxr-x 1 systemuser systemuser 6923 Feb 4 05:04 a.out

-rwxr-xr-x 1 systemuser systemuser 483 Feb 4 05:15 atex.c

-rw-r--r-- 1 systemuser systemuser 479 Jan 24 07:07 atex.c~


[system]$ ls -a


a.out atex.c~ forchild fork.c id.c jmp.c~ pipe.c~ procmask.c sam.txt sel.c slide.c atex.c ffor.c forchild.c get.c jmp.c pipe.c pmask.c procmask.c~

[system]$ ls

a.out atex.c~ forchild fork.c id.c jmp.c~ pipe.c~ procmask.c s1 sat sel.c~ vff.c atex.c ffor.c forchild.c get.c jmp.c pipe.c pmask.c procmask.c~ sam.txt

USERS CURRENTLY LOGGED IN:

[system]$ who

systemuser :0 2011-02-05 00:03

systemuser pts/1 2011-02-05 00:04 (:0.0)



[system]$ who am i

systemuser pts/1 2011-02-05 00:04 (:0.0)

VIEW ABSOLUTE PATH :

[system]$ pwd

/home/systemuser/sat

CREATING DIRECTORY:

[system]$ mkdir s1

ECHO COMMAND:

[system]$ echo "sat"

sat

CAL COMMAND:

[system]$ cal

February 2011


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

DATE COMMAND:

[system]$ date

Sat Feb 5 00:11:39 IST 2011

CALENDER FOR 2011:

[system]$ cal 2011

  2011



   January  February  March

  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa

  1  1 2 3 4 5  1 2 3 4 5

  2 3 4 5 6 7 8  6 7 8 9 10 11 12  6 7 8 9 10 11 12

   9 10 11 12 13 14 15  13 14 15 16 17 18 19  13 14 15 16 17 18 19

  16 17 18 19 20 21 22  20 21 22 23 24 25 26  20 21 22 23 24 25 26

  23 24 25 26 27 28 29  27 28  27 28 29 30 31

  30 31



   April  May  June

Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa

    1 2  1 2 3 4 5 6 7  1 2 3 4

  3 4 5 6 7 8 9  8 9 10 11 12 13 14  5 6 7 8 9 10 11

 10 11 12 13 14 15 16  15 16 17 18 19 20 21  12 13 14 15 16 17 18

 17 18 19 20 21 22 23  22 23 24 25 26 27 28  19 20 21 22 23 24 25

 24 25 26 27 28 29 30  29 30 31  26 27 28 29 30



  July  August   September

Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa

   1 2 1 2 3 4 5 6  1 2 3

  3 4 5 6 7 8 9  7 8 9 10 11 12 13  4 5 6 7 8 9 10

 10 11 12 13 14 15 16  14 15 16 17 18 19 20  11 12 13 14 15 16 17

 17 18 19 20 21 22 23  21 22 23 24 25 26 27  18 19 20 21 22 23 24

 24 25 26 27 28 29 30  28 29 30 31  25 26 27 28 29 30

 31



  October  November  December

Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa

   1  1 2 3 4 5  1 2 3

  2 3 4 5 6 7 8  6 7 8 9 10 11 12  4 5 6 7 8 9 10

  9 10 11 12 13 14 15  13 14 15 16 17 18 19 11 12 13 14 15 16 17

 16 17 18 19 20 21 22  20 21 22 23 24 25 26  18 19 20 21 22 23 24

 23 24 25 26 27 28 29  27 28 29 30  25 26 27 28 29 30 31

 30 31

CHANGE DIRECTORY:

[system]$ cd solai

[systemuser@localhost solai]$ cd ..

[system]$ cat > sol.txt

xxx

yyy

COPY CONTENTS FROM ONE FILE TO ANOTHER:

[system]$ cp sam.txt sol.txt

[system]$ cat sol.txt

welcome to little drops @ i.thiyagaraaj.com

website collection 5MOVE FILE TO ANOTHER DIRECTORY:
[system]$ mv sol.txt sol

[system]$ cd sol

[system]$ ls

sol.txt

RENAME FILE:

[system]$ mv sol.txt sat.txt

[system]$ cat sol.txt

welcome to little drops @ i.thiyagaraaj.com

website collection