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

Exp 1 Basic Unix Commands

This document provides information on basic UNIX commands. It describes commands for file manipulation like cat, more, wc, file, spell, split, cp, mv, and rm. It also covers general purpose commands such as banner, who, date, cal, id, clear, tput, uname, tty, pwd, bc, ls, echo, and man. Finally, it discusses command grouping and filter commands including head, tail, pr, cut, paste, join, uniq, sort, nl, tr, tee, and grep. The purpose, syntax, and output of each command is defined.

Uploaded by

Sneha S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views

Exp 1 Basic Unix Commands

This document provides information on basic UNIX commands. It describes commands for file manipulation like cat, more, wc, file, spell, split, cp, mv, and rm. It also covers general purpose commands such as banner, who, date, cal, id, clear, tput, uname, tty, pwd, bc, ls, echo, and man. Finally, it discusses command grouping and filter commands including head, tail, pr, cut, paste, join, uniq, sort, nl, tr, tee, and grep. The purpose, syntax, and output of each command is defined.

Uploaded by

Sneha S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

EXP 1 BASIC UNIX COMMANDS Sneha.

S(IT D)

Aim:
To Study about basic UNIX Commands.

FILE MANIPULATION COMMANDS


Command : Cat

Purpose : It is used to display the contents of the file as well as used to create a new file.

Syntax : cat <file name >

Output

Command : More

Purpose : It is used to display the contents of the file on the screen at a time.

Syntax : more <file name >

Output
Command : Wc

Purpose : It is used to count the number of lines ,words and characters in a file or

group of files.

Syntax : wc [options] <file name >

Output

Command : File

Purpose : It is used to determine the type of the file.

Syntax : file <file name >

Output

Command : Spell

Purpose : It is used to find the spelling errors in the file.

Syntax : spell [options] <file name >

Output
Command : Split

Purpose : It is used to split the given file into smaller pieces of given size.

Syntax : split –size <file name > < splitted file name >

Output

Command : Cp

Purpose : It is used to copy one or more files.

Syntax : cat <source file name > <destination file name>

Output

Command : Mv

Purpose : It is used to move a file within a directory with different names and also used to move a
file to different directory with its original name.

Syntax : mv <source file name > <destination file name>

Output
Command : Rm

Purpose : It is used to remove a file from the disk.

Syntax : rm <file name >

Output

GENERAL PURPOSE COMMANDS

Command : Banner

Purpose : It is used to display its argument in large letters.

Syntax : banner < string >

Output

Command : Who

Purpose : It is used to get the information about all the users currently working in
the system.

Syntax : who

Output
Command : Date

Purpose : It is used to display the system date and time.

Syntax : date

Output

Command : Cal

Purpose : It prints the calender for the specified year and month.

Syntax : cal <month> <year>

Output

Command : Id

Purpose : It is used to display the login name.

Syntax : id

Output

Command : Clear

Purpose : It is used to clear the screen.

Syntax : clear

Output
BEFORE

AFTER

Command : Tput

Purpose : It is used to manipulate the screen.

Syntax : tput < attributes >

Output
Command : Uname
Purpose : It is used to display the details about the OS in which we are working.

Syntax : uname [options]

Output

Command : Tty
Purpose : It is used to know the terminal name on which we work.
Syntax : tty

Output

Command : Pwd
Purpose : It is used to display the absolute pathname of current working directory.

Syntax : pwd

Output

Command : Bc
Purpose : It is used to perform simple mathematical calculations.
Syntax : bc <operation>

Output
Command : Ls

Purpose : It is used to display the files in the current working directory.

Syntax : ls [options] <arguments>

Output

Command : Echo

Purpose : It echoes the argument on the standard output device.

Syntax : echo [options] <string>

Output

Command : Man

Purpose : It gives details about the unix commands.

Syntax : man < command name >


COMMAND GROUPING & FILTER COMMANDS

TEST.TXT

Command : Head

Purpose : It is used to display the top portion of the file.

Syntax : head [options] <file name>

Output
Command : Tail

Purpose : It is used to display the bottom portion of the file.

Syntax : tail [options] <file name >

Output

Command : Pr

Purpose : It is used to display the contents of the file by separating them into pages
and each page begins with the header information.

Syntax : pr [options] <file name >

Output
Command : Cut

Purpose : It is used to extract selected fields or columns from each line of one or
more files and display them on the standard output device.

Syntax : cut [options] <file name >

Output

Command : Paste

Purpose : It concatenates the line from each input file column by column with tab
characters in between them.

Syntax : paste [options] <file name >

Output

Command : Join

Purpose : It is used to extracts common lines from two sorted files and there should
be the common field in both file.

Syntax : join [options] <file name1 > <file name 2>


Command : Uniq

Purpose : It compares adjacent lines in the file and displays the output by
eliminating duplicate adjacent lines in it.

Syntax : uniq [options] <file name >

Output

Command : Sort

Purpose : It sorts one or more files based on ASCII sequence and also to merge the
file.

Syntax : sort [options] <file name >

Output
Command : Nl

Purpose : It is used to add the line numbers to the file.

Syntax : nl [options] [filename]

Output

Command : Tr

Purpose : It is used to translate or delete a character or a string from the standard


input to produce the required output.

Syntax : tr [options] <string1> <string2>

Output

Command : Tee

Purpose : It is used to read the contents from standard input or from output of another
command and reproduces the output to boyh in standard output and direct into output to
one or more files.

Syntax : tee [options] <file name >

Output
Command : grep

Purpose : It is used to search the specified pattern from one or more files.

Syntax : grep [options] <pattern> <file name >

RESULT:
Thus the above unic commands are executed and the output was verified successfully.

You might also like