Unix Fundamentals

Submitted by: Submitted by

Views: 10

Words: 444

Pages: 2

Category: Science and Technology

Date Submitted: 02/07/2016 12:00 PM

Report This Essay

CS126-1601A-02

Unix Fundamentals

Professor: Ralph Reilly

1/17/2016

Dustin Dennis

Filters

A program that is used to transform plain text data into something meaningful that can used to get results easily is a filter. Many filters can be used with pipes so that they can achieve specific results.

Cat is popular command to use in Unix. It is used to show the contents of files rather than transforming them. Cat will combine file1, file2, file3, file 4 and file5 and along with wc will create a pipe.

cat file1 file2 file3 file4 file5| wc

Pipes

Something used for redirection that can use the output of one program and move it to another for more processing are called Pipes. Pipes are used in operating system that are Linux and Unix based.

They are created so that they can be used as a pipeline of commands which is a temporary direct link between more than one program. These connections help performance.

The structure of pipes are unique and contains a vertical bar character. The syntax of pipes is:

command_1 | command_2 [| command_3 . . . ]

A real example of a pipe is the dmesg command is used less command. This is what it would look like:

dmesg| less

Redirection

Redirection is used to change the normal stream of data which allows it to come from another source rather than the default.

Any processes used by UNIX commands write to the normal output and the input from the normal input. There is also the standard error, which is used to display the error on screen.

2 commands

ls /etc | grep conf | grep -v "." | sort > ~/conf

The 1st command,

ls : Is used to list a files in directory 

ls /etc : used to show files in /etc

grep : tool for matching patterns 

grep conf : shows lines that match "conf" 

grep –v : same as above but –v makes it inverse

sort sorts, and then there is redirection that writes conf in your home directory.

So, the command allows it to sort, and write and find the match “conf” in line

cat /etc/passwd | awk...