Tagged Questions
1
vote
1answer
51 views
Flushing a named pipe
I am using the following to redirect output from my script to both terminal and log file while appending date to every line that goes to the log file:
NPIPE=/tmp/$$_$RANDOM.tmp
mknod $NPIPE p
tee ...
3
votes
3answers
82 views
How to pipe data over tcp from the command line?
I would like to pipe data from one machine in the command line to another machine over tcp. I guess I could write a socket server but this must already be implemented. For example I could use it to xz ...
1
vote
1answer
70 views
grep with colored output returns several empty lines
I have strange issue with grep (2.12-2, debian testing).
In some situations when I do something like this:
grep -rni '."spacer">.' . grep return me several empty lines:
If I add --color=none ...
4
votes
3answers
76 views
Transparent usage of temporary files as means of piping
As many of us are surely aware, it's always a good idea to make your program accept stdin input. Very many programs do allow that *nix environments. This lets us do cool things like piping
echo "foo" ...
0
votes
2answers
154 views
Setting pipefail for a single piped command
I need to execute a number of piped shell commands from a non-BASH script (namely PHP script) like these:
command1 | command2 | command3
so that, if command1 fails with a non-zero exit code, each ...
3
votes
2answers
72 views
Mutual piping on linux
I would like the output of A to be input for B and at the same time the output of B to be the input for A, is that possible?
I tried the naïve thing: creating named pipes for A (pipeA) and B (pipeB) ...
0
votes
1answer
90 views
linux: access mounted volumes as normal folders/files
I have a closed source software (client) running on a linux machine (debian) to deliver files to a backup machine.
This works fine except this client software does not access the mounted volumes ...
2
votes
1answer
350 views
Unix bidirectional pipe on commandline
I've been able to use this linux command to connect Netcat to a serial port:
nc -l 80 <> /dev/ttyS0
I would like to be able to log this transaction. My backup plan is to use Wireshark to ...
0
votes
2answers
490 views
pipe: too many files open renders entire OS completely useless
I'm running Ubuntu 12.04, and I am having a major problem. Two separate times today, one of my open gnome-terminal sessions locked up and printed the error
pipe: too many open files
I realize ...
2
votes
3answers
321 views
count files in a list of directories
I have file with a list of directories that I would like to know how many files are in each directory.
.../images/idsuffix/userids/
This will give me the count of files and directories for ...
2
votes
1answer
200 views
Can I use pipe output as a shell script argument?
Suppose I have a bash shell script called Myscript.sh that need on 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 ...
5
votes
1answer
237 views
Locked out of host after reaching some ulimit
So, I have a sudoer account in a remote host, in which I create a process with thousands of threads and sockets. The thing is, if I create too many threads/sockets (not sure which one, it might even ...
2
votes
1answer
133 views
Do people use dbus, pipes or ports usually for interprocess communication? [closed]
It's hard to find dbus libraries for the programming languages I've been using though the idea looks neat. Sockets are the most supported way but it also eats one of my computers ports and then I also ...
1
vote
2answers
158 views
Bash: Concatenating TAR balls
Is it valid to do this:
{
tar -c dir1
tar -c dir2
} | cat > file.tar
Is the resulting file.tar a valid tar ball?
If not, how can I concatenate tar balls on the fly?
1
vote
2answers
414 views
How can I clear the contents of every file in a subdirectory without changing ownership / permissions?
I can find the list of files using something like:
find /path/to/files -type f
And I can clear the contents of a single file with any of:
> filename
echo -n > filename
cat /dev/null > ...
2
votes
2answers
296 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.?
2
votes
1answer
614 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 ...
2
votes
1answer
236 views
UNIX approach to capturing video from webcam across a network
I have two Linux computers on a LAN (call them Foo and Bar), and I'd like to find a way to capture stream video from the webcam on Foo to Bar.
I'd like to avoid using a GUI client which uses a ...
0
votes
1answer
168 views
how to redirect output of command line execution to more than one file according to weight of output
Currently I'm using an awk line to filter a set of files according to certain criteria.
How can I redirect the result output to more than one file if the result, for example if the file that would ...
2
votes
1answer
128 views
how to convert a script using pipelines to named pipes
I have a bash script that is using anonymous pipes to achieve:
grabbing video from dv capture device
writing to a file (using tee)
piping it to ffmpeg2theora (converting to ogv/theora video)
writing ...
0
votes
3answers
242 views
How come piping yes to a file doesn't work?
I tried doing this:
yes > yes.txt
Afterwards, yes.txt is created but is completely empty.
1
vote
1answer
289 views
How to solve “Broken Pipe” error when using awk with head
I'm getting broken pipe errors from a command that does something like:
ls -tr1 /a/path | awk -F '\n' -vpath=/prepend/path/ '{print path$1}' | head -n 50
Essentially I want to list (with absolute ...
5
votes
3answers
696 views
How can I specify command line arguments using pipes in Linux?
I'm a newbie to shell programming and have no idea how to solve this problem.
I just downloaded a file from the Internet to the default directory ~/Downloads. I want to move that file to another ...
1
vote
1answer
681 views
How long do FIFOs (named pipes) stay “open” for?
For example, I have a script that writes the time to a pipe in /etc/pipe. It writes continuously in a while true loop. How long will the data in the pipe be available for reading? If I only decide to ...
4
votes
1answer
465 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
2
votes
3answers
633 views
Linux: Limiting data throughput (pipe) in bytes per second?
I was wandering if there is a Linux program that can limit data throughput of a pipe - in actual bytes per second?.
From what I gather, applicable for the purposes would be
bfr, however, it has ...
6
votes
2answers
1k views
How do you determine the actual command that is piping into you?
Let's say I have a bash script called log.sh. In this script, I want to read in input from a pipe, but I also want to know the command used to pipe input into me. Example:
tail -f ...
2
votes
4answers
940 views
How to redirect the output of a program to the linux diff command
I have a program that writes to stdout. Is there a way that I can redirect the output to the linux diff command or do I have to write the output to a file and then compare that. For example I have a ...
4
votes
2answers
1k views
monitor interprocess pipe traffic
I have two Linux processes communicating via a nameless pipe. How can monitor the traffic in the pipe? How can I inject data into the pipe? I have root access and know the pipe inode.
7
votes
7answers
2k views
Advantages of cat'ing file and piping to grep
Are there any additional advantages of cat'ing a file and piping it to grep, besides convenience? The convenience being that, when I retrieve commands such as those below from my history, the cursor ...
1
vote
4answers
2k views
Rsync to stdout?
I have access to backup server via rsync protocol (only rsync, nothing else). Now, I want to fetch file from there (which is .tar.gz) and pass it directly to tar command, without saving the archive in ...
1
vote
3answers
516 views
Double pipes in Linux
Is it possible to do a command in Linux with "double pipes", like this?
blah | blah | blah
19
votes
2answers
2k 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 | ...
0
votes
1answer
555 views
Making nano accepting previous piped output as a file path
When I run the following command in linux:
find / -iname httpd.conf
I get:
/usr/local/apache/conf/httpd.conf
I want to use nano to edit this file, lazy to type the file path again, I used:
find ...
0
votes
2answers
725 views
Grepping grep output fails
I'm trying to grep the output of ngrep. Unfortunately when I add another grep to the pipeline, I get no output at all. It can be some other command too - cat / grep / tee - everything breaks the ...
6
votes
3answers
2k views
Does pipe have to write temporary file?
I found that if I transfer a great amount of data between two processes via pipe, some temporary file will be created by linux in /tmp directory. If the pipe operation succeeds, the corresponding ...
0
votes
3answers
1k views
xargs vs backtick
More silly questions from the Linux n00b. =D
I'm curious about the performance ramifications of using xargs vs. backticks.
For example, what's the different between:
find ./ -name foo* | xargs rm
...
2
votes
4answers
5k views
I would like to pipe output of find into input list of scp, how?
I'm a novice linux user and I am trying to send a long list of files from one computer to another. The argument list is too long, so I am using find. I am having trouble setting up the expression, ...
7
votes
6answers
2k views
how to beep on tail -f event
I want my PC to make a system beep on every tail event
I have the following command
tail -f development.log | grep "something rare"
is there an easy way like pipeing it to somthing that beeps? ...