Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unix Operating System (Week Two)

Similar presentations


Presentation on theme: "Unix Operating System (Week Two)"— Presentation transcript:

1 Unix Operating System (Week Two)
The following slides did not display using Adobe Connect week two.

2 Unix Operating System (Week Two)
Pipe Command Users can connect the standard output of one command into the standard input of another command by using the pipeline operator (|). Demonstrate command usage: ps -ef ps –ef | wc –l ps –ef | awk ‘{print $2}’ ps –ef | grep dandrear ls –l | cut –c1-3 who –b (Time of last system boot) who –r (Print current run level) who –s (Print short version of user on system)

3 Unix Operating System (Week Two)
File Descriptor A process associates a number with each file it has open. This number is called a file descriptor. When you log in, your first process has the following three open files connected to your terminal. Standard input: File descriptor 0 is open for reading. Standard output: File descriptor 1 is open for writing. Standard error: File descriptor 2 is open reading.

4 Unix Operating System (Week Two)
Manual (man) Command UNIX-like command documentation is known as “man”. Each page is a self-contained document. The Manual sections are split into eight numbered sections: 1 General commands. 2 System calls 3 C library functions 4 Special files (usually devices, those found in /dev) and drivers. 5 File formats and conventions 6 Games and screensavers 7 Miscellaneous 8 System administration commands and daemons

5 Unix Operating System (Week Two)
grep Command The “grep” command searches the named input file(s) for lines in a file containing a given pattern. When a pattern is found, each line is reported to standard output. Demonstrate: grep [options] pattern file(s) grep inc_A ~dandrear/xyz grep inc_A prog1 prog2 grep inc_A *

6 Unix Operating System (Week Two)
find Command The “find” command lists all pathnames that are in each of the given directories. Demonstrate: find ~dandrear –type d –print find ~dandrear –type f -print find . –print find / -type f –print

7 Unix Operating System (Week Two)
Redirections Many UNIX commands take text-like input and produce text-like output. It's sometimes useful to be able to control where the input comes from and output goes (via redirection), or even pass the output from one command to another's input (via pipes).

8 Unix Operating System (Week Two)
Redirection (cont’d) Redirect the standard output of a command to a file. date > /tmp/date_saved Redirect the standard input of a command so that it reads from a file instead of from your terminal. cat < ~dandrear/Fall_2016_Solutions/foobar Append the standard output of a command to a file. cat foobar_2 >> foobar_1


Download ppt "Unix Operating System (Week Two)"

Similar presentations


Ads by Google