Tagged Questions
2
votes
1answer
42 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
54 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
258 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 ...
8
votes
1answer
208 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 ...
3
votes
1answer
789 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 ...
14
votes
4answers
5k 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
554 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
1k 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
356 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
247 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
190 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 ...
3
votes
2answers
492 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 ...
2
votes
3answers
198 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 ...
17
votes
10answers
4k 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()"
...
1
vote
3answers
439 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?
...
12
votes
3answers
6k 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 ...