LAB - Basic Shell Commands in Linux
LAB - Basic Shell Commands in Linux
A shell is a special user program which provides an interface to the user to use operating
system services. Shell accept human readable commands from the user and convert them into
something which kernel can understand. It is a command language interpreter that execute
commands read from input devices such as keyboards or from files. The shell gets started when
the user logs in or start the terminal.
● cat : It is generally used to concatenate the files. It gives the output on the standard
output.
● more : It is a filter for paging through text one screenful at a time.
● less : It is used to viewing the files instead of opening the file.Similar to more command
but it allows backward as well as forward movement.
● head : Used to print the first N lines of a file. It accepts N as input and the default value
of N is 10.
● tail : Used to print the last N-1 lines of a file. It accepts N as input and the default value
of N is 10.
● mkdir : Used to create a directory if not already exist. It accepts directory name as input
parameter.
● cp : This command will copy the files and directories from source path to destination
path. It can copy a file/directory with new name to the destination path. It accepts source
file/directory and destination file/directory.
● mv : Used to move the files or directories. This command’s working is almost similar to
cp command but it deletes copy of file or directory from source path.
● rm : Used to remove files or directories.
● touch : Used to create or update a file.
● grep : This command is used to search for the specified text in a file.
● grep with Regular Expressions : Used to search for text using specific regular
expressions in file.
● sort : This commands is used to sort the contents of files.
● wc : Used to count the number of characters, words in a file.