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

database queryies

The document outlines various Linux commands used in an operating system lab, including 'cd', 'ls', 'touch', 'cat', and 'cp', along with their functionalities. It describes exercises involving directory creation, file manipulation, and command execution to demonstrate understanding of these commands. Additionally, it covers the process of removing files and directories recursively and forcefully.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

database queryies

The document outlines various Linux commands used in an operating system lab, including 'cd', 'ls', 'touch', 'cat', and 'cp', along with their functionalities. It describes exercises involving directory creation, file manipulation, and command execution to demonstrate understanding of these commands. Additionally, it covers the process of removing files and directories recursively and forcefully.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Muhammad Mujahid

23p-3046
Lab Task 03:
OPERATING SYSTEM LAB
SIR SAAD AHMED
CD:
the cd command is generally used for changing the current directory. But in this case when we
simply enter the command of cd without any parameter then it is used for to change the current
directory back to home.

Ls:
ls command is always used for to list all the directories or files of the current directory.

Touch newfile:
the touch command is generally used for creating a new file.
Ls > newfile;
this command is used to first list all the dierctorties in newfile and then will redirect the output to
newfile.

Cat:
the cat command is basically used to read the contents of a file. So this let us to add contents to
newfile.
Ls -lh:
this commond is used to print all the current directory data in a human readible format with date and
time of creation.

Ls -lh 1>filename:

this commond is used to output the data if the terminal is not target for printing. The item is moved
into the file.
Lsot and lsot 2>newfile:

this commond will copy the terminal output into the file:

------------------------------------------------------------------

# mkdir temporary
# cd temporary
temporary# ls
temporary# cat > newfile
Type any text and press CTRL+D
temporary# cat newfile
these are some basic command in which mkdir is used ot create a directory. Cd is used to change a
directory. Ls is used to list the directories in current file. Cat >newfile make newfile to read output
form the terminal.
Cp newfile:
we had copyfiles to newest from newfile ot newest.

Now we copy newfile to newester by direct coping. Then open another and we have newest in it.

Now we have listing process for all


-a: list all file in a diretory
-l: list file in descriptive format(descpative information)
-lh: almost same with -l ;showing in human readable format
cp newest newestest: copy newest ot newestest:
cat newstest: showing the contents in newestest:

changes the directories by cd .. to temporary again.


mowing newesest to another.
By listing we found that we have another and newfile in temporary

ls another /n*; shows all contents in another starts with n

now we are removing the temp directory but we cannot it directly since it in not null.
Rm temporary/* : command to deletes all the files with in temporary.
Removing from temporary recrsively and forcefully.

-----------------------------------------------------------------------------------

EXERSICE 01:
in the following image:

I first create Grades directory.


Then cd to enter Grades.
Created A ,B and c directries within grades
Touches some files with in each of the directory.
Like maths in A , maths and physics in B and physics in C.
used the tree commonds to show the total number directories and files created.
Removing all the files and directories by using -f and -r which deletes recursively and forcefully.

I totally got 15 commonds to exicute the exercise.

-------------------------------------------------------------------------------------------------------------------
EXERSICE 02:
creates all the required directories.
Subject: →math → physics

showing the relation by using tree;


Changing directory physics into math: showin by tree in the required format

changing directory into physics:

From subject deletes physics in only one command:

for veification we had tree now :

You might also like