Skip to main content

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.

294 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
133 votes
6 answers
63k 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
129 votes
5 answers
341k 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,909
90 votes
8 answers
118k views

How to suppress cUrl's progress meter when redirecting the output?

I'm trying to print just the verbose sections of a cURL request (which are sent to stderr) from the bash shell. But when I redirect stdout like this: curl -v http://somehost/somepage > /dev/null ...
Ian Mackinnon's user avatar
88 votes
4 answers
76k views

Why is piping 'dd' through gzip so much faster than a direct copy?

I wanted to backup a path from a computer in my network to another computer in the same network over a 100 Mbit/s line. For this I did dd if=/local/path of=/remote/path/in/local/network/backup....
Foo Bar's user avatar
  • 1,500
80 votes
5 answers
31k views

How to rate-limit a pipe under linux?

Is there a filter which I could use to rate-limit a pipe on linux? If this exists, let call it rate-limit, I want to be able to type in a terminal something like cat /dev/urandom | rate-limit 3 -k | ...
Frédéric Grosshans's user avatar
72 votes
9 answers
121k 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
59 votes
6 answers
40k views

Why does Powershell silently convert a string array with one item to a string

Consider the following Powershell script, which searches for folders in C:\ with a 'og' in their name: PS C:\> (ls | %{$_.Name} | ?{$_.Contains("og")}) PerfLogs Program Files setup.log Now I narrow ...
Jonas Sourlier's user avatar
55 votes
9 answers
34k views

Bash: create anonymous fifo

We all know mkfifo and pipelines. The first one creates a named pipe, thus one has to select a name, most likely with mktemp and later remember to unlink. The other creates an anonymous pipe, no ...
Adrian Panasiuk's user avatar
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
50 votes
4 answers
18k views

Is there any way to keep text passed to head, tail, less, etc. to be colored?

Is there any way to keep colorization of text passed through pipe | to head, tail, less, etc.?
Timofey Gorshkov's user avatar
48 votes
3 answers
15k views

Pipe to less but keep the highlighting

Is it possible to pipe output (e.g. dmesg) to a command like less (or equivalent) and keep the text highlighting used by the original command? example: on the left dmesg | less on the right dmesg
apoc's user avatar
  • 693
47 votes
3 answers
25k views

Find what process is on the other end of a pipe

I'm trying to trace some odd behavior of a few processes and ran into a point I'm not sure how to trace past. The hung process, which I attached to using strace -p showed this: Process 7926 attached ...
FatalError's user avatar
  • 2,173
46 votes
3 answers
30k views

Comments in a multi-line bash command

This single-command BASH script file is difficult to understand, so I want to write a comment for each of the actions: echo 'foo' \ | sed 's/d/a/' \ | sed 's/e/b/' \ | sed 's/f/c/' \ > myfile ...
Nicolas Raoul's user avatar

15 30 50 per page
1
2 3 4 5
28