Capture desktop or webcam video remotely
For a screenshot of desktop:
Listen:
while true; do import -window root /tmp/image.jpeg; nc -l 1337 < /tmp/image.jpeg; done
Receive:
nc
For a picture from webcam:
Listen:
while true; do streamer -o /tmp/image.jpeg; nc -l 1337 < /tmp/image.jpeg; done
Receive:
nc
Every time you connect will send the picture it took previously and take a new one
SSH port Forwarding
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
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
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
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'
if the url has parameters separated by & enclose it in quotes
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
