commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Very convenient to for sending data to the clipboard for processing.
However, note that tee will affect the buffering of the output (stdout won't be update very live).
This will be very helpful when you are debugging shell scripts, where
you don?t want to display the echo statement and interested in only
looking at the error messages. Similarly use 2> to supress error messages
save as shell script and pipe your command output
I've had a horrible time trying to pipe the output of some shell built-ins like 'time' to other programs. The built-in doesn't output to stdout or stderr most of the time but using the above will let you pipe the output to something else.
Useful to recover a output(stdout and stderr) "disown"ed or "nohup"ep process of other instance of ssh.
With the others options the stdout / stderr is intercepted, but only the first n chars.
This way we can recover ALL text of stdout or stderr
You have a script where =ALL= STDERR should be redirected to STDIN and you don't want to add "2>&1" at the end of each command...
ls -al /foo/bar 2>&1
Than just add this piece of code at the beginning of your script!
I hope this can help someone. :)
similar to the previous command, but with more friendly output (tested on linux)
Adds the stdout (standard output) to the beginning of logfile.txt. Change "command" to whatever command you like, such as 'ls' or 'date', etc. It does this by adding the output to a temporary file, then adding the previous contents of logfile.txt to the temp file, then copying the new contents back to the logfile.txt and removing the temp file.