…with an open minded approach


setup iptable rules for transmission (torrents)

Without further addo, here it is, a working example how to configure iptables to allow transmission torrents to internet (udp 51413) + transmission remote RPC (tcp 9091, localnetwork only) + ssh (tcp 22, localnetwork only).



Drop a comment if its usefull 🙂


text manipulation: lines to columns and other goodies

Have a look at the power of the “paste” comand – it just solves a bunch of situations with ease, and its litle known… transpose pair a lines into 2 columns, etc…


Have a look to these examples to get an idea of “paste” power…



bash scripts multiple arguments

Example how to parse multiple arguments, one-by-one, in bash – be aware of the importance of surrounding “$@” and “$ARG_I” within double-quotes.




unix directory hacks with cd

I’ll just link to the http://www.thegeekstuff.com/2008/10/6-awesome-linux-cd-command-hacks-productivity-tip3-for-geeks/

Read them carefully and your console efficiency may just get a big boost 🙂


sudo run as another user – scripting it

To ease your admin scripts….

Bash local variables

All variables in bash default to being *global*.

To define a variable as *local* to a function, we can do:

function my_func {

local MY_LOCAL_VAR=”is local to the scope of its function”


debugging bash scripts

There is a very handy bash option, that will “run the entire script in debug mode. Traces of each command plus its arguments are printed to standard output after the commands have been expanded but before they are executed” (see [1])

This seems most usefull for inhouse-scripts, to show progress of the script



[1]: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html



Detect ssh login from ~/.bashrc

When you login with ssh, your environment gets 2 variables defined: SSH_CONNECTION and SSH_TTY

A simple way to detect if you are inside a bash session, established from ssh-login, is to check these vars

You can put this check inside ~/.bashrc, so that it executes in all new bash-logins, so that when a ssh-login is detected you can make something happen 🙂

This is a simple hack to detect normal ssh-logins, but dont use this for anything too important 🙂



Bash initialization files

This bash resume diagram is respectfully copied from http://www.solipsys.co.uk/new/BashInitialisationFiles.html

I’ll post it here before I need it again – its just great

Sed info

Sed – An Introduction and Tutorial by Bruce Barnett – I really should post this up before I forget: it’s a sed resume that goes from-basic-to-deep features, progressively explaining what-does-what with examples… a really good reference for sed usage


If you’r into sed, take a look – it will be worth it