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

Experiment No. 1: Aim: Hands On Basic Commands of Unix: LS, Who, More, CP, RM, MV, Mkdir, CD

The document describes commands in Unix including ls, who, more, cp, rm, mkdir, cd, pwd, grep, sort, kill, cat, man, and find. It provides descriptions and common options for each command to view or manipulate files and directories, view system information, find files, and more like sorting, copying, removing, and filtering output. The goal of the experiment was to learn hands-on use of basic Unix commands and their functionality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
277 views

Experiment No. 1: Aim: Hands On Basic Commands of Unix: LS, Who, More, CP, RM, MV, Mkdir, CD

The document describes commands in Unix including ls, who, more, cp, rm, mkdir, cd, pwd, grep, sort, kill, cat, man, and find. It provides descriptions and common options for each command to view or manipulate files and directories, view system information, find files, and more like sorting, copying, removing, and filtering output. The goal of the experiment was to learn hands-on use of basic Unix commands and their functionality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 12

Experiment No.

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:

-b, -backupremove files or directories


make a backup of each existing destination file

-i, --interactive
prompt before overwrite (overrides a previous -n option)

5) rm: remove files or directories


DESCRIPTION
This manual page documents the GNU version of rm. rm removes each
specified file. By default, it does not remove directories.
Options:
-i prompt before every removal
-d, --dir
remove empty directories
-v, --verbose
explain what is being done
6) mkdir: - make directories

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

8) pwd: print name of current/working directory

Options:
--help
display this help and exit

--version
output version information and
exit

9) grep: print lines matching a pattern

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.

cat file1 file2:


To view multiple files

$cat file1 >> file2:


Cat command can append the contents of one file to the end of another file.
-E
Cat command can highlight the end of line.
12) man:
man command in Linux is used to display the user manual of any
command that we can run on the terminal. It provides a detailed view of the
command which includes NAME, SYNOPSIS, DESCRIPTION,
OPTIONS, EXIT STATUS, RETURN VALUES, ERRORS, FILES,
VERSIONS, EXAMPLES, AUTHORS
Options:
-f:
One may not be able to remember the sections in
which a command is present. So this option gives the
section in which the given command is present.
13) find:
The find command in UNIX is a command line
utility for walking a file hierarchy. It can be used
to find files and directories and perform subsequent
operations on them. It supports searching by file,
folder, name

14)

You might also like