RSS

SSH port Forwarding

0 Comments | This entry was posted on Sep 23 2010

This may come in handy when you want to acces a server:port from outside the network it is sitting on. If there is another server on the same network that you can access via ssh this is what you do.

Server1 = server with ssh port open
Port1 = ssh port of Server1

Server2 = server you want to access
port2 = port of server 2 you want to access

ssh -L 8080:server2:port2 -P port1 account@server1

now you can access server2:port2 on your localhost:8080

Watch a log file as it grows

0 Comments | This entry was posted on May 24 2010

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

0 Comments | This entry was posted on Apr 18 2010

nbtscan -r 192.168.0.1/24

UPDATE:

-r Use local port 137 for scans. Win95 boxes respond to this only. You need to be root to use this option.

it might be that the nmbd daemon holds the 137 port already and you will get an error message. If you dont need to find win95 hosts just omit the -r. Otherwise…well kill the daemon first

Audit free space in hard drive

0 Comments | This entry was posted on Apr 14 2010

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

0 Comments | This entry was posted on Apr 06 2010

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

Scan network for up hosts

0 Comments | This entry was posted on Mar 30 2010

nmap -sP xx.xx.xx.1/24

Track redirects

0 Comments | This entry was posted on Mar 24 2010

To track if you are being redirected and where:

curl -I -L 'http://url.com'

if the url has parameters separated by & enclose it in quotes

Regular expressions reference

0 Comments | This entry was posted on Mar 19 2010

http://www.regular-expressions.info/reference.html

Maximize/minimize window from command line

0 Comments | This entry was posted on Feb 12 2010

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

0 Comments | This entry was posted on Feb 12 2010

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