IT05P/CE07P Operating Systems Lab
Semester S.E. Semester IV
Subject Operating System
Subject Professor In-charge Ms. Rasika Ransing
Laboratory
Student Name Vinay Uttam Pawar
Roll Number 22101A0031
Experiment 01
Number
Experiment Title Explore usage of basic Linux Commands and system calls for file and directory
management.
Resources / Hardware: I/O Devices (Monitor, Keyboard, Mouse, CPU, RAM, etc.)
Required Software: UNIX OS/JSLinux
Objectives To execute basic Linux commands
(Skill Set /
Knowledge
Tested /
Imparted)
Theory Following are some Unix General Purpose Utility Commands:
1. echo
Use-echo command in Unix is used to display line of text/string that
are passed as an argument . This is a built in command that is mostly
used in shell-script to output text to the screen.
Syntax-echo [string]
2. date
Use-date command is used to display the system date and time.
Syntax-date
3. cat
Use-Cat(concatenate) command is very frequently used in Unix. It
reads data from the file and gives their content as output. It helps us to
create, view, concatenate files.
Syntax-
• to create a file - cat > name_of_the_new_file
• to view a file - cat filename_to_be_viewed
4. history
Department of Information Technology
Use-history command is used to view the previously executed
command.
Syntax-history
5. ls
Use- The command is used in listing contents inside a directory and is
one of the few commands beginners learn from the onset. ls
commands in Linux and other parameters as well that may be used
alongside the command.
Syntax- ls
6. mkdir
Use- mkdir command in Linux allows the user to create directories.
This command can create multiple directories at once as well as set the
permissions for the directories.
Syntax - mkdir [directory name]
7. cd
Use- cd command in linux known as change directory command. It is
used to change current working directory, the root directory is the first
directory in your filesystem hierarchy.
Syntax - cd [directory_name]
8. pwd
Use-The pwd command writes to standard output the full path name of
your current directory (from the root directory). All directories are
separated by a / (slash). The root directory is represented by the first /,
and the last directory named is your current directory.
Syntax – pwd
9. rmdir
Use- rmdir command is used remove empty directories from the
filesystem in Linux. The rmdir command removes each and every
directory specified in the command line only if these directories are
empty. So if the specified directory has some directories or files in it
then this cannot be removed by rmdir command.
Syntax - rmdir [directory name]
10. cp
Use- creates the copy of a file. It will create the new file in destination
with the same name and content as that of the file ‘filename’.
Syntax - cp [source] [destination]
11. mv
Use- mv is used to move one or more files or directories from one
place to another in a file system like UNIX. It has two distinct functions:
a) It renames a file or folder. b) It moves a group of files to a different
directory.
Syntax - mv [source] [destination]
Department of Information Technology
12. rm
Use- deletes a file. It will remove the filename file from the directory.
Syntax - rm [filename]
13. chmod
Use- In Unix-like operating systems, the chmod command is used to
change the access mode of a file. The name is an abbreviation of
change mode. The references are used to distinguish the users to whom
the permissions apply i.e. they are list of letters that specifies whom to
give permissions.
Syntax - chmod [reference][operator][mode] file...
14. wc
Use- wc stands for word count. As the name implies, it is mainly used for
counting purpose. It is used to find out number of lines, word count, byte
and characters count in the files specified in the file arguments. By default
it displays four-columnar output. First column shows number of lines
present in a file specified, second column shows number of words present
in the file, third column shows number of characters present in file and
fourth column itself is the file name which are given as argument.
Syntax – wc filename
15. grep
Use- The grep filter searches a file for a particular pattern of characters,
and displays all lines that contain that pattern. • The pattern that is
searched in the file is referred to as the regular expression (grep stands
for global search for regular expression and print out).
Syntax – grep [options] pattern [files]
16. piping
Use- A pipe is a form of redirection (transfer of standard output to some
other destination) that is used in Linux and other Unix-like operating
systems to send the output of one command/program/process to
another command/program/process for further processing.
Syntax – command_1 | command_2 | command_3 | .... | command_N
17. redirection
Use- It is used to put output of a command in a file. Redirection is done
using the ">" (greater-than symbol).
Syntax – command > filename
18. sort
Use- sort command is used to sort a file, arranging the records in a
particular order. By default, the sort command sorts file assuming the
contents are ASCII. Using options in the sort command can also be used
to sort numerically.
Syntax – sort [options] filename
Department of Information Technology
19. head
Use- The head command, as the name implies, print the top N number
of data of the given input. By default, it prints the first 10 lines of the
specified files. If more than one file name is provided then data from each
file is preceded by its file name.
Syntax – head [OPTION] filename
20. tail
Use- The tail command, as the name implies, prints the last N number of
data of the given input. By default, it prints the last 10 lines of the
specified files. If more than one file name is provided then data from each
file is preceded by its file name.
Syntax – tail [OPTION] filename
21. tar
Use- The Linux ‘tar’ stands for tape archive, which is used to create Archive
and extract the Archive files. tar command in Linux is one of the important
commands that provides archiving functionality in Linux. We can use the
Linux tar command to create compressed or uncompressed Archive files
and also maintain and modify them.
Syntax – tar [options] [archive-file] [file or directory to be archived]
Output
Department of Information Technology
Department of Information Technology
Department of Information Technology
Conclusion Linux commands provide a powerful and flexible interface for managing files,
directories, and system resources. These commands are integral to system
administration and development.