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

OS Practical 2_removed

This document outlines advanced commands and filters in Linux/UNIX, including the find, uniq, tr, pipe, grep, history, sort, write, and wall commands. Each command is described with its purpose and various options for usage. The aim is to provide a practical understanding of these commands to enhance user proficiency in operating systems.

Uploaded by

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

OS Practical 2_removed

This document outlines advanced commands and filters in Linux/UNIX, including the find, uniq, tr, pipe, grep, history, sort, write, and wall commands. Each command is described with its purpose and various options for usage. The aim is to provide a practical understanding of these commands to enhance user proficiency in operating systems.

Uploaded by

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

3140702 (Operating System) 230760107011

Practical : 2

AIM : Study of Advance commands and filters of Linux/UNIX.

1 ) find Command
• find command searches for files in a directory hierarchy.

• find -name : Find files with names matching the given pattern (wildcards allowed).
• find -newer : Find files modified more recently than the specified file.
• find -empty : Find empty files or directories.
• find -size +N/-N : Find files larger than (+N) or smaller than (-N) bytes.

1
3140702 (Operating System) 230760107011

2 ) uniq Command
• uniq reports or filters out repeated lines in a file.
• It can remove duplicates, show a count of occurrences, show only repeated lines, ignore certain
characters and compare on specific fields.

• uniq -c : Count occurrences of lines.


• uniq -d : Display only duplicate lines.
• uniq -D : Display all lines, including duplicates.
• uniq -u : Display only unique lines.
• uniq -i : Ignore case during comparison.

2
3140702 (Operating System) 230760107011

3 ) tr Command
• The tr command in UNIX is a command line utility for translating or deleting characters.
• It supports a range of transformations including uppercase to lowercase, squeezing repeating
characters, deleting specific characters and basic find and replace.
• It can be used with UNIX pipes to support more complex translation.

• tr -s : Squeeze repeated characters.


• tr -d : Delete specified characters.
• tr -cd : Delete all characters except those specified.

4 ) pipe Command
• It redirects the command STDOUT or standard output into the given next command STDIN or
standard input.
• In short, the output of each process directly as input to the next one like a pipeline.
• The symbol “|” denotes a pipe.

• Pipe | : Connects the output of one command to the input of another.

3
3140702 (Operating System) 230760107011

5 ) grep Command
• The grep filter searches a file for a particular pattern of characters, and displays all lines that
contain that pattern.
• The pattern that is searched in the file is referred to as the regular expression.
• grep stands for globally search for regular expression and print out.

• grep -i: Case-insensitive search.


• grep -c: Count matching lines.
• grep -w: Match whole words.
• grep -n: Display line numbers.

6) History Command
The history command is a valuable utility that allows users to view and search through their command
history. In this comprehensive guide, enabling users to streamline their workflow and save time by
efficiently accessing and reusing commands.

• history n : This will show the last 5 commands executed in the terminal.

4
3140702 (Operating System) 230760107011

7) Sort Command
The sort command in Linux is used to arrange the lines in a file in a specific order, either alphabetically,
numerically, or based on other criteria.

• sort: Sorts in ascending order by default.


• sort -r: Reverses the sort order.
• sort -c: Checks if the file is sorted and reports the first disorder.
• sort -n: Sorts numerically.
• sort -nr: Sorts numerically in reverse.

8 ) write Command

It is used to send a message to another user.

The write utility allows a user to communicate with other users, by copying lines from one user’s terminal
to others. When you run the write command, the user you are writing to gets a message

Syntax : write user [tty]

9 ) wall Command

wall command in Linux system is used to write a message to all users.

Syntax : wall [-n] [-t timeout] [message | file]

You might also like