Linux

My 10 most used linux commands

This is a oneliner bash command to determine my 10 most used linux commands according to my history file history | awk ‘{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] ” ” CMD[a]/count*100 “% ” a;}’ | grep -v “./” | column -c3 -s ” ” -t | sort -nr | nl | head -n10 The […]

Read More
Linux

Discover online PCs fast

This is as far as I know the fastest way to determine what PCs are online in your network # nmap -sP 192.168.0.1-255 Starting Nmap 4.53 ( http://insecure.org ) at 2008-02-25 00:01 CET Host 192.168.0.120 appears to be up. Host 192.168.0.140 appears to be up. Host 192.168.0.250 appears to be up. Nmap done: 255 IP […]

Read More
Linux

Debian backports and pinning

I’m running Debian Etch because I prefer the stable Debian package tree. This is all great but the software is a little outdated compared to other distributions like Ubuntu. That is where backports come in. Backports are recompiled packages from testing (mostly) and unstable (in a few cases only, e.g. security updates), so they will […]

Read More
Linux

Apache web connections pr hour

This is a bash oneliner to show Apache web connections pr hour. It lists up the IPs that has accessed your webserver and the amount og accesses. # cat /var/log/apache2/access_log_pario.no | grep “21/Jan/2008:..” | awk {‘ print $4″:”$1 ‘} | sed ‘s/\[//g’ | awk -F : {‘ print $1″:”$2″\t\t”$5 ‘} | sort | uniq -c […]

Read More
Scripting

Script to customize a linux install

This is a simple bash script I whipped together to make som custom changes on our linux installations, it can be used as a kickstart post-configuration file for RedHat RHEL4 and RHEL5 installations. #!/bin/bash # Enable daily updates of the locate database perl -pi -e ‘s/DAILY_UPDATE=no/DAILY_UPDATE=yes/’ /etc/updatedb.conf # Customize login banners echo “Authorized users only. […]

Read More