Experiment No. 1: Aim: Hands On Basic Commands of Unix: LS, Who, More, CP, RM, MV, Mkdir, CD
Experiment No. 1: Aim: Hands On Basic Commands of Unix: LS, Who, More, CP, RM, MV, Mkdir, CD
1
Aim: Hands on basic commands of unix: ls, who, more, cp, rm, mv, mkdir, cd,
pwd, calc, banner, grep, sort, who, kill, cat, man, find, set, vi, finger, gcc,vi
Thoery:
1) ls
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
Options:
ls -l: list the files in long format i.e. with an index number, owner name,
group name, size, and permissions.
ls -a: list all files including hidden files. These are files that start with “.”.
ls -t: sort the list by time of modification, with the newest at the top.
ls -S: sort the list by size, with the largest at the top.
2)
Who:
DESCRIPTION
Print information about users who are currently logged in.
Options:
-b, --boot
time of last system boot
-H, --heading
print line of column headings.
-l, --login
print system login processes
-q, --count
all login names and number of users logged on
-r, --runlevel
print current runlevel
-a, --all
To display all details of current logged in user
3) more: file perusal filter for crt viewing
DESCRIPTION
more is a filter for paging through text one screenful at a
time. This version is especially primitive. Users should
realize that less(1) provides more(1) emulation plus exten‐
sive enhancements.
Options:
-d Prompt with "[Press space to continue, 'q' to
quit.]", and display "[Press 'h' for instructions.]"
instead of ringing the bell when an illegal key is
pressed.
4) cp: copy files and directories
DESCRIPTION
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
Options:
-i, --interactive
prompt before overwrite (overrides a previous -n option)
DESCRIPTION
Create the DIRECTORY(ies), if they do not already exist.
Options:
-v, --verbose
print a message for each created directory
--version
output version information and exit
--help
display this help and exit
7) cd: cd command in linux known as change directory command. It is used to change current
working directory
Options:
cd ~ : this command is used to change directory to the home directory.
cd.. : this command is used to move to the parent directory of current directory
Options:
--help
display this help and exit
--version
output version information and
exit
DESCRIPTION
grep searches the named input FILEs for lines containing a match to the
given pattern.
Options:
-i :
itenables to search for a string case insensitively in the give file. It
matches the words like “UNIX”, “Unix”, “unix”
-c
we can find the number of lines that matches the given string/pattern
-n
To show the line number of file with the line matched.
10) sort: SORT command is used to sort a file, arranging the records in a
particular order.
Options:
-r
the -r flag is an option of the sort command which sorts the input file in
reverse order
-n
This option is used to sort the file with numeric data present inside.
-nr
To sort a file with numeric data in reverse order we can use the
combination of two options
11) kill: is used to terminate processes manually. kill command sends a signal to
a process which terminates the process. If the user doesn’t specify any signal
which is to be sent along with kill command then default TERM signal is sent
that terminates the process.
Options:
-l :
To display all the available signals you can use below command option:
12) cat:
It will show content of given filename. It reads data from the file and
gives their content as output. It helps us to create, view, concatenate files.
Options:
-s
Cat command can suppress repeated empty lines in output.
14)