Intermediate Level
Recap Day 1
Introduction to Unix Unix System Architecture Basic Unix Commands File and directory related commands Shell meta characters Standard files Redirection and Pipe
head
tail wc
Displays total no of lines, words and $ wc [lwc] file_name characters in any data
Variations
Squeeze the character Squeeze and translate the characters Translate the characters
Syntax $ cmd_output | cut [option] $ cut [option] file Syntax/Sample Example $ cat file1 | cut c5 $ cat file1 | cut c5-10 $ date | cut d f3 $ date | cut d f3,5 -d: for delimiter -f: for field number
Variations
Retrieve specific character set
Syntax
sort
Variations
To sort in reverse order To remove duplicate data To apply numerical sort To merge the content of two or more files
$ sort n file1
$ sort m file1 file2
Pattern search in the given data $ grep [option] pattern data Global Regular Expression Parser
Variations
Ignores case while searching Prints only the count of the number of lines, having given pattern Prints the lines which are not containing given pattern
Syntax $ grep i pattern file_name $ grep c pattern file_name $ grep v pattern file_name
Syntax
Syntax
Defining the boundary of the words This will match only alphabetic and numeric characters Prints the lines which are containing word starting with any pattern Prints the lines which are containing word ending with any pattern Prints the lines which are containing given pattern as whole word
10
Removes adjacent repeated lines in $ uniq [option] data the given data
Variations
Syntax
Removes adjacent repeated lines and prints $ uniq file_name the output
Prints only uniq lines Prints only duplicate lines
11
comm
12
13
Differentiate between
cat file1 file2 file3 & paste file1 file2 file3
14
ps
bg fg
17
kill
18
df command
It will display the information about the blocks of different file systems installed on our system. OR It will give the information about in which particular file system the specified file or directory is available.
19
du command
It will display the block used by all the directories and sub-directories available under the present working directory. OR It will display the block used by the specified file or directory.
Compression Utilities
Compression Utilities
Command Description Utility for compression and gzip
decompression of files Compressed files have .gz extension Used to view the content of compressed file Used to view the content of compressed file pagewise Utility for decompression of files having extension .gz Same as gzip d Creates a tape archive file Extracts from archive file
zcat
zmore
gunzip tar
$ zmore file1.gz
$ gunzip file1.gz $ tar -cvf file1.tar file1 $ tar -xvf file1.tar
21
22
23
Summary
Text Processing Commands. Process related Commands Memory related Commands Compression Commands
24
Thank You
25