Check These Out
Stuck behind a restrictive firewall at work, but really jonesing to putty home to your linux box for some colossal cave? Goodness knows I was...but the firewall at work blocked all outbound connections except for ports 80 and 443. (Those were wide open for outbound connections.) So now I putty over port 443 and have my linux box redirect it to port 22 (the SSH port) before it routes it internally. So, my specific command would be:
$iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 22
Note that I use -A to append this command to the end of the chain. You could replace that with -I to insert it at the beginning (or at a specific rulenum).
My linux box is running slackware, with a kernel from circa 2001. Hopefully the mechanics of iptables haven't changed since then. The command is untested under any other distros or less outdated kernels.
Of course, the command should be easy enough to adapt to whatever service on your linux box you're trying to reach by changing the numbers (and possibly changing tcp to udp, or whatever). Between putty and psftp, however, I'm good to go for hours of time-killing.
The title is optional.
Options:
-t: expire time in milliseconds.
-u: urgency (low, normal, critical).
-i: icon path.
On Debian-based systems you may need to install the 'libnotify-bin' package.
Useful to advise when a wget download or a simulation ends. Example:
$ wget URL ; notify-send "Done"
This appends (-A) a new rule to the INPUT chain, which specifies to drop all packets from a source (-s) IP address.
Play files in shuffle mode with bash and mpg123.
Why bother using big-as-hell stuff like mplayer? This will play all your music files contained in */* (in my case author/song.format) with bash and mplayer showing a nice output.
no need grep. its redundant when awk is present.
Creates a quick backup with tar to a remote host over ssh.
Run netstat as root (via sudo) to get the ID of the process listening on the desired socket.
Use awk to 1) match the entry that is the listening socket, 2) matching the exact port (bounded by leading colon and end of column), 3) remove the trailing slash and process name from the last column, and finally 4) use the system(…) command to call kill to terminate the process.
Two direct commands, netstat & awk, and one forked call to kill.
This does kill the specific port instead of any port that starts with 50. I consider this to be safer.
see the TIME_WAIT and ESTABLISHED nums of the network
This says if the LHC has destroyed the world. Run it in a loop to monitor the state of Earth. Might not work reliable, if the world has actually been destroyed.