Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [pipe]

Pipes or named pipes are a feature of the POSIX standard that allow separate processes to communicate with each other without having been designed explicitly to work together.

51 votes
8 answers
13k views

What is the general consensus on "Useless use of cat"?

When I pipe multiple unix commands such as grep, sed, tr etc. I tend to specify the input file that is being processed using cat. So something like cat file | grep ... | awk ... | sed ... . But ...
arunkumar's user avatar
  • 623
5 votes
1 answer
6k views

How/why does ssh output to tty when both stdout and stderr are redirected?

I've just noticed that ssh user@host >/tmp/out 2>/tmp/err can write something like Warning the RAS host key... ... Are you sure you want to continue connecting (yes/no)? stdout and stderr ...
spraff's user avatar
  • 2,248
130 votes
5 answers
343k views

How to pipe command output to other commands?

Example: ls | echo prints nothing ( a blank line, actually ). I'd expect it to print a list of files. ls | grep 'foo', on the other hand, works as expected ( prints files with 'foo' in their name ). ...
Mihai Rotaru's user avatar
  • 2,919
44 votes
4 answers
164k views

How can I pipe output of ffmpeg to ffplay?

How can I pipe the output of ffmpeg to ffplay? At the moment I use a workaround in bash : mkfifo spam (ffplay spam 2> /dev/null &) ; capture /dev/stdout | ffmpeg -i - spam
wim's user avatar
  • 3,207
72 votes
9 answers
122k views

Can I use pipe output as a shell script argument?

Suppose I have a bash shell script called Myscript.sh that need one argument as input. But I want the content of the text file called text.txt to be that argument. I have tried this but it does not ...
Narin's user avatar
  • 823
15 votes
1 answer
5k views

Is backwards redirection the same as a pipe?

In Linux if you type sort < txtfile is that the same thing as cat txtfile | sort
tony_sid's user avatar
  • 14.5k
295 votes
5 answers
89k views

Getting colored results when using a pipe from grep to less

I use the --colour option of grep a lot, but I often use less as well. How can I pipe grep results to less and still preserve the coloring. (Or is that possible?) grep "search-string" -R * --colour | ...
Jeremy Powell's user avatar
30 votes
3 answers
26k views

Pipe gunzip and mysql to gunzip a dump and import it

I have a .gz sql dump file (example: foo.sql.gz) that i want import in my database with the classic mysql command. gunzip -c foo.sql.gz > foo.sql mysql -uroot -ppassword foo < foo.sql foo is ...
apelliciari's user avatar
14 votes
1 answer
13k views

How to pipeline stderr in cmd.exe?

Some programs would prefer to output the help message in stderr. I want to search the help message with grep command, xx /? | grep regex? How could i do this?
Jichao's user avatar
  • 7,600
8 votes
3 answers
8k views

How can I pipe the output of *all* entered shell commands into another? (e.g. pipe everything into 'lolcat')

Good Afternoon, (OS X user) I am specifically trying to pipe the output of every shell command I type into the ruby gem 'lolcat' (which makes the output to the terminal rainbow colored). Is there a ...
user1442303's user avatar
8 votes
5 answers
7k views

How can I grep in source files for some text?

At the moment I'm using two commands, I'm sure there must be a better way... wim@wim-acer:~/ffmpeg$ find . -name "*.h" -print0 | xargs -0 grep -i invalid\ preset wim@wim-acer:~/ffmpeg$ find . -name "*...
wim's user avatar
  • 3,207
4 votes
6 answers
12k views

How can I both pipe and display output in Windows' command line?

I have a process I need to run within a batch file. This process produces some output. I need to both display this output to the screen and send (pipe) it to another program. The bash method uses tee:...
Bob's user avatar
  • 62k
2 votes
1 answer
840 views

Piping with Process substitution and joining output again

I'm trying to make use of a powerful remote server in terms of video encoding. I have a local DVD drive for ripping DVD to memory, finally residing in an mbuffer. From there, I would like to split ...
user415275's user avatar
137 votes
6 answers
64k views

Preserve colors while piping to tee

ls -l --color=auto | tee output.log Without pipe/tee it's colored. How can I make it so that it stays colored while using tee (can be colored only on the screen, I don't care about colors in logs).
Paweł Gościcki's user avatar
130 votes
7 answers
38k views

How can I save the current contents of less to a file?

If I've piped the results of a command to less and then decided that I want to save the contents to a file, is this possible? I've tried setting a mark a at the end of the buffer, and then returning ...
Jonathan Day's user avatar
  • 1,611

15 30 50 per page