Professional Documents
Culture Documents
Experiment 2
Number
Experiment To study pipe and filter commands in UNIX.
Title
Resources / Hardware: Software:
Apparatus Basic Desktop with Windows or Jslinux,
Required Linux.
Objectives
(Skill Set /
Knowledge To study pipe and filter commands in UNIX.
Tested /
Imparted)
Theory 1. pipe | command
Pipes help combine two or more commands and are used as input/output
concepts in a command. To use the command, just type commands
separated by | in the Command Prompt.
Output:
3. wc:
Stands for word count. It is used to find out number of lines, word count,
byte and characters count in the files specified in the file arguments.
Output:
4. Redirection operator
This operator basically helps in diverting inputs and outputs.
• > is the standard output operator for overwriting in linux.
• >> is the standard output operator for appending a file in linux.
Output:
5. tr
Stands for translate. The tr command in UNIX is a command line utility for
translating or deleting characters.
Output;
6. sort
This 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
Output:
7. more
more command is used to view the text files in the command prompt,
displaying one screen at a time in case the file is large.
Output:
8. less
Less command is a Linux utility that can be used to read the contents of a
text file one page(one screen) at a time. It has faster access because if file
is large it doesn’t access the complete file, but accesses it page by page.
Output:
9. head
It is the complementary of Tail command. 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.
Output;
10. tail
It is the complementary of head command.The tail command, as the name
implies, print the last N number of data of the given input. By default it
prints the last 10 lines of the specified files.
Output;
11. uniq
The uniq command in Linux is a command-line utility that reports or filters
out the repeated lines in a file.
Output;
12. cut
The cut command in UNIX is a command for cutting out the sections from
each line of files and writing the result to standard output. It can be used
to cut parts of a line by byte position, character and field
Output;