User Tools

Site Tools


opus:fall2012:escoute1:unixpart2

I/O Redirection

Definition

There is no clear definition for I/O redirection but both of these in the UNIX universe in particular are actually two components of our interface that we use at every given moment while actively using the terminal or even this browser. The Input is coming from your computer's keyboard or terminal keyboard while the Output is what you see on the monitor typically, such as in the Lab46 Terminal, the text you see is the output. In the middle of both input and output is actually where all the processing happens, this is key to the redirection as it has an effect to where the output will be directed. There are two kinds of I/O redirection, them being represented by the less than and greater than symbols ><. The less than < symbol is what does input redirection, commonly useful for when a program doesn't read files but reads from standard input, for example, you can have file1 send its contents to a mail of some sort like jackrabbit@rabies.org and the command would look something like this: mail jackrabbit@rabies.org < file1

The greater than > symbol does the “opposite” and is used in a different scenario. Say you wanted all the output you receive from issueing an ls -l command to be put into file2. Just do ls > file2 and all that output will be within the file.

Some other important concepts about I/O redirection is usage of the pipe | and the semicolon ;. The pipe and semi are used when you want to use more than one command at one time, but the difference between the two is crucial to a successful incantation. The pipe will redirect output from the initial command into the next command while the semicolon will not redirect any output into the next command, it will just perform it as if you were doing it singularly. A situation where the semicolon is crucial is if you have a cat command following your initial casting.

Now when you use the output redirect, one thing to keep in mind is that if you send another piece of output into file2 with a single >, it will overwrite the file with that new output and the old output from ls -l will no longer be there.

References

  • O'Reilly Learning The UNIX Operating System

unix Keyword 2 Phase 2

processes

Definition

Processes- programs or instances that operate concurrently with one another to produce a result.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

Demonstration

Demonstration of the indicated keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

/*
 * Sample code block
 */
#include <stdio.h>
 
int main()
{
    return(0);
}

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:

lab46:~$ cd src
lab46:~/src$ gcc -o hello hello.c
lab46:~/src$ ./hello
Hello, World!
lab46:~/src$ 
opus/fall2012/escoute1/unixpart2.txt · Last modified: 2012/10/17 13:20 by 127.0.0.1