You are on page 1of 3

OS LAB Assignment 1

bcs_2020014@iiitm.ac.in
Arun Kumar Rathod
command 1: shows the present working directory
syntax: ~$ pwd

command 2: used to make a new folder/directory in any directory/folder


syntax: ~$ mkdir <directory name>

command 3: used to delete/remove a directory/folder


syntax: ~$ rmdir <directory name>

command 4: used to show/list all the directories/files located in a directory


syntax: ~$ ls

command 5: used to enter into a directory/folder


syntax: ~$ cd <directory name>

command 6: used to create a empty file


syntax: ~$ touch <file name>

command 7: used to create/read a file


syntax(to create file): ~$ cat > <file name>
(#note: after after writting the file content
we need to press ctrl+d to save and return to command line).
syntax(to read file): ~$ cat <file name>

command 8: to delete/remove a file


syntax: ~$ rm <file name>
command 9: to make a copy of a file in same directory or different directory
syntax: ~$ cp <file name1> <file name2>
(This will create a copy of file name1 with a name file name2 in same directory)
syntax: ~$ cp <file name> <directory>
(will create a copy of <file name> into provided directory.)

command 10: used to move or rename a file


syntax: ~$ mv <file name1> <file name2>
(this will rename file name 1 to file name 2)
syntax: ~$ mv <file name> <directory name>
(this will move the file into the directory)

command 11: will print first 10 lines of a file


syntax: ~$ head <file name>

command 12: will print last 10 lines of a file


syntax: ~$ tail <file name>

command 13: will print a file from bottom to top


syntax: ~$ tac <file name>

command 14: used to find a file or type of files


syntax: ~$ find . -name "<filename>"
(to find a single file with name)
syntax: ~$ find . -name "*.<extension name>"
(to find similar type of files)

command 15: to display date & related details


syntax: ~$ date

command 16: to display the calender of the ongoing month


syntax: ~$ cal
suntax: ~$ cal <year>
(command to for calender of any year)

command 17: to display disk space used by file system


syntax: ~$ df

command 18: to clear the terminal screen


syntax: ~$ clear

command 19: to find out the no. of lines,words,characters in a file


syntax: ~$ wc <file name>

command 20: to exit the terminal


syntax: ~$ exit

You might also like