Simple but useful command, I use this for purge an hard disk entry in Virtualbox registry file (is in ~user/.Virtualbox) that persist if I erase a Virtual Machine, so I need to delete it manually.
Gets the internal and external IP addresses of all your interfaces, or the ones given as arguments Show Sample Output
Use the hold space to preserve lines until data is needed.
Strips comments from at least bash and php scripts. Normal # and // as well as php block comments
removes all of the:
empty/blank lines
lines beginning with #
lines beginning with //
lines beginning with /*
lines beginning with a space and then *
lines beginning with */
It also deletes the lines if there's whitespace before any of the above.
Add an alias to use in .bashrc like this:
alias stripcomments="sed -e '/^[[:blank:]]*#/d; s/[[:blank:]][[:blank:]]*#.*//' -e '/^$/d' -e '/^\/\/.*/d' -e '/^\/\*/d;/^ \* /d;/^ \*\//d'"
This uses urandom to produce a random password. The random values are uuencoded to ensure only printable characters. This only works for a number of characters between 1 and 60. Show Sample Output
This doesn't make any assumptions about your IP address and prints out one IP address per line if you have multiple network interfaces. Show Sample Output
For those days when you need to know if something is happening because the day ends in "y". Show Sample Output
This will get the mac address of the eth0 and change lowercase to uppercase. The sed command removed the colons.
Search in all html files and remove the lines that 'String' is found.
We can put this inside a function:
fxray() { curl -s http://urlxray.com/display.php?url="$1" | grep -o '<title>.*</title>' | sed 's/<title>.*--> \(.*\)<\/title>/\1/g'; };
fxray http://tinyurl.com/demo-xray
Show Sample Output
short enough to be tweetable Show Sample Output
This backup function preserve the file suffix allowing zsh suffix aliases and desktop default actions to work with the backup file too. Show Sample Output
Download a bunch of random animated gifs from http://gifbin.com/
Are the two strings anagrams of one another? sed splits up the strings into one character per line the result is sorted cmp compares the results Note: This is not pretty. I just wanted to see if I could do it in bash. Note: It uses fewer characters than the perl version :-)
A much shorter version of this command.
for small output only example usage: jobs -l |col1 72
deletes first 55 lines; change the 55 to whatever number
use today's time stamp to make a unique directory for today or an hour ago ... Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: