commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
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.