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:
list top committers (and number of their commits) of svn repository.
in this example it counts revisions of current directory.
This is what we use.
You can grep -v 127.0.0.1 if you wish.
Lightweight alternative with case
displays current time in "binary clock" format
(loosely) inspired by: http://www.thinkgeek.com/homeoffice/lights/59e0/
.... - 1st hour digit: 0
*..* - 2nd hour digit: 9 (8+1)
.*.. - 1st minutes digit: 4
*..* - 2nd minutes digit: 9 (8+1)
PROMPT_COMMAND='echo "10 i 2 o $(date +"%H%M"|cut -b 1,2,3,4 --output-delimiter=" ") f"|dc|tac|xargs printf "%04d\n"|tr "01" ".*"'
this will dump a list of domains one per line into a text file
Here's an awk alternative, for those lacking the version of cut with the --complement argument.
Show all columns except 5th. This might help you save some typing if you are trying to exclude some columns from the output.
Use this BASH trick to create a variable containing the TAB character and pass it as the argument to sort, join, cut and other commands which don't understand the \t notation.
sort -t $'\t' ...
join -t $'\t' ...
cut -d $'\t' ...
Most systems (at least my macbook) have system users defined, such as _www and using "users" for example will not list them. This command allows you to see who the 'virtual' users are on your system.
I've been using it in a script to build from scratch proxy servers.
The ^python$ is a package name patten. You can change whatever you want.
The cut should match the relevant timestamp part of the logfile, the uniq will count the number of occurrences during this time interval.
Change the cut range for hits per 10 sec, minute and so on... Grep can be used to filter on url or source IP.
A command to find out what the day ends in. Can be edited slightly to find out what "any" output ends in.
NB: I haven't tested with weird and wonderful output.
This version makes uses of Bash shell expansion, so it might not work in all other shells.
grabs your local IP Address.
as unixmonkey7109 pointed out, first awk parse replaces three steps.
It's not a big line, and it *may not* work for everybody, I guess it depends on the detail of access_log configuration in your httpd.conf. I use it as a prerotate command for logrotate in httpd section so it executes before access_log rotation, everyday at midnight.