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.
205
questions
1
vote
1
answer
53
views
Why doesn't the given command mask other lines? [duplicate]
Command: sudo find / -name miniedit.py -print | grep -i "miniedit" | tail -1
Output:
find: ‘/proc/10031/task/10031/net’: Invalid argument
find: ‘/proc/10031/net’: Invalid argument
find: ‘/...
5
votes
1
answer
453
views
sudo with tee displays staircase
Previously I ran without sudo and used tee to display on terminal and log to file:
./my_app | tee path/to/log_file
Now I need sudo:
sudo ./my_app | tee path/to/log_file
However, because of tee when ...
0
votes
0
answers
366
views
`nc` (netcat) hangs indefinitely when reading from initially empty named pipe
I start an nc server like this:
nc -lk -p 12345 -s localhost < <named_pipe>
and an nc client with:
nc localhost 12345
When I run the command and the pipe is empty, nc hangs, which is what I ...
0
votes
0
answers
38
views
Bash colorization needs on code and its ouput lines [duplicate]
How exactly is the Bash way to fulfill/solve needs of combination of
When writing error messages as occurs in between code lines written by xtrace upon the executed script/codes, with set -x, the ...
0
votes
0
answers
232
views
How to type the pipe character | in Ubuntu 22.04.3 using a Mac?
I am trying to type the pipe character | in Ubuntu using a Macbook, but am unable to do so.
I configured the keyboard to the correct language when booting Ubuntu from the VM, but am unsure if this ...
1
vote
1
answer
452
views
Two-way pipe in bash?
I have a binary who's stdout is being redirected to the stdin of a python script, and I was wondering if there's any way to send the stdout of the python script to the stdin of the binary, to get an ...
0
votes
1
answer
87
views
Pipe to grep to directional operator (to file)
What works: any of these three:
ping 8.8.8.8 | grep 3 // this will steadily output any ping with the number 3 somewhere in the line to the terminal
ping 8.8.8.8 > fileping //this will silently add ...
1
vote
1
answer
206
views
Android Device on Linux
I have a Desktop PC running Ubuntu, I also have an Samsung galaxy Tablet.
I am looking for a solution for the following needs:
Connect tablet to PC.
Tablet opens up as an application window.
...
5
votes
3
answers
2k
views
date pipe - bug or my mistake?
I faced a strange behavior of the date command:
echo '1 JAN 2023' | LC_ALL=en_US.utf8 date -d -
This produces plainly wrong output:
Sun Jun 11 12:00:00 AM CEST 2023
But this is ok:
LC_ALL=en_US....
0
votes
1
answer
2k
views
How do I enter the pipe symbol on my keyboard
On my keyboard there is a ¦ symbol: it's shown as the third character on a key with its position being on the bottom right of the key: I've been able to type it here by copying it to the clipboard ...
7
votes
1
answer
2k
views
bash builtin "read" after a pipe "|" doesn't wait for user input
When I curl a script stored on my web server, it endlessly echos a prompt I coded in until I send ^c. All i do is a simple curl https://server/test.sh | bash. This is the code being ran through the ...
2
votes
1
answer
617
views
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 ...
2
votes
1
answer
621
views
Piping sudo <command> 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 ...
1
vote
2
answers
2k
views
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 ...
0
votes
1
answer
111
views
Error when I specify multiple options in my PHP bash script
#!/usr/bin/php -d register_argc_argv=1
...
At the top of my PHP script, I have the above and it works well. However, I need to add another -q and changed it to #!/usr/bin/php -q -d register_argc_argv=...
3
votes
3
answers
2k
views
Right After piping to "head"/"tail": "curl: (23) Failure writing output to destination"
When I curled a too long API call and wanted to show only the first 30 lines in the console with curl my_api_call|head -30, I ran into:
24 49931 24 12089 0 0 98k 0 --:--:-- --:--:-- -...
0
votes
2
answers
2k
views
How to stop the bash script when a PIPED command meets an error?
I have some pipes in my bash script, notably mysqldump | mysql
How do I get the script to stop if any of the piped processes return non-zero exit code?
In my tests, if mysqldump fails, the script ...
0
votes
0
answers
22
views
Adding total session time
I'm trying to get the total session time a user has had in a month using the command last in a script.
last user | egrep -i month | tr -s ' ' '/' | cut -f11 -d/
when adding the results I'm using ...
0
votes
0
answers
182
views
grep and pipe combination to filter standat input
Why this is working
gdbus monitor -y -d org.freedesktop.login1 | grep org
Filtering output lines containing "org"
This is working
gdbus monitor -y -d org.freedesktop.login1 | (while read ...
2
votes
0
answers
411
views
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 ...
0
votes
0
answers
25
views
Trying to figure out how to use < in a command [duplicate]
I've been learning docker which has led me to create a container with ubuntu. I am also kinda new to linux commands in general and was trying to get a better understanding of redirection.
I used > ...
0
votes
1
answer
245
views
"yes" command with finite number of "yes" answers
The yes command in linux is used to provide automatic "yes" answers to command prompts in linux:
yes | wget https://example.com
The issue is that, after execution of wget command the yes ...
0
votes
1
answer
78
views
Is pipe the same as expr pipe?
I search man expr and found expression 1 | expression 2 to reutnr expression 1 if it is neither an empty string nor zero; otherwise, returns evaluation of expression 2 if it is not an empty string.
...
0
votes
2
answers
105
views
Convert output file with the following columns to CSV removing the pipes
This is what I have in my output file:
v6_ntoa | v6_ntoa | id | client_syn_packets
---------------+--------------+-------------+--------------------
105.245.90.61 | 82.17.112.84 |...
0
votes
1
answer
533
views
Running multiple scripts with piped input/output
I wish to call multiple scripts from a single script file, with various inputs and outputs like this:
./file1.sh ip1 ip2 op1
./file2.sh op1 op2
and so on. What I mean is that the output given by ...
0
votes
1
answer
2k
views
bash pipe multiple outputs as input to other command
I am noob with shell script and I am trying to pass multiple arguments to an command.
I have a urls.txt file that looks as below
name1,http://url1
name2,http://url2
name3,http://url3
name4,http://url4
...
13
votes
2
answers
9k
views
How do I check if command failed... with a pipe?
So I have a script like this:
somecommad | grep --invert-match something
I'd like to be able to conditionally run a different command if somecommand fails. Here's what I tried:
somecommand | grep --...
1
vote
1
answer
974
views
How can I Pipe the output of FFMPEG 2 Levels of Piping in a bash script
I have been trying to pipe 2 levels deep.
I can pipe successfully:
ffmpeg | grep
ffmpeg | sed
I can not pipe
ffmpeg | grep | sed
ffmpeg | sed | grep
I don't understand, does ffmpeg limit to only ...
2
votes
1
answer
118
views
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/...
1
vote
1
answer
2k
views
Can't escape a dot using backslash, Why? [duplicate]
So, following are the commands are I ran:
$ ~/Documents: touch ball.txt bool-txt bowl.txt bull.txt
$ ~/Documents: ls . | grep b..l\.txt
ball.txt
bool-txt
bowl.txt
bull.txt
I wasn't expecting bool-txt ...
0
votes
0
answers
141
views
Zero Traffic on while running pipeline application in dpdk
I have two Virtual Machines. Both of them have their port bridged. On one VM I run Pktgen DPDK to generate traffic. On the other VM my goal is to run DPDK's pipeline application. Now When I run ...
1
vote
2
answers
189
views
Hide stdout from a command
I'm running the following command as a non privilaged user: ethtool eth0 |tail -1 | awk '{print $3}', which results this output:
Cannot get wake-on-lan settings: Operation not permitted
yes
No ...
0
votes
0
answers
40
views
Can I directly split the project archive in kdenlive?
I created a huge project in Kdenlive. Now, I wanted to archive it and then move the archive onto a Samba share with almost 50 GB free space, because I'm running low on free disk space on my main PC (9....
0
votes
0
answers
134
views
Feeding output of nvidia-smi to tail command returns error
I have a custom nvidia-smi message where some additional information (e.g., username) is also output underneath the original output of the nvidia-smi message.
I want to feed that output to a tail ...
2
votes
1
answer
1k
views
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 ...
0
votes
1
answer
100
views
does output from LHS of pipe become an arg for RHS of pipe
I'm having difficulty grasping how pipes work. Initially I thought of them as per the title but I couldn't get a simple example to work e.g.
mkdir temp
cd temp
echo "rubbish" > txtfile
...
2
votes
1
answer
2k
views
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&...
-1
votes
2
answers
86
views
Whats the difference between a pipeline operator and $()? [duplicate]
mint@mint-VirtualBox:/$ ls -l $(which cp)
-rwxr-xr-x 1 root root 153976 Sep 5 2019 /usr/bin/cp
mint@mint-VirtualBox:/$ which cp | ls -l
total 1043228
lrwxrwxrwx 1 root root 7 Jan 21 15:09 ...
1
vote
1
answer
103
views
find command is not able to find piped file
I have a file named .sock in /var/spool/ dir.
Here is the result of ls -al /var/spool/
drwxr-xr-x. 9 root root 121 Dec 16 09:55 .
drwxr-xr-x. 19 root root 267 Dec 14 10:47 ..
drwxr-xr-x. 2 ...
0
votes
1
answer
869
views
Why is piping operator used here?
Here are two commands I'm trying to understand. The first command downloads an installation script for NVM (nodejs version manager) and executes it. The second command installs nodejs using newly ...
2
votes
1
answer
208
views
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 ...
1
vote
2
answers
825
views
Shellcheck recommendation to double-quote variable does not work when piping to cut
I'm making a script to print ZFS filesystem info - currently in the testing phase, and I'm getting a strange error.
The relevant bit of my initial script is this:
zfs_human="$(zfs list | head -n ...
2
votes
2
answers
2k
views
Why Command Substitiution Works And Pipeline Not [duplicate]
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 ...
7
votes
2
answers
2k
views
Bash function to robustly pipe terminal output to vim
I often re-direct my terminal output to vim, in this fashion, which I get tired of typing all the time:
ls | vim -
I would like to define a function v to do this for me, i.e I want to be able to type:...
1
vote
1
answer
1k
views
Pipe password argument to mount shell command
Status quo
Given are following /etc/fstab mount points:
//server/app /home/user/server/app cifs noauto,user,vers=3.11 0 0
//server/code /home/user/server/code cifs noauto,user,vers=3.11 0 0
These ...
1
vote
1
answer
2k
views
How to get video audio stream using ffmpeg pipe fdkaac m4a?
I want final file as .mkv containing video stream copy and audio stream encoded by fdkaac bt unfortunately i only get audio file pls help me how to pipe video stream also here???
I tried this:
...
2
votes
0
answers
135
views
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 ...
0
votes
1
answer
277
views
use systemd-escape in an interavtive way
If we use systemd-escape SomePassword, the password will be stored in bash_history file. Is it possible to use it in an interactive way?
cat | systemd-escape fails as systemd-escape expects the ...
0
votes
1
answer
329
views
Pipe script output in terminal to filter lines
#!/bin/bash
for f in *.{jpg,png,webm,mp4}; do mv "$f" "$(sed 's/[^0-9A-Za-z_.]/_/g' <<< "$f>; done
Currently using this script to turn all of the specified files of that extension and ...
0
votes
0
answers
150
views
Xorg input device from a named pipe
I am trying to create a virtual input device that does a complex remapping of key presses of an existing keyboard. The remapped output stream is written to a named pipe which is supposed to serve as ...