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:
Watches for file modifications in the current directory and tails the file.
Shows which applications are making connections, and the addresses they're connecting to. Refreshes every 2 seconds (watch's default). Test on OSX, should work anywhere watch and lsof work.
Shows files and processes of the command php
Watch file's contents that is getting overwritten
For use when you can't use "watch" (user-defined functions, aliases). This isn't mine - its an alternate posted in the comments by flatcap, and is the shortest and easiest to remember.
This handles when you have a single call or channel. Other commands will strip out the result if there is a single channel or call active because the output changes the noun to be singular instead of plural.
top accecpts a comma separated list of PIDs.
Like command 10870, but no need for sed
may return several pids for process foobar footy01 etc. like this:
sed puts "-p " in front and we pass a list to top:
top -p 11427 -p 12576 -p 12577
Values will depend on the driver and the hardware specifics, so you need to refer to your driver documentation for proper interpretation of those values.
Watches the headers of a curl, following any redirects and printing only the HTTP status and the location of the possible redirects.
this alternative shows the differences as they occur so that they are made plain
watch ls -l
Basic but usable replacement for the "watch" command for those systems which don't have it (e.g. the Solaris I'm trapped on).
Type Ctrl+V to escape the following Ctrl+L which clears the screen. It will be displayed as "^L".
Only the number of calls nothing else.
In this case it runs the command 'curl localhost:3000/site/sha' waiting the amount of time in sleep, ie: 1 second between runs, appending each run to the console.
This works well for any command where the output is less than your line width
This is unlike watch, because watch always clears the display.
Changes are displayed when they are written to the file
Shows updated status in a terminal window for connections to port '80' in a human-friendly form. Use 'watch -n1' to update every second, and 'watch -d' to highlight changes between updates.
If you wish for status updates on a port other than '80', always remember to put a space afterwards so that ":80" will not match ":8080".
A shorter version
Just a simple way without the need of additional tools. Of course, replace eth0 with your IF.