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:
From 'man netstat'
"netstat -i | -I interface [-abdnt] [-f address_family] [-M core] [-N system]
Show the state of all network interfaces or a single interface
which have been auto-configured (interfaces statically configured
into a system, but not located at boot time are not shown). An
asterisk (``*'') after an interface name indicates that the
interface is ``down''. If -a is also present, multicast
addresses currently in use are shown for each Ethernet interface
and for each IP interface address. Multicast addresses are shown
on separate lines following the interface address with which they
are associated. If -b is also present, show the number of bytes
in and out. If -d is also present, show the number of dropped
packets. If -t is also present, show the contents of watchdog
Connect EC2 server with public keys "/root/.ec2/id_rsa-gsg-keypair" or "/root/.ec2/keypair.pem"
List all files in a directory in reverse order by modified timestamp. When piped through tail the user will see the most recent file name.
Just waste some resources in a philosophical way
I make an extensive use of sudo, so I had to exclude the sudo part of the command history
ok I'm sure it's not pretty
Change HH:MM with your target time.
This is for a Debian/Ubuntu GNU system. You need bash (package bash), date (package coreutils) and toilet (package toilet). Install with:
# apt-get install bash coreutils toilet toilet-fonts
For a python project, sometimes I need to clean all the compiled python files. I have an alias 'rmpyc' to this command. This really saves me a lot of typing and hunting throughout the folders to delete those files.
this command searches for a keyword or an expression in a path and avoids versionned files
Enable 'sleep' function in Windows environment where this does not exist, although not exact in time. (there is a delay for each ping) This is a simple way to separate commands with a time-period.
A simple command to find the total number of subdirectories in current directory starting with specific name.
A different approach to the problem - maintain a small sorted list, print the largest as we go, then the top 10 at the end. I often find that the find and sort take a long time, and the large file might appear near the start of the find. By printing as we go, I get better feedback. The sort used in this will be much slower on perls older than 5.8.
The nl command lists the contents of a file where is each line is prefixed by a line number. For more information about this command, check out its man page. I tested under Mac OS X and Xubuntu 9.04
Restores the keyboard so your partner who expects the keys to correspond to what they're labelled can type (in qwerty).
The description of how the one-liner works is here at my blog:
If you don't save the rule set it won't be applied during a reboot
Convert text from lowercase to uppercase