5
votes
3answers
135 views

Combining brace expansion and output redirection

Often, I use parameter expansion on the command-line, such as cp a.{ext1,ext2} which is expands to cp a.ext1 a.ext2 However, in many cases I do not use cp, but another tool, let's call it cat, ...
3
votes
1answer
61 views

How does SSH display the message “The authenticity of host .. can't be established”?

I wanted to trace down the system call used by ssh to output this warning message: > ssh root@abcde The authenticity of host .. can't be established. If the message were sent to stderr or ...
1
vote
1answer
136 views

fg a bg process because you forgot to redirect output to /dev/null

I did Ctrl+Z bg with the intention of disowning next, but I forgot to redirect, now I cant get to my terminal because the scrolling of the output (tarballed a huge directory with verbose set). How do ...
3
votes
1answer
312 views

What does 2>&1 in this command mean? [duplicate]

I understand that this command attempts to write to nowhere or a null device but what does 2>&1 mean here? wget -q -O - http://yourwebsite.com/wp-cron.php?doing_wp_cron > /dev/null ...
4
votes
1answer
2k views

Always redirect error to /dev/null

I know I can redirect the error messages from a command to /dev/null using the following syntax: command arg1 arg2 2>/dev/null But is there a way to do this by default so that the error messages ...
1
vote
2answers
336 views

Chaining mysqldumps commands to output a single gzipped file

Let's say I have these series of commands mysqldump --opt --databases $dbname1 --host=$dbhost1 --user=$dbuser1 --password=$dbpass1 mysqldump --opt --databases $dbname2 --host=$dbhost1 --user=$dbuser1 ...
9
votes
2answers
366 views

Trying to “locate” and then open a file

Suppose that I have a file named filename123.txt and it is the single file that is named so, and I can locate it with the command locate filename123. And it returns only this file. Now I want to open ...
10
votes
2answers
398 views

Order of redirections

I don't quite understand how the computer reads this command. cat file1 file2 1> file.txt 2>&1 If I understand, 2>&1 simply redirect Standard Error to Standard Output. By that ...
4
votes
3answers
3k views

stderr redirection not working in csh

I run the following command: pkg_add emacs-23.4,2.tbz 2> output.log The output still displays in the terminal. When I press ↑, I get pkg_add emacs-23.4,2.tbz 2 > output.log with a space ...
30
votes
4answers
14k views

How can I send stdout to multiple commands?

There are some commands which filter or act on input, and then pass it along as output, I think usually to stdout - but some commands will just take the stdin and do whatever they do with it, and ...
4
votes
2answers
1k views

the usage of < /dev/null & in the command line

I tried to run an example java program using the following command line. However, I do not know what is the trailing part < /dev/null & used for? java -cp /home/weka.jar ...
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
416 views

ls command operating differently depending on recipient

How does commands like ls know what its stdout is? It seems ls is operating different depending on what the target stdout is. For example if I do: ls /home/matt/tmp the result is: a.txt b.txt ...
3
votes
1answer
300 views

Removing redirection operator does not change output. Why?

I saw this usage of redirection somewhere, and thought it was a typo: grep root < /etc/passwd But after I run it, I saw that it gives the same output with grep root /etc/passwd: $ grep root ...
5
votes
1answer
397 views

stdin/stdout names in BASH?

I have a program that takes a -o log_file option, which writes extra data to log_file. Is there any way for me to redirect that to stdout? i.e. is there a "special name" for stdout that can be used ...
5
votes
2answers
938 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 ...
3
votes
3answers
374 views

Output exceeding terminal window width

I had run a program that resulted in many more lines of output than my current terminal window width. As a result, I could only see partial results...is there any way to get the full output? I am ...
28
votes
10answers
10k views

How do I reuse the last output from the command line?

This is a noob question, but I'd like to know how to reuse the last output from the console, ie: pv-3:method Xavier$ python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" ...
2
votes
3answers
756 views

How do I use redirection with sudo [duplicate]

Possible Duplicate: Redirecting stdout to a file you don't have write permission on Yeah I could (and probably will) just escalate to root, but I'd like to know why this doesn't work? ...
20
votes
4answers
13k views

How to redirect output of wget as input to unzip?

I have to download a file from this link. The file download is a zip file which I will have to unzip in the current folder. Normally, I would download it first, then run the unzip command. $ wget ...
9
votes
5answers
1k views

Using text from previous commands' output

I know this is not how terminals work, but I find myself often wishing there was an easy way of using text (copying it, modifying it, etc) that is already on my terminal window history from some ...