How-To: Linux
Documentation
Installing dictionaries and setting the default language for OpenOffice.org
Install a new dictionary
This step depends on your OS and distro. Under Gentoo Linux you can install one of the myspell dictionary packages. The following shows how to install the English package while logged in as root in Gentoo:
emerge app-dicts/myspell-en
eselect oodict set myspell-en
Set the default language
Then restart OpenOffice.org as a regular user, select the menu item 'tools/options' and then under the 'language settings/languages' dialog set the 'default languages for documents' field to your language of choice (in my case it is 'English (Canda)', in other words 'Canadian English').
Printing
Print 2 pages per sheet on a single sided printer
First print to a postscript file (say file.ps), then run:
psnup -2 -q -d1 -pletter file.ps > file2.ps
psselect -e file2.ps | lpr
Then rotate the printed pages around and insert printed face up into sheet feeder and run:
psselect -o file2.ps | lpr
Print an A4 sized document on a US-letter printer
First print to a postscript file (say file.ps), then run:
psresize -PA4 -pletter file.ps | lpr
Print a 2 page per sheet booklet on a single sided printer
First print to a postscript file (say file.ps), then run:
psbook -q file.ps test.ps
psnup -2 -q -pletter test.ps > book.ps
psselect -e book.ps | lpr
Then insert printed face up into sheet feeder and run (do not rotate):
psselect -o book.ps | lpr
Running windows under Linux
VMware
If you need to run windows (yes, even sometimes I do) I highly recommend
VMware. I have used
wine and
win4lin, yet VMware is by far the most reliable and easy to use.
A side note: win4lin (the windows 98 version, not 'win4lin pro' which is used for windows 2000 and up) is still the best choice for windows 98 under Linux since it is the fastest and the cheapest. Yet how often do you find apps that will work under windows 98?
Up until the fall of 2005 VMware required the purchase of their full
workstation product in order to run an emulated OS. However you can now simply create a 'virtual machine' (what they also refer to as a 'snapshot', which is simply the directory contents containing the emulated OS disk image and config files) using the regular VMware workstation tool (either pay for it, or 'try it out' using a demo license) and then run the
FREE VMware Player product to 'play' (i.e. run) the OS on your computer. In other words, you can now run VMware effectively for free (sans creating the virtual machine using the full workstation tool, which can be done with a demo license).
Tips & tricks
Using full-screen
For full-screen hit CTRL-ALT-F7, hit F8 to switch back.
Encrypting a file-system with cryptsetup-luks
cryptsetup-luks uses the device-mapper to seamlessly encrypt a block device (either on the disk or with a file using a loop-back device). You will need a kernel with device mapper and crypto api support to use this.
Create and encrypt the file-system
Select a device and encrypt it. In this example I create a 1GB file-system that is backed by the file
/crypt/test using the loop-back device
/dev/loop0. You will be asked to 'Enter LUKS passphrase', this is your master passphrase that will be needed whenever you want to mount the file-system, so
don't forget it!
dd if=/dev/zero of=/crypt/test bs=1M count=1 seek=1023
chmod 600 /crypt/test
losetup /dev/loop0 /crypt/test
cryptsetup -y -c aes-cbc-essiv:sha256 -s 256 luksFormat /dev/loop0
cryptsetup luksOpen /dev/loop0 testfs
mkfs.ext3 -m 0 /dev/mapper/testfs
Mount the file-system
Now you can mount the encrypted file-system. The following commands are all that is necessary to mount the file-system on reset (you can skip the first two lines if you just created it using the previous step).
losetup /dev/loop0 /crypt/test
cryptsetup luksOpen /dev/loop0 testfs
mount /dev/mapper/testfs /mnt/crypt
Unmount the file-system
Now you can unmount the encrypted file-system. These are all the commands that are needed to do a clean shutdown of the file-system.
umount /dev/mapper/testfs
cryptsetup luksClose testfs
losetup -d /dev/loop0
Check the device mapper table
Run the following command to ensure that the device mapper is correctly configured (after you have run
cryptsetup luksOpen). You should see something starting with 'testfs: 0 2095096 crypt aes-cbc-plain'.
dmsetup table testfs
User management
Adding a user to a group
gpasswd can be used to add a user to a group. In the following example the user
user1 is added to the group
group1.
gpasswd -a user1 group1
Editing text
Using Vim
Spamassasin
Checking the configuration
Mplayer
Using mplayer to extract a specific range of frames from a movie
mencoder dvd://1 -oac copy -ovc copy -ss START:TIME -endpos SCENESECONDS -o scene.avi
ack
ack -- better than grep, a power search tool for programmers
Honestly, this is *the* ultimate search tool. Faster than grep with intelligent behavior (such as automatically ignoring .svn, CVS and other VCS directories and binary files). Try it and you won't be disappointed!
Get it at the
ack website. There is also a Gentoo
ebuild. Read these nice blog entries
here and
here discussing some of the features.
BitTorrent
rTorrent
rTorrent is by far the best command line torrent client for Linux. Read the on-line manual
here.
GNU Screen
Intro
GNU Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells. It's the command line equivalent to a window manager, and is the best tool for running persistent interactive programs via the command line.
Command usage
screen -ls lists your screen sessions
screen -S somename creates a new screen session named 'somename'
screen -r re-attaches to the first detached session found
screen -dr forces the first session found to detach then attaches to it
screen -dr somename forces the session named 'somename' to detach then re-attaches to it
Screen tips
Note:
C-a means CTRL-A (the 'control' and 'a' keys pressed simultaneously).
C-a c create a new terminal
C-a A allows you to name the terminal
C-a d detaches from the screen session
C-a " lists the terminals
C-a p moves to the previous terminal
C-a n moves to the next terminal
C-A ESC enters scroll back mode, uses vim style movement/copy/paste keys
C-A q leaves scroll back mode
C-A :quit quits/kills the screen session
Gnome
Tweaks
Setting the wallpaper via the command line:
gconftool-2 -t str --set /desktop/gnome/background/picture_filename /path/to/some/file.png
Enabling wire-frame move and resize:
gconftool-2 -t bool --set /apps/metacity/general/reduced_resources true
Editing the menus:
Useful commands
- alt-f1 launch the applications menu
- alt-f2 launch "run application" dialog prompt
- ctrl-alt left-arrow move to the previous virtual desktop
- ctrl-alt right-arrow move to the next virtual desktop
- ctrl-alt-shift left-arrow move focused window to the previous virtual desktop
- ctrl-alt-shift right-arrow move focused window to the next virtual desktop
Misc.
UUIDs
Find the UUIDs for all block devices:
Create a random UUID: