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:
The first grep rejects capitalised words since the dict has proper nouns in it that you mightn't want to use. The second grep rejects words with ending in apostrophe s, and the third forces the words to be at least 15 characters long.
See more details at http://blog.amit-agarwal.co.in/2008/12/01/get-you-ip-address-like-whatismyipcom/
Replace "en1" with your network interface (on OS X, usually en0, en1, eth0, etc..)
smbfs or cifs, depends on which you are using
Does that count as a win for bzip2?
Prints the type of computer you have.
I think this should be used more in distros and other applications because it is so easy to get. This can also be asked by tutorials as an easy way to get your base hardware.
sudo dmidecode -s system-product-name
sudo smbios-sys-info-lite | sed -n 's/^Product Name: *\(.*\)/\1/p'
I used this because I needed to sort the content of a bunch of gzipped log files. Replace sort with something else, or simply remove sort to just rezip everything
Very useful for test a script. After launch this command, you only have to press ENTER for launch your script again. I work with screen and tape ENTER instead of '!!'+ENTER
If you break your script with CTRL-C, it will wait for press ENTER and will re-launch
You can write like it : while read -p "Press ENTER" ; do python ; done
This is what we use.
You can grep -v 127.0.0.1 if you wish.
List all files from the current directory and subdirectories, sorted by modification time, oldest first.
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.
Here's a version that doesn't use find.
Removes trailing newline; colon becomes record separator and newline becomes field separator, only the first field is ever printed. Replaces empty entries with $PWD. Also prepend relative directories (like ".") with the current directory ($PWD). Can change PWD with env(1) to get tricky in (non-Bourne) scripts.