Friday, August 10, 2007

Xbindkeys

Xbindkeys is a program which allows the cutom mapping of special keys on your keyboard to programs.

The program can be easily installed, either from source or from a package system (rpm, ports, etc).

Once the program is install run the following:

xbindkeys -d > ~/.xbindkeysrc

This will set the program up initially. Next, start the daemon by runnning `xbindkeys` from the command prompt. To set a new key type:

xbindkeys -k

then press the key on your keyboard. You shoudl get an entry like below:

" Some Text Here "
m:0x0 + c:204

Copy the text to the ~/.xbindkeysrc file and change the "Some text here" to the name of the program you wish to run. Finally run xbindkeys -s to see the bindings.

Next, just press the key, and enjoy.

Labels: , , ,

Wednesday, August 08, 2007

Screen

Screen is a very useful command. It allows you to have multiple virtual terminals on a machine via one connection (so you reduce the amount of bandwidth needed, handy on a slow connection). Another handy feature that screen has is that you can disconnect and reconnect to it.

Processes that need to be interacted with, or at least monitored can simply be run in side screen, and simply reconnected to later.

'man screen' for more information.

Labels: , , ,

Tuesday, August 07, 2007

Disowning Processes

Exiting from a shell while having background processes can sometimes cause these processes to exit.

To Avoid this, the process must be disowned. If the job is already started, it can be disowned by typing 'disown %' where is the number as listed by the jobs command.

Alternatively, you can start the process by simply putting the whole string in brackets. For example, if you wanted to start the process true, in the background and disowned, you could type:

(/bin/true &)

Labels: , , ,

Backgrounding Processes

Processes run from the command line in a shell such as bash can be placed in to the background in 2 ways:

1. Placing an '&' after the command. This starts to process in the background automatically.

2. Press Control+Z (Ctrl+Z) after the job has started. This gives you the chance to enter any text you may need to, before moving on. By Pressing Ctrl+Z, you actually suspend the process. Typing 'bg' will background the process.

You can bring a process back in to the foreground by typing 'fg'.

If you have multiple jobs running in the background, you can view them by typing 'jobs'. To bring a job in to the foreground (which was not the last one), use 'fg %' the is the same one listed in the output from the 'jobs' command.

Labels: , , ,