Use tee to send output to the console and to a file:
machine:dir user$ ./some_program | tee output_file.txt
Executing the above command will display the output of some_program immediately in the console and write the same contents to output_file.txt.
I use this command mostly for diffs against svn, saves a step. Also, though I'm posting this as a Mac OS X terminal option, I first discovered this on Ubuntu 8.04 though I sure the history or this command is much older. I recall from the documentation to think of this in plumbing terms: Send your output down a pipe to a "T" essentially sending the same stream/flow to two different places.
~Fin
Too often I figure out how to do this or that on Linux systems and in my haste to complete whatever task I've been assigned this "How To" knowledge gets lost. So here, I will begin posting little odds and ends in hopes of not needing to re-research past efforts for Linux tips, tricks, hacks, and other good to know things. If you find yourself here and know of smaller, faster, better ways of doing any of this please let me know - only through cooperation can we all get better.
Monday, August 2, 2010
Friday, January 15, 2010
Recursive SVN Directory Removal - Ubuntu 9.10 Karmic
From time to time it can be handy to remove subversion references from code that is sitting on the file system. The following command will remove all '.svn' directories from the current directory on down:
user@machine:~/dev/sample1$ rm -rf `find . -type d -name .svn`
(Please note those are grave accent quotes - below the tilde on the key left of the one(1) key.)
This command should work for all flavours of Unix.
~Fin
user@machine:~/dev/sample1$ rm -rf `find . -type d -name .svn`
(Please note those are grave accent quotes - below the tilde on the key left of the one(1) key.)
This command should work for all flavours of Unix.
~Fin
Tuesday, January 12, 2010
Create a symbolic link - Ubuntu 9.10 Karmic
ln -s /path/to/real/file /path/to/non-existant/file
So you could do like:
user@machine:~/devtools/jdk$ ll
drwxr-xr-x 10 root root 4096 2010-01-12 11:11 jdk-1.6.0
user@machine:~/devtools/jdk$ ln -s jdk-1.6.0/ current
user@machine:~/devtools/jdk$ ll
lrwxrwxrwx 1 brad brad 10 2010-01-12 11:25 current -> jdk-1.6.0/
drwxr-xr-x 10 root root 4096 2010-01-12 11:11 jdk-1.6.0
user@machine:~/devtools/jdk$
~Fin
So you could do like:
user@machine:~/devtools/jdk$ ll
drwxr-xr-x 10 root root 4096 2010-01-12 11:11 jdk-1.6.0
user@machine:~/devtools/jdk$ ln -s jdk-1.6.0/ current
user@machine:~/devtools/jdk$ ll
lrwxrwxrwx 1 brad brad 10 2010-01-12 11:25 current -> jdk-1.6.0/
drwxr-xr-x 10 root root 4096 2010-01-12 11:11 jdk-1.6.0
user@machine:~/devtools/jdk$
~Fin
Subscribe to:
Posts (Atom)