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.

A pipe connects the output of one program to the input of another program. It is one of the fundamental interprocess communication mechanisms on Linux.

In the , the | operator creates a pipe connecting the process on the left to the process on the right. For example

mycommand | less

sends the output of mycommand to the command less, which displays its input (i.e. the output of mycommand) in an interface allowing navigation and searching.

205 questions
2
votes
1 answer

Pipe an infinite stream to internal loop?

I've seen a lot of things about redirecting stdout to a TCP socket, but no real example of how to do it in practice, specifically when the output stream generated by the first "command" never ends. To talk about something concrete, let's take…
2
votes
2 answers

use output from alias command as filename to open in vi

I set up an alias this morning to help finding the latest log file in a directory. My alias looks like alias latest="ls -lat | grep ^- | awk '{print \$8}' | head -1" In my research so far this morning I've read a blog - ParsingLS which tells me this…
2
votes
2 answers

Write bash script which takes input from pipe

I am always typing things like this: cat some_list_of_elements.txt | awk '{print "\047"$1"\047"}' | paste -d, -s It takes a list of items from a file, wraps each in quotes, and merges them together in a comma-separated list. Rather than typing out…
2
votes
1 answer

Pipe to compressed file but also print content to terminal

How do I maintain a readable output from my program while also putting that same output into a compressed file, gzip or otherwise, so I can parse it later? I run a command that generates a lot of samey lines of clear text that should be easy to…
FalcoGer
  • 935
2
votes
1 answer

Piping sudo through another command adds excess whitespace

Background I wanted to identify if <complex command pipeline> outputs any non-printable characters (it must be run with sudo), so I piped the output through od and was surprised to see each line of output from od had additional spaces. System Ubuntu…
user1676974
2
votes
2 answers

How to keep writing in a FIFO even if there's no readers

There's a service that pipes it's output to a named pipe, which I create with mkfifo name . The service pauses if there's no reader in pipe. How to make it to keep piping the data even if there's no reader? The reader(s) may (or may not) use the…
2
votes
0 answers

How can I copy from a pipe file?

I have a program that creates a FIFO (named pipe) file in /path/to/directory , then deletes it. I have somehow managed to stop it being deleted , but still I can't read/write/copy anything on it. For example; $ cp 15796 test It just keeps waiting,…
Erikli
  • 429
  • 2
  • 6
  • 11
2
votes
1 answer

Any way to pause a task and then restart within a pipe

I use a command like btrfs restore -iv /dev/sdc1 /RESTORED estimated time of running it is few days In every hour of running I see a lot of prompts like: We seem to be looping a lot on /path/to/some/file, do you want to keep going on? (y/N/a) I'd…
2
votes
1 answer

Sudo command is not asking password from stdin. And Failing

Whenever I am running any command with sudo, No password is asked from stdin. Instead, it automatically takes a password from somewhere and fails. Once All attempts are exhausted, my command is ultimately failed. I am not able to open the sudoers…
Ankush K
  • 225
2
votes
1 answer

problem install pip ubuntu 16.04

I'm doing this to install pip : apt-get install python3-pip But when I try use the command I have this error: # pip3 install --upgrade pip Traceback (most recent call last): File "/usr/bin/pip3", line 11, in <module> sys.exit(main()) File…
2
votes
1 answer

Piped commands run with sudo prefix result in indented output

I have an interesting issue on most of my servers, where commands prefixed with sudo and piped | to another program end up with indented output. Note that I'm going to use lsb_release command for the example, however this issue occurs any any…
n7s
  • 141
2
votes
2 answers

Why Command Substitiution Works And Pipeline Not

I am practing | pipeline to pass output. Firstly, I tried basename as $ basename -a $(ls test_directory/*) This line works as expected and showed only file's name without directory's. But when I try to pipe the output of ls to basename $ ls…
2
votes
0 answers

Help getting SSH server working again?

I have a ubuntu desktop on my home network that I used to be able to ssh into from several different machines, but about a week ago it stopped working. The only thing that I can think of that I changed around that time was installing nordvpn on the…
2
votes
2 answers

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 directory? For example the resulting output of ls -l…
gatorback
  • 6,543
2
votes
1 answer

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, getting the path of the ssh keys is fairly easy: vagrant…
E. Jaep
  • 133