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.
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:
Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:
If you want prepend/append text just wrap in echo:
echo Connected: `netstat -an|grep -ci "tcp.*established"`
Lists crontab for all users on system that have crontabs.
Shows the status of SElinux.
-- fir3net.com --
-d: list directory entries instead of contents, and do not dereference symbolic links
Remove your BASH history and then link it to /dev/null
Very useful for interactive scripts where you would like to return the terminal contents to its original state before the script was run. This would be similar to how vi exits and returns you to your original terminal screen.
Save and clear the terminal contents with:
Execute some commands, then restore the saved terminal contents with:
No need for -l and the output can be sent directly into another function expecting directory names.
same, except it works on any OS with Perl installed. DOS, Windose, whatever
Best way I know to get rid of .bash_history and don't allow bash to save the current one on exit
Edit: added ~/ before .bash_history, just in case... ;)
Using column to format a directory listing
Transforms a file to all uppercase.
It is not easy to make perl give a segfault, but this does it. This is a known issue but apparently not easy to fix. This is completely useless except for showing people that perl is not bullet-proof.
I was previously unaware of the -v switch. As a result I never got specifics about which interfaces the allowed or dropped applied to. Thought I'd share the wealth...
FYI, -n prevents DNS resolving of IPs.
This is how I list the crontab for all the users on a given system that actually have a crontab.
You could wrap it with a function block and place it in your .profile or .bashrc for quick access.
There's prolly a simpler way to do this. Discuss.
This will comment out a line, specified by line number, in a given file.
Searches for all .project files in current folder and below and uses "svn info" to get the last changed revision. The last sed joins every two lines.
Refresh the cache of font directory , usefull after you download font (.ttf or other) from various website and you don't want to reboot or relogin . Close your word processor before using the command , after the refresh reopen your word processor , new fonts is avaible !
The really awesome bash completion in debian seems to be an extra package now, which has to be installed. After sourcing /etc/bash_completion it completes almost everything (package names in apt... etc) :-)
To make this permanent, put something like this in your .bashrc:
if [ -f /etc/bash_completion]; then
The "-d" option for gnu's "date" command can calculate positive or negative offset from any time, including "now". You can even specify a source timezone (the output timezone can be set with the TZ environment variable). Useful! Fun! Not very well documented!