vb.net barcode component Figure 17-2. BASH history completion is very useful but can also be confusing. in Java

Generator Code39 in Java Figure 17-2. BASH history completion is very useful but can also be confusing.

Figure 17-2. BASH history completion is very useful but can also be confusing.
USS Code 39 Encoder In Java
Using Barcode maker for Java Control to generate, create Code39 image in Java applications.
www.OnBarcode.com
ANSI/AIM Code 39 Scanner In Java
Using Barcode scanner for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
C HA PTE R 17 COOL SHELL TRIC KS
QR Code 2d Barcode Maker In Java
Using Barcode creation for Java Control to generate, create QR Code JIS X 0510 image in Java applications.
www.OnBarcode.com
Painting Linear 1D Barcode In Java
Using Barcode maker for Java Control to generate, create Linear Barcode image in Java applications.
www.OnBarcode.com
Piping and Directing Output
UPC-A Supplement 5 Drawer In Java
Using Barcode printer for Java Control to generate, create GS1 - 12 image in Java applications.
www.OnBarcode.com
QR Code 2d Barcode Generator In Java
Using Barcode drawer for Java Control to generate, create QR Code image in Java applications.
www.OnBarcode.com
It s not uncommon for a directory listing or output from another command to scroll off the screen. When using a GUI program like GNOME Terminal, you can use the scroll bars to view the output, but what if you are working at the bare command-line prompt By pressing Shift+Page Up and Shift+Page Down, you can scroll the window up to take a look at some of the old output, but very little is cached in this way, and you won t see more than a few screens. A far better solution is to pipe the output of the directory listing into a text viewer. Another useful technique is to redirect output to a file.
EAN / UCC - 14 Generator In Java
Using Barcode generation for Java Control to generate, create GTIN - 128 image in Java applications.
www.OnBarcode.com
ISSN - 10 Generator In Java
Using Barcode creation for Java Control to generate, create ISSN - 10 image in Java applications.
www.OnBarcode.com
Piping the Output of Commands
ANSI/AIM Code 39 Scanner In Java
Using Barcode reader for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
Generate Code 39 Full ASCII In Objective-C
Using Barcode maker for iPad Control to generate, create Code39 image in iPad applications.
www.OnBarcode.com
Piping was one of the original innovations provided by Unix. It simply means that you can pass the output of one command to another, which is to say the output of one command can be used as input for another. This is possible because shell commands work like machines. They usually take input from the keyboard (referred to technically as standard input) and, when they ve done their job, usually show their output on the screen (known as standard output). The commands don t need to take input from the keyboard, and they don t need to output to the screen. Piping is the process of diverting the output before it reaches the screen and passing it to another command for further processing. Let s assume that you have a directory that is packed full of files. You want to do a long directory listing (ls l) to see what permissions various files have. But doing this produces reams of output that fly off the screen. Typing something like the following provides a solution:
Reading Barcode In Java
Using Barcode reader for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
USS-128 Drawer In None
Using Barcode printer for Software Control to generate, create GS1 128 image in Software applications.
www.OnBarcode.com
ls l | less
Printing Barcode In Objective-C
Using Barcode creator for iPhone Control to generate, create Barcode image in iPhone applications.
www.OnBarcode.com
Printing QR Code JIS X 0510 In Java
Using Barcode maker for BIRT reports Control to generate, create Quick Response Code image in BIRT reports applications.
www.OnBarcode.com
The | symbol between the two commands is the pipe. It can be found on most US keyboards next to the square bracket keys (near the Enter key; you ll need to hold down the Shift key to get it). What happens in the example is that ls l is run by the shell, but rather than sending the output to the screen, the pipe symbol (|) tells BASH to send it to the command that follows to less. In other words, the listing is displayed within less, where you can read it at your leisure. You can use Page Up and Page Down or the arrow keys to scroll through it. Once you quit less, the listing evaporates into thin air; the piped output is never actually stored as a file. In the previous section, you saw how you can use the history command to view the command history. At around 1000 entries, its output scrolls off the screen in seconds. However, you can pipe it to less, like so:
Quick Response Code Creator In None
Using Barcode creation for Software Control to generate, create QR Code ISO/IEC18004 image in Software applications.
www.OnBarcode.com
EAN / UCC - 13 Scanner In Java
Using Barcode scanner for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
history | less
Recognizing EAN 13 In C#.NET
Using Barcode reader for .NET framework Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
Reading PDF 417 In Java
Using Barcode reader for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
CHAPTER 17 C OOL S HELL TRICK S
ECC200 Drawer In None
Using Barcode creator for Online Control to generate, create Data Matrix image in Online applications.
www.OnBarcode.com
Barcode Generator In None
Using Barcode generator for Word Control to generate, create Barcode image in Office Word applications.
www.OnBarcode.com
Figure 17-3 shows the result on my test PC.
Figure 17-3. Piping the output of the history command into the less command lets you read the output fully.
You can pipe the output of any command. One of the most common uses is when searching for a particular string in the output of a command. For example, let s say you know that, within a crowded directory, there s a file with a picture of some flowers. You know that the word flower is in the filename, but can t recall any other details. One solution is to perform a directory listing, and then pipe the results to grep, which is able to search through text for a user-defined string (see 15):
ls l | grep i 'flower'
In this example, the shell runs the ls l command, and then passes the output to grep. The grep command then searches the output for the word flower (the i option tells it to ignore uppercase and lowercase). If grep finds any results, it will show them on your screen. The key point to remember is that grep is used here as it normally is at the command prompt. The only difference is that it s being passed input from a previous command, rather than being used on its own.
Copyright © OnBarcode.com . All rights reserved.