Pipe works as a temporary storage place which takes output of one command and then pass this output to another command as input.
The syntax is using pipe is,
command1 | command2
The output of command1 is passed to command2 as input.
Some examples of pipe are shown below:
We know with who command on linux we can see the user who is logged on. And with wc command we can print the number of newlines.
A sample who command output is,
# who
root pts/0 2009-04-12 00:22 (114.31.1.71)
root pts/1 2009-04-12 04:03 (114.31.1.71)
root pts/2 2009-04-12 04:07 (114.31.1.71)
Now if we want to know the number of users who is logged on to the system then we can use pipe and then wc -l as below.
# who |wc -l
3
The output of who command is passed to wc -l command as input and return the number of lines which in turn returns the number of users.
With ps -ef we can see all processes on the system. If you want to know find the number from all processes where arju name in involved then we can use,
# ps -ef |grep arju |wc -l
9
Output of "ps -ef" is passed to "grep arju" command. "grep arju" command is used to filter output by searching arju text and output of this finally passed input of "wc -l" which prints number 9.
Related Documents
http://arjudba.blogspot.com/2009/04/input-output-rediection-on-linux.html
Sunday, April 12, 2009
Subscribe to:
Post Comments (Atom)
Tag Cloud
10.2g
11g
About Oracle
Administration
Alerts
Archival
ASM
Audit
Backup
Bangladesh
Block Corruption
Blogger
Browser
Bug
Business
Clone
Clusterware
Comments
Concepts
Connection
Controlfiles
Crime
CSS
Data Block
Data Dictionary
Data Guard
Data Pump
Data Type
Database Administration
DBConsole
Economics
EM
Excel
Exercise
Explain plan
Export
External Table
Firefox
Firmware
Flashback
Forum
Functions
Globalization Support
History
HTML
IE
Import
Indexes
initializaion parameter
Installation
Internals
Internet
isql*plus
Java
JavaScript
Job
Joins
Joke
Limitation
Linux
Listener
Logminer
Magento
Mail
Materialized View
Medical
Memory
Money
Multimedia
MySQL
Net Services
Network
Operators
Oracle
Oracle Concepts
Oracle Recovery
OS
Others
OUI
Package
Packages
Parameters
Partitioning
Patchset
Performance
Perl
Pfile
PHP
PL/SQL
Profile
Pseudocolumns
Puzzle
Quota
RAC
RAC Installation
Recovery
Recovery Problems
Redo Log
Reports
RMAN
Scripts
Security
SEO
Server Administration
SGA
Shell Script
Smarty
Solaris
Spfile
SQL
SQL Tuning
SQL*Loader
Sql*Plus
Startup Problem
Streams
SwingBench
Tablespaces
Technology
Temp
TNS Error
Tools
Troubleshooting
Tuning
Undo
UNIX
Utilities
Version
Views
Vmware
Windows
Wordpress

0 comments:
Post a Comment