Easy way to grab the IP address of a machine for easy script use. If needed a "| grep -v 127.0.0.1" at the end will suppress localhost. Show Sample Output
hb(){ sed "s/\($*\)/`tput setaf 2;tput setab 0;tput blink`\1`tput sgr0`/gI"; }
hb blinks, hc does a reverse color with background.. both very nice.
hc(){ sed "s/\($*\)/`tput setaf 0;tput setab 6`\1`tput sgr0`/gI"; }
Run this:
command ps -Hacl -F S -A f | hc ".*$PPID.*" | hb ".*$$.*"
Your welcome ;)
From my bash profile - http://www.askapache.com/linux-unix/bash_profile-functions-advanced-shell.html
Show Sample Output
Here's a version that doesn't use find.
Instead of having someone else read you the Digg headlines, Have OSX do it. Requires Curl+Sed+Say. This could probably be easily modified to use espeak for Linux.
Here's a version that uses netcat (although I'd much rather use curl!).
Finds the line number matching the regex, then passes that to BC for some math, passes that to head, and uses tail to trim off the unwanted section at the top. The whole thing is spit out to a script that can then be shared or run. Comes in handy for reading select sections from error logs.
#Sample Usage: # git commit -m"Jira #404 - `whatthecommit`" # Show Sample Output
This heavy one liner gets all the files in the "/music/dir/" directory and filters for non 44.1 mp3 files. After doing this it passes the names to sox in-order to re-sample those files. The original files are left just in case.
I had a file named " " (one space) and needed a way to see what the real filename was so I could remove it. sed to the rescue. Show Sample Output
Broaden your knowledge of the utilities available to you in no particular order whatsoever! Then use that knowledge to create more nifty one-liners that you can post here. =p Takes a random number modulo the number of files in $dir, prints the filename corresponding to that number, and passes it as an argument to man.
Great idea camocrazed. Another twist would be to display a different man page based on the day of the year. The following will continuously cycle through all man pages:
man $(ls /bin | sed -n $(($(date +%j) % $(ls /bin | wc -l)))p)
Of course, this command must be executed at a GRID User Interface lhcb - name of your VO, substitute it with the one you are interested it. Show Sample Output
Instead of tedious manual mv commands and tabbing, this routine creates a file listing all the filenames in the PWD twice, edit the second instance on each line to the new name, then save the file, the routine does the rest. Feel free to replace nano with your holy war editor of choice. You will get a lot of "mv: 'x' and 'x' are the same file" warnings, these could be cleaned up but the routine works.
I know you can use pidof but with this you can know the specific PID with his command arguments (useful if you're running various proccess with same application)
If you don't send an interface, it shows private IP address of all interfaces
Convert text from lowercase to uppercase Show Sample Output
Fetch comical VC commit messages from whatthecommit.com Show Sample Output
Calc the rough time from Twitter. Now with leading Zeroes. Show Sample Output
This command lists all the directories in SEARCHPATH by size, displaying their size in a human readable format. 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: