LOGESHKUMAR T(nec12eie020)
Tue May 21 13:13:10 IST 2013
AIM
To create the basic cell comment
DIRECTORY RELATED COMMANDS
Display the present working directory.
bash: groups: command not found
student@ebox:~$ pwd
/home/student
student@ebox:~$
Create a directory named AU.
bash: groups: command not found
student@ebox:~$ mkdir ei020
student@ebox:~$ cd ei020
student@ebox:~/ei020$ mkdir au
student@ebox:~/ei020$
Move to the directory named AU and create a subdirectory named COLLEGE.
bash: groups: command not found
student@ebox:~$ cd ei020
student@ebox:~/ei020$ cd au
student@ebox:~/ei020/au$ mkdir college
student@ebox:~/ei020/au$
Move to the directory named COLLEGE and create 2 subdirectories named Engineering and
Management.
bash: groups: command not found
student@ebox:~$ cd ei020/au/college
student@ebox:~/ei020/au/college$ mkdirENGINEERING
bash: mkdirENGINEERING: command not found
student@ebox:~/ei020/au/college$
Move to the directory named Engineering and create 4 subdirectories named CSE, IT, ECE and
MECH.
bash: groups: command not found
student@ebox:~$ cd ei020/au/college/engineering
student@ebox:~/ei020/au/college/engineering$ mkdir cs
student@ebox:~/ei020/au/college/engineering$ mkdir its
student@ebox:~/ei020/au/college/engineering$ mkdir ec
student@ebox:~/ei020/au/college/engineering$ mkdir mec
student@ebox:~/ei020/au/college/engineering$
Move to the directory named IT and create 3 files named IYear, IIYear, and IIIYear Include some
content in the 3 files.
LOGESHKUMAR T(nec12eie020)
Tue May 21 13:13:10 IST 2013
bash: groups: command not found
student@ebox:~$ cd ei020/au/college/engineering/its
student@ebox:~/ei020/au/college/engineering/its$ cat> 1year
65 students in the 1 year
student@ebox:~/ei020/au/college/engineering/its$ cat> 2yaer
63 students in the 2year
student@ebox:~/ei020/au/college/engineering/its$ cat> 3year
83 students in the 3year
student@ebox:~/ei020/au/college/engineering/its$
Move to the directory named CSE and create 4 files named IYear, IIYear, IIIYear and
IVYear.Include some content in the 4 files.
bash: groups: command not found
student@ebox:~$ cd ei020/au/college/engineering/cs
student@ebox:~/ei020/au/college/engineering/cs$ cat> 1year
86 students are playing football
student@ebox:~/ei020/au/college/engineering/cs$ cat> 2year
87 students are playing circket
student@ebox:~/ei020/au/college/engineering/cs$ cat> 3year
85 students are playing foot ball
student@ebox:~/ei020/au/college/engineering/cs$ cat> 4year
83 students are palying circket
Move to the directory named AU.
bash: groups: command not found
student@ebox:~$ cd ei020
student@ebox:~/ei020$ cd au
student@ebox:~/ei020/au$
Illustrate the use of ls command.
The is comment is used to list out the files directories
Example
bash: groups: command not found
student@ebox:~$ cd ei020/au
student@ebox:~/ei020/au$ ls
au college
student@ebox:~/ei020/au$
Illustrate the use of ls -a command.
The ls-a comment is used for list out all files including hidden files (other files bigin with dot)
Example
bash: groups: command not found
student@ebox:~$ cd ei020/au
student@ebox:~/ei020/au$ ls-a
bash: ls-a: command not found
student@ebox:~/ei020/au$
LOGESHKUMAR T(nec12eie020)
Tue May 21 13:13:10 IST 2013
Illustrate the use of ls -F command.
the "ls -F" is used to indicate the enteries
Example
bash: groups: command not found
student@ebox:~$ cd ei020/au
student@ebox:~/ei020/au$ ls -f
.. . au college
student@ebox:~/ei020/au$
Illustrate the use of ls -l command.what is the information that appears in the 6th column?
The "ls -l" comment is get more information about the list out files in the 6 th column month information
will be appear
Example
bash: groups: command not found
student@ebox:~$ cd ei020/au
student@ebox:~/ei020/au$ ls -l
total 8
drwxrwxr-x 2 student student 4096 Apr 18 16:48 au
drwxrwxr-x 4 student student 4096 Apr 20 14:23 college
student@ebox:~/ei020/au$
Illustrate the use of ls -R command.
The "ls -r" is used to inciudes the Content of the subdirectories
Example
./college/engineering/IT:
./college/engineering/MECH:
./college/engineering/cs:
1year 2year 3year 4year
./college/engineering/cse:
./college/engineering/ec:
./college/engineering/ece:
./college/engineering/it:
./college/engineering/its:
1year 2yaer 2year 3year
./college/engineering/mec:
./college/engineering/mech:
./college/management:
student@ebox:~/ei020/au$
Remove the directory name ECE.
Content
bash: groups: command not found
student@ebox:~$ cd ei020/au/college/engineering
student@ebox:~/ei020/au/college/engineering$ rmdir ec
student@ebox:~/ei020/au/college/engineering$ ls
CSE ECE IT MECH cs cse ece it its mec mech
student@ebox:~/ei020/au/college/engineering$
LOGESHKUMAR T(nec12eie020)
Tue May 21 13:13:10 IST 2013
Delete the CSE directory and its contents with one command.
Content
bash: groups: command not found
student@ebox:~$ cd ei020/au/college/engineering
student@ebox:~/ei020/au/college/engineering$ rm -r cs
student@ebox:~/ei020/au/college/engineering$ ls
CSE ECE IT MECH cse ece it its mec mech
student@ebox:~/ei020/au/college/engineering$
Imagine you working on a system and someone accidentally deleted the ls command (/bin/ls).How
could you get a list of the files in the current directory?
Content
bash: groups: command not found
student@ebox:~$ cd ei020
student@ebox:~/ei020$ ls
au college
student@ebox:~/ei020$ echo *
au college
student@ebox:~/ei020$
FILE RELATED COMMANDS
Try this command - cat test.
Content
bash: groups: command not found
student@ebox:~$ cd ei020
student@ebox:~/ei020$ cat test
cat: test: No such file or directory
student@ebox:~/ei020$
Create a file named test using cat and in this file enter numbers from 1 to 50, one per line.
Content
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
LOGESHKUMAR T(nec12eie020)
Tue May 21 13:13:10 IST 2013
Try the command - cat test.
Content
bash: groups: command not found
student@ebox:~$ cd ei020
student@ebox:~/ei020$ cat>test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Try the command - cat -n test.
Content
bash: groups: command not found
student@ebox:~$ cd ei020
student@ebox:~/ei020$ cat -n test
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
student@ebox:~/ei020$
Try to add numbers from 51 to 60 to the same test file using cat command.
bash: groups: command not found
student@ebox:~$ cd ei020
student@ebox:~/ei020$ cat>>test
51
52
53
54
55
56
57
58
59
60^Z
[1]+ Stopped cat >> test
student@ebox:~/ei020$
LOGESHKUMAR T(nec12eie020)
Tue May 21 13:13:10 IST 2013
Create a file named test1 and in this file enter numbers from 61 to 65.
bash: groups: command not found
student@ebox:~$ cd ei020
student@ebox:~/ei020$ cat>test1
61
62
63
64
65
^Z
[1]+ Stopped cat > test1
student@ebox:~/ei020$
Using a single unix command, concatenate the 2 files named test and test1 and save it in test2.
52
53
54
55
56
57
58
59
60
51
52
53
54
55
56
57
58
59
61
62
63
64
65
student@ebox:~/ei020$
Illustrate the use of cp command by copying the file test1 to test2.
CP command is used to copy the content from test1 to test2
Try this command cp test2 test1.
Content
52
53
54
55
56
57
58
59
60
51
52
53
54
55
56
57
58
59
61
62
63
64
65
student@ebox:~/ei020$
LOGESHKUMAR T(nec12eie020)
Tue May 21 13:13:10 IST 2013
Try this command cp -i test2 test1.
Content
bash: groups: command not found
student@ebox:~$ cd ei020
student@ebox:~/ei020$ cp -i test2 test1
cp: overwrite `test1'?
Copy all the files that start with test to a new subdirectory named T.
Content
bash: groups: command not found
student@ebox:~$ cd ei020
student@ebox:~/ei020$ mkdir T
student@ebox:~/ei020$ cp * test T
cp: omitting directory `T'
cp: omitting directory `au'
cp: omitting directory `college'
cp: warning: source file `test' specified more than once
student@ebox:~/ei020$
Rename the file named test to testnew.
Content
bash: groups: command not found
student@ebox:~$ cd ei020
student@ebox:~/ei020$ mv test testnew
student@ebox:~/ei020$ ls
T au college test1 test2 testnew
student@ebox:~/ei020$
Illustrate the use of more command.
"MORE" commands is used to scroll the screen
Example
Content
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
51
52
53
--More--(48%)
LOGESHKUMAR T(nec12eie020)
Tue May 21 13:13:10 IST 2013
Illustrate the use of chmod command.
"chmod" command is used to change the file directory permission
Example
Content
bash: groups: command not found
student@ebox:~$ cd ei020
student@ebox:~/ei020$ chmod 111 test2
student@ebox:~/ei020$ ls -l
total 24
drwxrwxr-x 2 student student 4096 May 18 14:04 T
drwxrwxr-x 4 student student 4096 Apr 18 16:52 au
drwxrwxr-x 2 student student 4096 Apr 17 16:46 college
-rw-rw-r-- 1 student student 123 May 18 14:01 test1
---x--x--x 1 student student 123 May 18 13:58 test2
-rw-rw-r-- 1 student student 108 May 18 13:54 testnew
student@ebox:~/ei020$
RESULT
Thus the command has been completed and verified successfully