Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [pipe]

A pipe connects the output of one program to the input of another program. This is especially used to implement the shell | operator.

5
votes
2answers
340 views

Piping the output of comand columns

I am using lolcat to get the output of ls in color. To do this i have copied /usr/bin/ls to /usr/bin/lsslss (to avoid an endless loop since alias cannot acccept $* or $@) and I have added the function:...
0
votes
0answers
45 views

What does this command mean?

While searching installation of lxqt I found apt install command for lxqt-sudo | gksu, xfwm4 | x-window-manager, firefox | www-browser. What does this commands mean? What is the difference with ...
0
votes
1answer
35 views

Why doesn't this work: ~$ echo “trythis” | sh ./script.sh

I'm trying to feed the string trythis into the script I made that creates a directory using what is written after it. For example this works: ~$ sh ./script trythis But using the pipe does not. I ...
2
votes
2answers
72 views

PDF a set of Office Libre files from the command line

Assume a set of .docx files are in a directory to be converted to .pdf format. Is there a clever way to list the files and pipe it into a command that would 'print' the pdf files to a target ...
2
votes
1answer
84 views

How to pipe to grep play (sox) output?

It seems a silly situation: I have this command (for pomodoros): play -n synth 25:00 pinknoise I don't want to silent completely the output (-q option), just one part (the header). grep won't work. ...
-1
votes
1answer
118 views

Concatenation of two cURL commands fails, but the commands work separately

I am trying to concatenate two curl commands using a pipe. First there is a simple authentication that works using curl https://myserver --user username:password Second I need to use GLPI API for ...
0
votes
1answer
29 views

getting the uniqueness from extracted grep results BUT with stream as an input

On finished input (like a file) we can do that: cat file | grep -o memory=[3-9] | sort -u But sort won't work with a stream: tail -f server.log | grep -o memory=[3-9] | sort -u server.log can be ...
0
votes
0answers
20 views

Why do I get different output from the same commands? (redirect and piping) [duplicate]

So I'm learning to use the CLI and I'm playing around with redirecting and piping and then I get different output from executing the same commands. Basically I'm listing all executables from /bin/ ...
0
votes
1answer
65 views

What is the difference between command grouping and pipelining?

I couldn't understand the difference between command grouping and pipelining
3
votes
1answer
91 views

How to close a named pipe (thereby enabling it for cat)?

I need help closing a named pipe. I created a named fifo via mkfifo myfifo, then some C++ executable files wrote/read from myfifo, and now I wish to close it (so I can cat its contents to read them). ...
2
votes
2answers
353 views

how to split input to two pipes

I would like to do something equivalent to this some-expensive-command > /tmp/mytempfile grep -v "pattern" /tmp/mytempfile >> output.txt grep "pattern" /tmp/mytempfile | yet-another-command ...
2
votes
1answer
302 views

How to split awk output to multiple lines for piping

I'm currently putting together a quick script that deploys multiple vagrant machines locally for dev purposes. Par of the procedure consists of adding the ssh key to the vagrant boxes. So far, ...
0
votes
2answers
570 views

Is `/dev/shm` universal in Linux and Ubuntu?

For FIFO pipe speed I'm considering placing it inside the RAM disk called /dev/shm. I see there are some files there already: $ ll /dev/shm total 1536 drwxrwxrwt 2 root root 280 Oct 2 17:...
0
votes
1answer
22 views

Find latest modified *.c file and compile it within terminal with pipelining?

Lately I have coded a little bit more with the terminal in Linux to get a deeper understanding of programming. Right now I am trying to automatize the compiling process with the following command: ...
0
votes
2answers
60 views

Pipe decrypted password to command

I would like to modify this so, my password is never visible. The method would need to work standalone and in scripts. echo fake | sudo -S thunar
0
votes
0answers
61 views

How to pipe command output to a different command depending on exit status

I'm writing a set of Bash scripts to add ANSI color codes to a file using remark, and view the results in less. Script ccat performs the markup, and cless calls ccat | less -R (the -R option makes ...
5
votes
1answer
590 views

How to pipe all bash terminal output through command [duplicate]

I would like to be able to pipe all bash terminal commands through a certain command (for no good reason other than to play a prank on someone). I just want to pipe the stdout of any executed command ...
2
votes
1answer
75 views

How to pipe installed packages to apt-cache?

I'm trying to get package description of my installed packages. It would look like this: sudo apt list --installed | sed 's/\/.*//' | apt-cache search {} \; The problem is to send each line from ...
-1
votes
1answer
44 views

how to find & delete folder with a certain with find

I have a drive with daily backups (twice a day) and need to delete a folder in each backup which is pretty deep into a folder structure. /mnt/backup/backup/[yymmdd_hhmm/backup-clients/[username]/ ...
0
votes
3answers
91 views

Pipe for three commands [duplicate]

In the manual of sudo I need to search for -k so I tried this: man sudo | grep '\-k' But it would result a paragraph be half-written on the output: sudo -h | -K | -k | -V Similar to ...
2
votes
1answer
370 views

Play mp4 video file, by piping avconv to avplay on Ubuntu 14?

On Ubuntu 14.04, there is avconv/avplay instead of ffmpeg/ffplay; version is: $ avconv -version avconv version 11.3-6:11.3-1~trusty, Copyright (c) 2000-2014 the Libav developers built on Apr 13 ...
-6
votes
2answers
448 views

echo -e: A white space is added before the second sentence in <first sentence> \n <second sentence>

In Bash, I'm having a small trouble with the echo command and one of its -e sequences: A white space is added before the second sentence in <first sentence> \n <second sentence>. This is ...
6
votes
2answers
3k views

How do I pipe a newline separated list as arguments to another command?

So I have a list of usernames such as: user1 user2 user3 I want to apply id on each of them and get something like: uid=100(user1) gid=5(g1) groups=5(g1),6(g6),7(g10) . . How can I achieve this? ...
1
vote
2answers
1k views

download and pipe sql to psql

How can I do this in one step? Download backup command: curl http://s3.aws.com/backup.sql Restore backup command: sudo -u postgres psql <PIPE-THE-OUTPUT-OF-PREVIOUS-COMMAND>
10
votes
4answers
11k views

Appending a line to a file in the cat command?

I can do cat file.txt to get the contents of a file but I also want to tack on a final line of my own choosing. I tried piping (cat file.txt ; echo "My final line") | but only the final line is ...
0
votes
0answers
76 views

Understanding pipe (for large files)

My understanding of pipe is, all piped commands are invoked in parallel and stdout of each command is fed to next command as stdin. When processing large files, initial parts of data may be done with ...
1
vote
1answer
703 views

Ubuntu thinks I'm out of space! [duplicate]

I've got two Ubuntu boxes running who have both developed the same problem. They keep throwing up error messages about how I'm out of space. Error: BrokenCount > 0 Tried to run sudo apt-get -f ...
0
votes
0answers
609 views

Warning messages after closing Firefox in firejail sandbox mode

I generally use Firefox in sandbox mode using Firejail. Sometimes, I get warning messages when I close the browser, like the following messages... firejail firefox Reading profile /etc/firejail/...
0
votes
0answers
80 views

Pipe stdout through sed or awk command BEFORE redirecting to file? [duplicate]

I am still kind of new to programming, but willing to learn: I am struggling with a problem in following project: I am logging analog read-outs of an Arduino board. The Arduino board sends tab-...
3
votes
1answer
574 views

“read” command waiting for additional newline if input comes through pipe

If I simply run read it reads one line and immediately exits when the Enter is pressed. $ read typing something here $ However, when I pass the input through a pipe, e.g. from cat, read behaves ...
2
votes
1answer
118 views

How to feed standard input and dump into file at the same time?

I would like to feed a command with standard input and dump that standard input into the file at the same time. This is just failed attempt: read | tee dump.txt this command is waiting for standard ...
0
votes
1answer
87 views

Getting a tidy print from top

PID %CPU %MEM COMMAND 719011 ---- -- 0 ---- --- ---- - 0.7 1.3 606:58.25 ...
1
vote
1answer
1k views

What does “broken pipe” mean?

I was trying to upgrade from 14.04 to 16.04 and got a funny message. I am currently stuck between versions, can't go forward or back. All I have are terminal command functions, no GUI. These are my ...
9
votes
3answers
3k views

How can I stop following output in less, without affecting the command generating the output?

I am running a server and the log of this server gets logged in terminal, not in any file. I would like to use less to view this log. node server.js | less When I just want to see the log, I use ...
2
votes
1answer
192 views

How to send a byte as mutiple input to a file in Ubuntu [closed]

I have a file.c: #include <stdio.h> void main(){ char a,b; printf("Input your character: \n"); scanf("%c",&a); printf("Input your second character: \n"); ...
0
votes
0answers
24 views

pipe to file command [duplicate]

I wanted to know the bitness of a certain software (omc), so I ran first which omc file /usr/bin/omc and that gave me all information I needed. Before telling my colleagues, I wanted to shorten it ...
2
votes
1answer
702 views

Unzip with the Pipe Viewer

I'm trying to use Pipe Viewer (pv) while extracting files from zip archive. Now I'm using unzip -o -q myfile.zip -d test So I tried something like (solution seen for tar) pv myfile.zip | unzip -o -...
0
votes
0answers
65 views

Use pipes in the terminal [duplicate]

I have a user defined latex .sty file called mathpkgs.sty located in ~/texmf/tex/latex/local/. When I am typing up some articles in a diffferent directory, occasionally I need to view the content of ...
0
votes
2answers
1k views

How to pipe a text file containing mongod arguments to mongod command

So usually I start a mongod process with 2 arguments like this ~$ mongod --dbpath /media/nhuyvan1106/0CB6-189A/linux/mongodb/data --logpath /media/nhuyvan1106/0CB6-189A/linux/mongodb. But I don't ...
1
vote
1answer
414 views

How do I save terminal output to a external file on another computer?

I'm trying to append the output of wifi signal strength and other values in the command watch -n 1 cat /proc/net/wireless to an external file in another computer.
0
votes
1answer
2k views

How do I save a shell's stderr and stdout to a file while still having it output to the terminal window? [duplicate]

I need stdout and stderr to a file, and my shell simultaneously. command > file.txt, the usual goto, will not output stderr to the file, nor output stdout to the terminal. command > file.txt &...
13
votes
3answers
2k views

Why the pipe command “l | grep ”1“ ” get the wrong result?

As the picture illustrates, I use l to get the file in the current folder. And then I want to get the file with number 1, so I use the pipe and the grep. But why the 2 and 22 file show out? And what ...
0
votes
1answer
105 views

how to use top and free to see what is bogging down the system?

I wasn't able to grab the output from top, but I had many, many leafnode instances listed. They weren't using, individually, many resources. Perhaps in aggregate they were bogging down the system. ...
1
vote
3answers
175 views

How to replace an output filename by a custom command that use output?

Say I have a command cmd that is creating a new filename given as argument: For instance, cmd -w /root/myfile How to change this expression in order to use a custom command that use the file ...
0
votes
1answer
215 views

How to use the output of ettercap

To encrypt tshark output, I use tshark -w - | gpg -e > capture.pcap.gpg How do I do the same for ettercap? This command does not work ettercap -M arp -w - -T //// | gpg -e > capture.pcap....
1
vote
1answer
338 views

strange results with grep regular expression when used with pipe

I have 3 files: test1,test2,test3.sh. File test3.sh has names of files test1 and test2 as its contents. I am unable to understand the result the output of the below command: sh-4.3$ touch test1 test2 ...
4
votes
6answers
311 views

Redirect filtered output to file

I redirect my output into a file and I get something like this: | id | code | color_code | -------+------+------------+ |11A00B| 15 | 9129102 | |11A00C| 16 | 9129103 | (2 rows) | id | ...
6
votes
1answer
2k views

How can I gather the output of a while loop in a single pipe?

I have a script composed of a while loop with an echo in it: while my_condition do echo [my_output] done How can I gather the output in a single pipe? I would need to use column after the output ...
1
vote
1answer
37 views

How can I find newly found line in a continuous pipe?

Suppose you have a command mycmd that send a continous flow in a pipe. You want to print only each newly occurences. How would you do it? The command mycmd | sort -u is not valid since I have to ...
4
votes
2answers
3k views

How can I use a pipe in a while condition?

I want to loop while grep does or does not find something I can write: while grep 'matches' inLogFile.txt do echo good. sleep 10 done Or while grep -v 'notHereYet' inLogFile.txt do sleep 2 ...