0% found this document useful (0 votes)
27 views

Unit 1 Commands

Uploaded by

Chola Raja K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Unit 1 Commands

Uploaded by

Chola Raja K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 15

UNIT 1 BASIC COMMANDS SESSION 1.

LAB EXERCISE : 1
Perform all operations:
a) Mr. Sanjay creates a disrectory called “OS”.
b) Sanjay get into the Directory “OS”.
c) He creates 5 empty files in a single shot.
d) Then he deleted the created Directory “OS” with User permission.
e) Mr.Sanjay created a file with some contents.

OUTPUT:

LAB
EXERCISE : 2

Perform all operations:


a) Mr.Kaushal, the auditor who creates a directory called “AUDIT” with the permission
0700.
b) Then the auditor creates a file “secret.txt” with some content and close the file.
c) Display the content of the file “secret.txt”.
d) Display the line numbers for the file “secret.txt”.
e) He removes the file with user permission “secret.txt”.

OUTPUT :

LAB EXERCISE : 3

OPERATING SYSTEMS
UNIT 1 BASIC COMMANDS SESSION 1.1

Perform all operations:


a) Create the given directory structure in a single shot.

b) Remove the directory “DIR5” with the user permission using rm command.
c) Create a file “myfile.txt” with the content and display the numbered non- empty line.
d) Display the $ at the end of each line in the file “myfile.txt”.
e) Display TAB characters as ^I in the file “myfile.txt”.

OUTPUT :

LAB
EXERCISE : 4
Perform all operations:
a) Create the given directory structure in a single shot.

OPERATING SYSTEMS
UNIT 1 BASIC COMMANDS SESSION 1.1

b) Create 20 empty files in a single shot.


c) Remove all the 20 files in a single shot.
d) Display the $ at the end of each line in the “newfile.txt”.
e) Display the line numbers for the file “newfile.txt”.

OUTPUT :

LAB EXERCISE : 5
Perform all operations:
a) Create the given directory structure in a single shot.

OPERATING SYSTEMS
UNIT 1 BASIC COMMANDS SESSION 1.1

b) Delete the directory “Poly”.


c) Create a Directory “Social” inside the directory “Science” with the permission
0744.
d) Create a file “sample.txt” with some contents.
e) Display the $ at the end of each line in the “sample.txt”.

OUTPUT :

LAB EXERCISE : 6
Perform the operations with appropriate commands
a. Dispaly todays date in DD/MM/Y format.
b. Display the today date alone.
c. Display the day(eg: Monday)
d. Display the day count of the year(eg: 123 day in 365 days)
e. Display the current time

OUTPUT :

OPERATING SYSTEMS
UNIT 1 BASIC COMMANDS SESSION 1.1

LAB EXERCISE : 7
Perform the operations using appropriate commands
a. Display all the files and directories.
b. Display the all files including hidden files.
c. Display the file and directories in detail
d. Display the inode number of dircectories.
e. Display the diectories in sorted order.

OUTPUT :

LAB

EXERCISE : 8
Perform the operations using appropriate commands
a. Display the current month calender
b. Display the current year calender
c. Display 2016 calender.
d.Display your birthday month in year 2016
e. Display the previous, current and next month surrounding today.

OUTPUT :

OPERATING SYSTEMS
UNIT 1 BASIC COMMANDS SESSION 1.1

LAB EXERCISE : 9
Verify the mode of operations using appropriate commands
a. Display the current mode of the file f1
b. Change the mode to 0777
c. Allows only owner to do all actions; group and other users are allowed only to read
d. Allows all users can read and write but cannot execute.

OUTPUT :

LAB EXERCISE :10


Perform and verify all the following exercises:
a)A student have to find sum of two expression using bc command
b)A shop keeper need to subtract the money given by the customer to him by using bc
command.
c) Mulitiplication of two numbers using bc command
d)Division of two numbers using bc command
e)Use the scale function to specify the number of decimal digits that the bc command should
return.

OUTPUT :

OPERATING SYSTEMS
UNIT 1 BASIC COMMANDS SESSION 1.1

LAB

EXERCISE :11
Perform and verify all the following exercises:
a)find the square root of number using bc command
b)find the power of numbers using bc command
c)Increment the value of the variable by 5 using bc command
d)decrement the value of the variable by using bc commands
e)compare two numbers and print the result using bc command

OUTPUT :

LAB

EXERCISE : 12
Perform and verify all the following exercises:
a)convert from decimal to hexadecimal using bc command
b)convert from decimal to binary using bc command
c)convert from binary to decimal using bc command
d)convert from hexadecimal to decimal using bc command
e)convert from octal to decimal using bc command

OPERATING SYSTEMS
UNIT 1 BASIC COMMANDS SESSION 1.1

LAB EXERCISE : 13
Perform and verify all the following exercises:
a)find the square root of number using bc command
b)find the power of numbers using bc command
c)Increment the value of the variable by 5 using bc command
d)decrement the value of the variable by using bc commands
e)compare two numbers and print the result using bc command

OUTPUT :

LAB

EXERCISE : 14
Perform and verify all the following exercises:
a)Remove a file named as f1.txt using rm command
b)Remove all files that end with ".txt"
c)Remove a directory when the directory is empty
d)Remove a directory when the directory is not empty
e)Remove every file in the working directory, but prompt before each file to confirm.

OUTPUT :

OPERATING SYSTEMS
UNIT 1 BASIC COMMANDS SESSION 1.1

LAB EXERCISE : 15
Perform and verify all the following exercises:
a)Write a unix command to remove a directory?
b)Write a unix command to remove all the files in a directory?
c)Print the lines of file1.txt in reverse, from last line to first.
d) Attach the separator before instead of after using tac command.

OUTPUT:

LAB EXERCISE : 16
Perform the operations using appropriate commands
a. Create a file f1 with the following

OPERATING SYSTEMS
UNIT 1 BASIC COMMANDS SESSION 1.1

file name: f1
Contents:
Its
a
great
day!!!
Keep smiling
b. Display the number of lines in a file.
c. Display the number of words in a file
d. Display the number of characters in a file
e. Display the number of byte counts in a file.
OUTPUT :

LAB EXERCISE : 17
a) File named picture.jpg in your working directory, and you want to make a copy of it called
picture1.jpg.

b) Moving file is the file source location must be different with the files destination location.

OPERATING SYSTEMS
UNIT 1 BASIC COMMANDS SESSION 1.1

c) If -i options is asking us about overwriting files, than -n option will not allow us to overwrite any
existing files

d) To copy a file from source to destination and when using -i option, it will ask for confirmation
before overwriting a file.

e) Write a unix/linux cd command to change to home directory?

LAB EXERCISE :
18

a) To move multiple files to different multiple location,proceed them in one line separated by space.

OPERATING SYSTEMS
UNIT 1 BASIC COMMANDS SESSION 1.1

b) The source and destination files may also reside in different directories. picture.jpg is the source
of the copy operation, and picture2.jpg is the destination. Both files now exist in your working
directory.

c) Write a unix cd command to go back to one directory?

d) Write a unix cd command to change the directory using the absolute path?

e) Print your current working directory.

LAB EXERCISE : 19

a) Print version of your ‘pwd’ command.

OPERATING SYSTEMS
UNIT 1 BASIC COMMANDS SESSION 1.1

b) To move a directory, just to use mv command without any options.

c) To
copy of
the file

/home/../picture2.jpg with different source location to the directory /home/../picture2.jpg with


different destination file will also be named picture2.jpg

d) Write a unix/linux cd command to go back to two directories?

e) Write a unix/linux cd command to change the directory using the relative path?

LAB EXERCISE :20

a) Print all the locations containing executable named pwd.

b) Change current working directory to anything (say /home) and display it in command line
prompt.

OPERATING SYSTEMS
UNIT 1 BASIC COMMANDS SESSION 1.1

c) To rename a file with the help of mv command

d) To copy a multiple files present in current working directory into another directory with some
other location in drive to safe backup.

e) Write a unix cd command to change the directory using the relative path?

LAB EXERCISE : 21

a) Write a unix cd command to change back to previous directory.

b) Store the value of “pwd” command in variable (say a), and print its value from the variable

OPERATING SYSTEMS
UNIT 1 BASIC COMMANDS SESSION 1.1

c) Check the current working directory and previous working directory in one GO!

d) To rename a Directory with the help of mv command

e)To
copy a
some
source
file
Recursively with option -R from one path to another directory path.

OPERATING SYSTEMS

You might also like