3
votes
2answers
50 views

Pipe / direct image / video output to foreign server

I am working on a Project that involves taking the output from a Webcam which is in either jpg or h.264 format, and outputting it to a foreign server (HTTP / FTP would work, I am open minded). What is ...
9
votes
2answers
182 views

How can I redirect `time` output and command output to the same pipe?

Suppose I have a binary called foo. If I want to redirect the output of foo to some other process bar, I could write ./foo | bar. On the other hand, if I wanted to time foo, and redirect the output ...
3
votes
2answers
72 views

Repeated commands in a bash pipeline

Sometimes commands repeat in pipeline command. For example (just to illustrate): $ grep -lF 'pattern' ./foo/**/*.bar | xargs dirname | xargs dirname Is there a way to shorten chaining command? For ...
2
votes
3answers
110 views

Preserving color output with cut

Using bash interactively I am trying to use cut to prevent the lines from going longer than my terminal width. But when using a command with colorized output all the color gets removed by cut. For ...
1
vote
5answers
138 views

Pass the output of previous command to next as an argument

I've a command that outputs data to stdout (command1 -p=aaa -v=bbb -i=4). The output line can have the following value: rate (10%) - name: value - 10Kbps I want to grep that output in order to ...
1
vote
1answer
24 views

Mysql import the most recent file from a directory

I have a directory with daily backups of my entire MySQL database. I want to import the most recent backup into the database. I know to import a backup I need to use mysql -u root -ppasswordhere ...
3
votes
1answer
118 views

How does the piping in this command ultimately achieve to kill the process?

I have seen the following line in a bash script for killing a process(in this case started with the command loadgen): ps xww | grep -i "loadgen" | grep "PATTERNMATCH_FACT.xml" | cut -c1-5 | xargs -i ...
2
votes
1answer
96 views

How can I work around the program failing if there is *any* stdin?

For example, the following works fine: /usr/bin/program It produces some output, and gets to result. But if I invoke it like this: echo -n | /usr/bin/program or this echo -n | bash -c ...
2
votes
1answer
291 views

Make stdout and stderr be buffered by the same buffer

Is it possible to force glibc to use the same buffer for stdout and stderr? If I tee the both outputs: ./tests/tests 2>&1 | tee log I get mixed messages (i.e. messages are ordered inside ...
15
votes
1answer
354 views

Make program first read from pipe, then from keyboard

Consider the interactive program interactive. I have to run this program fairly frequently, and each time I run it the first few commands are the same. Obviously, having to type those commands over ...
2
votes
1answer
63 views

Changing compression in memory

I have some large files that I need to change the compression type of for input to a program--I need to unrar them and then gzip (or bzip2) them. However, they're highly compressed files and I don't ...
4
votes
3answers
265 views

Use command grep and locate

How I can make the grep command locate certain words in the files specified by the routes found by the locate command? locate my.cnf | grep user (I want that grep command search the word "user" ...
2
votes
5answers
599 views

Where are command line arguments (e.g. 'some.text') actually passed to?

From what I know, parameters you pass to a command, goes to it's STDIN stream. so this: cut -d. -f2 'some.text' should be perfectly identical to this: echo 'some.text' | cut -d. -f2 as we send ...
5
votes
1answer
343 views

Redirect terminal output to image file

I need to programmatically run some unix commands and get the output in a image file, the format could be png or jpeg (jpg). The commands are run in an AIX (IBM *nix) machine. I don't have ...
5
votes
5answers
599 views

resolve all ip addresses in command output using standard command line tools

I have several log files that contain a bunch of ip addresses. I would love to be able to pipe the data through a program that would match and resolve ip addresses. I.E. cat /var/log/somelogfile | ...
7
votes
4answers
696 views

What is the easiest way to execute text from tail at the command line?

Sometimes I'm working on a new (ubuntu) box and I type git and am alerted: The program 'git' is currently not installed. You can install it by typing: apt-get install git-core If that happens I ...
15
votes
10answers
7k views

What's a good example of piping commands together?

If you were helping someone to learn the concept of pipes on the command line what example would you use? The example that actually came up was as follows: cat whatever.txt | less I feel like ...
20
votes
4answers
726 views

Are Linux utilities smart when running piped commands?

I was just running a few commands in a terminal and I started wondering, does Unix/Linux take shortcuts when running piped commands? For example, let's say I have a file with one million lines, the ...
4
votes
1answer
213 views

Why did using xargs fail in this case?

I tried to understand the usage of xargs and did the following experiment. ls | xargs | touch I want to refresh the files dates and directoris in the curent directory. Though it is a bit silly,for ...
1
vote
1answer
251 views

How to know if a Linux command can read from STDIN?

I noticed this problem when I became confused with pipe, one command send its executing output to the STDOUT, which is the STDIN for the other command, which can read from STDIN. How do I know if a ...
2
votes
2answers
985 views

Passing values through pipes

I don't quite understand pipes in Linux command line. I noticed that: ll - R | grep *.pdf will list files ending with .pdf But locate *.pdf | du -h will not calculate the size of files ...
11
votes
3answers
2k views

How can I pipe output to another process, but retain the error state of the first process? [duplicate]

Possible Duplicate: Get exit code of process that's piped to another I am using the following command line (in a makefile) to pipe the verbose error messages from my compiler through a ...
4
votes
4answers
255 views

How to send stderr to stdout with a pipe to another command?

I'm trying to capture all of the output of a build operation, and send it to myprogram. I seem to only be able to capture part of it. This is what I'm trying: make clean && make ...
5
votes
2answers
815 views

Performance difference between stdin and command line argument

For some commands, it is possible to specify certain input as either stdin or a command line argument. Specifically, suppose command can take stdin input and a filename as command line argument, and ...
8
votes
2answers
1k views

Where do my ANSI escape codes go when I pipe to another process? Can I keep them?

I sometime want to pipe the color-coded output fror a process, eg. grep... but when I pipe it to another process, eg. sed, the color codes are lost... Is the some way to keep thes codes intact ? ...
22
votes
4answers
12k views

What is the mknod command used for?

I just started using Ubuntu as my main OS and I wanted to learn about things I should not do, and learn by the bad things people have done in the past. I came across these email about horror stories ...
0
votes
2answers
2k views

Unix - Filter Commands

I want to know about the "filter-command" which are available in Unix. I am confused regarding this: What is the purpose of "Filter-Command" ? Which are the Filter-commands available in Unix? I ...
17
votes
4answers
6k views

Can't pipe into diff?

I wanted to be clever and compare a remote file to a local file without downloading it. I can get the contents of the remote file by ssh user@remote-host "cat path/file.name" However, piping that ...