#TIL Some Unix Magics I Picked Up This Month

Posted on by 0 comment

So this month I picked up a couple of unix tricks which I wish I had have known years ago.

Tip #1.

Supervisor.
Supervisor is a service which will sustain a running process, you can tell it to auto start a command then make sure that process is always running. You can pick output files for STDOUT and STDERR then force a relaunch on any crash you might have.

Use Case: I was actually attempting to run deluged and deluge-web on a VPS I own, however often when adding a new torrent the server would crash, I’d need to ssh into the box and restart it. Now deluge restarts itself on every crash meaning I can upload and if it crashes it’ll come straight back up.

there is a good guide to setting up supervisor here Setting Up Supervisor.

Tip #2.

tmux.
tmux is a terminal multiplexer and it does exactly that. tmux will let you use all that empty space on the right of your terminal as a second terminal, it allows you to split your terminal into many many panes arrange those panes into default layouts or arrange them manually to suit your workflow. This of course has many use cases however the one that came to mind is when running an arp cache poison I usually have at least 3 tabs one for the router, one for the client, one for whatever it is you’re hoping to do with the traffic. With tmux you can run them all in the same terminal window without tabs and you can keep an eye on all your processes at once. It also looks awesome on larger screens. There is a number of cheat sheets available for tmux some of the ones I looked at:
https://gist.github.com/MohamedAlaa/2961058
https://gist.github.com/afair/3489752

But you can’t go past the man page:

http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/tmux.1?query=tmux&sec=1

Leave a Reply

Your email address will not be published. Required fields are marked *