You are on page 1of 12

Operating Systems (Linux Programming and

Administration) Lab
Faculty Name: Mrs Savita Name: PULKIT KATHURIA

Roll No.: 40396402715

Semester:6th

Group: C-13

Maharaja Agrasen Institute of


Technology, PSP Area
Sector-22, Rohini, New Delhi-110085
Operating Systems (Linux Programming and Administration) Lab
PRACTICAL RECORD

PAPER CODE : ETCS 352

Name of the student : PULKIT KATHURIA

University Roll No. : 40396402715

Branch : Computer Science Engineering (CSE)

Section/Group : C/C-13

PRACTICAL DETAILS

Exp. no Experiment name Date of Date of Remarks Marks


performance checking (10)
Experiment – 1
Basic Linux Commands

1. ls — Used the to know what files are in the directory you are in. We can see all the
hidden files by using the command “ls -a”.

2. cd — Used to go to a directory. For example, if you are in the home folder, and you want
to go to the downloads folder, then you can type in “cd Downloads”.

3. mkdir — Used when you need to create a folder or a directory. For example, if you want
to make a directory called “MyDir”, then you can type “mkdir MyDir”.

4. rmdir — Used to delete a directory. But rmdir can only be used to delete an empty
directory.
5. rm — Used to delete files and directories. But rm cannot simply delete a directory. Use
“rm -r” to delete a directory. In this case, it deletes both the folder and the files in it.

6. touch — The touch command is used to create a file. It can be anything, from an empty
txt file to an empty zip file. For example, “touch new.txt”.

7. man — To know more about a command and how to use it, we can use the man
command. It shows the manual pages of the command. For example, “man cd” shows
the manual pages of the cd command.
8. cp — Use the cp command to copy files through the command line. It takes two
arguments: The first is the location of the file to be copied, the second is where to copy.

9. mv — Use the mv command to move files through the command line. We can also use
the mv command to rename a file. For example, if we want to rename the file “text” to
“new”, we can use “mv text new”.

10. echo — The echo command is used to print a message on the console.
Experiment – 2
Explain the output of the following commands:

1. find . –name abc && echo “file exists”

Prints the message if a file of the given name exists in the current or in sub directory

2. ls – al

Gives a long list formatted details of all the files in the current directory without ignoring
entries starting with “.”

3. Cat file1 file2 >file3

Concatantes file1 and file2 and saves the output in file3

4. Echo “hello world” >/dev/tty

Prints hello world on screen

5. wc-l file1 file2 file3


prints the line count in the files mentioned

6. man-k permission

display and format the man pages

7. ls-l file1 | wc-l

list the file1 and number of lines in it

8. !wc

Execute the previous command that strats with wc.

9. Cat file1 ; cat file2


Displays content of file1 and file2

10. cp-I file1 file2

copies contents of file1 to file2 and asks before override

Give the commands to perform the following:

1. Rename the file “abc”


mv abc myfile

2. Delete non empty directory


rm –f –r MyDir

3. Move to user home directory


cd.
4. Display the machine name and the kernel number
uname && uname –r

5. Make a directory a/b/c using a single command


mkdir – p a/b/c

6. list the filename starting with letter “p” and ending with letter “t” in home directory
ls –d [p]*[t]

7. display all files in topmost directory of linux filesystem


ls –a

8. display the current working directory


pwd
9. create four files a0,a1,a2,a3 using a single command
touch a0 a1 a2 a3

10. compare two files file1 and file2 and explain the output
diff file1.txt file2.txt

Experiment – 3

Q.1) Symbolically (eg rwx_wx__x), what are the permissions

644: -rw-r--r--. 1 mait16 mait16 0 Jan 15 10:06 a0


755: -rwxr-xr-x. 1 mait16 mait16 0 Jan 15 10:06 a0

000: ----------. 1 mait16 mait16 0 Jan 15 10:06 a0

711: -rwx--x--x. 1 mait16 mait16 0 Jan 15 10:06 a0

700: -rwx------. 1 mait16 mait16 0 Jan 15 10:06 a0

777: -rwxrwxrwx. 1 mait16 mait16 0 Jan 15 10:06 a0

555: -r-xr-xr-x. 1 mait16 mait16 0 Jan 15 10:06 a0

111: ---x--x--x. 1 mait16 mait16 0 Jan 15 10:06 a0

600: -rw-------. 1 mait16 mait16 0 Jan 15 10:06 a0

731: -rwx-wx--x. 1 mait16 mait16 0 Jan 15 10:06 a0

Q.2) Given a file with permission 755, what command would change the permission to
r_xr__r__?

Ans: chmod 544 a0

You might also like