commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
I have used crontab to run the one-liner and also to run a script containing the one-liner. Neither works.
This should be an option to rpm, but isn't. I wind up using it a lot because I always forget the full name of the packages I want to delete.
Good for when your working on building a clean source install for RPM packaging or what have you. After testing, run this command to compare the original extracted source to your working source directory and it will remove the differences that are created when running './configure' and 'make'.
looks at html for "ip" (it's a CSS class), then a little of cut and egrep to get IPv4 address.
I use this oneliner into conky.
Finds all files recursively from your working directory, matching 'aMethodName', except if 'target' is in that file's path.
Handy for finding text without matching all your files in target or subversion directories.
Instead of hard-coding in a check to scrape info from ifconfig based on a specific interface, do it in a more portable way.
This works really well if you switch between wired, wireless, bluetooth or even VPN connections. You can get your current IP in a script (since it'll be something like tun0 instead of eth0 or wlan1).
This uses a well known public ip address 126.96.36.199, but it doesn't actually connect to it, it just shows you the route it would take.
Given a file with the format of 'git log --pretty=short', search in last 100 commits for one with the same description. I used this when after a rebase I had to find out the new commit ids. The second sed replaces all special characters with dots so they don't mess up the grep later on.
Show the UUID-based alternate device names of ZEVO-related partitions on Darwin/OS X. Adapted from the lines by dbrady at http://zevo.getgreenbytes.com/forum/viewtopic.php?p=700#p700 and following the disk device naming scheme at http://zevo.getgreenbytes.com/wiki/pmwiki.php?n=Site.DiskDeviceNames
Pretty lame to rely on grep and "\->"? Maybe. But it works ;)
Accidentally deleted some file while used by a program ? (Eg: a song)
Use this command to find the file handle and recover using
cp /proc/pid/fd/filehandle /new/recoverd-file.ext
`multipath -ll` requires Device Mapper multipath.conf configuration. And of course, replace "3PARdata,VV" with your disk array's SCSI vendor,LUN name.
- GPT partition table allows you to create >2TB partitions
This will take the packages matching a given `apt-cache search` query (a collection of AND'd words or regexps) and tell you how popular they are. This is particularly nice for those times you have to figure out which solution to use for e.g. a PDF reader or a VNC client.
Substitute "ubuntu.com" for "debian.org" if you want this to use Ubuntu's data instead. Everything else will work perfectly.
Get the current cpu % usage on your system.
Count on a specific port (80) - FreeBSD friendly.
This command will find the highest context switches on a server and give you the process listing.
The command will make it easy to determine free IP ranges in a crowded sub-net.