Watch a log file as it grows
To read a log file and keep it open as it grows to see how it changes use -f option of tail
example:
sudo tail -f /var/log/mail.log
Aside Note: I got my first spam comments today!! yeiii! no real human comments yet though
Scan hosts and get their names
nbtscan -r 192.168.0.1/24
Audit free space in hard drive
This will give you the top biggest files/folders in /path
du -a /path | sort -n -r | head -n 10
This will show you the available disk space on every mounted HD
df -h
Firefox cache files
To check location and key of files in the cache type in address bar:
about:cache?device=disk
..handy when you want ex to download a flash video that doesnt pre-load
Track redirects
To track if you are being redirected and where:
curl -I -L 'http://url.com'
Regular expressions reference
http://www.regular-expressions.info/reference.html
Maximize/minimize window from command line
wmctrl -l
will give you the list of windows
wmctrl -r "title of window" -b toggle,fullscreen
will make full screen the window that contains “title of window” in its title.
For maximize, minimize and some other cool stuff:
man wmctrl
Example:
This script will put in full screen the time table for the bus stop Kasperinkuja in Helsinki
firefox -URL 'http://www.omatlahdot.fi/omatlahdot/web?stopid=4100&=Hae&command=quicksearch' &
sleep 5
firefox -new-tab 'http://www.omatlahdot.fi/omatlahdot/web?page=pages/fullscreen.htm'
sleep 5
wmctrl -r "Firefox" -b add,fullscreen
Compare two file trees
To compare two file trees you do:
diff -r -q file/structure1 file/structure2
If the two file structures are checked out from different svn repositories you will get a bunch of differences from the .svn folders so to clean that out you add:
diff -r -q file/structure1 file/structure2 | egrep -v .svn
and you will get just the files that differ from each other file trees, either because the files are different or because they only exists in one of the trees
Keyring password in Ubuntu
When I change the master password in ubuntu the keyring password remains the same. It gets annoying because then I have to type my old password every time I connect to a wireless network, or connect to a server via ssh or basically any time keyring needs to send out a recorded password.
Solution:
rm ~/.gnome2/keyrings/login.keyring
…and re-boot
