Old Linux Tips

tires May 20, 2007

NOTE: Linux Tips will be moving soon….

Here are a bunch of tips and commands that I find useful in my daily use of the Linux OS.

I will update this with commands and links to websites and forums.

If your new to linux click the link below to download a iso of the OS to your computer.

Ubuntu x86 (Dapper 6.06)
For almost all PCs. This includes most machines with Intel/AMD/etc type processors and almost all computers that run Microsoft Windows.

Then you will need to burn it to a CD using Nero burning rom or whatever you have on your machine. Since most machines have different software to burn CDs it is hard to write a simple howto doc on this subject. Usually you look for “burn CD image” and follow the directions.
Or, if you wish to wait you can have the people behind Ubuntu ship you the CD. Click here to learn more.

There are many howto’s across the net on this subject, so google around and you can find help. I recommend Ubuntuforums.org for questions.

Keyboard Shortcuts

Pio’s Blog

A neat little web site with a cool graphical representation of keybord shortcuts. mostly for command line.


This is a nifty little command line tool that lets you open a command prompt and keep it open.

Website with hints

The basics:

to start screen type screen in a command line


Ctrl + a, c = create another window

Ctrl + a , Ctrl + a = switch between screens

Ctrl + a, d = detach from a screen


screen -r

to reattach

Ctrl + a, w = list of windows

Ctrl + a, 0-9 = switch between window 0 thru 9


To install software in Ubuntu

sudo apt-get install “program name”


Create a DVD from an avi file

you will need the following programs installed: tovid, mkisofs, and dvdauthor and their dependancies.

The basic commands are:

tovid -in file.avi -out video

mkiso video.mpg

I then combine them in one long command that creates a iso file. I then right click on the iso and then click “write to disc”

mkiso is a shell script I found on the internet its contents are below:


Make iso from MPG’s

dvdauthor -o dvd -t $1 &&

dvdauthor -o dvd -T &&

mkisofs -dvd-video -o dvd.iso dvd/ && exit

To make this work you will need to do the following:

sudo nano /usr/bin/mkiso

copy and paste the code. ctrl+o to save and ctrl+x to exit.


sudo chmod +x /usr/bin/mkiso

Here is a cool link with more scripts


OK, So I am learning about full disk encryption in case my computer gets stolen. Here are some web instructions and commands to help:

Right now it is a pain and you are better off waiting for the next release of Ubuntu.

Basic full encryption install

Auto install

With the auto install here are commands to extend your LVM space:

For example to make /home 4G do:

sudo lvextend -L4G /dev/vgcrypt/home

sudo resize_reiserfs /dev/vgcrypt/home

LVM GUI install

Linux Raid setups: Here are to links for my sources, I will write up a tip soon
Howto #1

Howto #2


AVI to PSP format

I have a Sony PSP, and I like it a lot. Unfortunatly Sony doesn’t support open formats or they just like locking their users down. Fortunatly for me and you, we use Linux. There are some great tools to convert whatever you want to something else. This little tip will convert a AVI file to the PSP format MP4.

You will need a AVI and ffmpeg

Install ffmpeg: (copied from here) [edited for my own stuff]

I normally don’t build software, because something always breaks. This one however is pretty simple and I’ve done it a bunch.

“First, we need to fix ffmpeg for Ubuntu. We’ll build it from source…but don’t worry, it won’t hurt. We’ll also need to install some other libraries. So, here goes:


sudo apt-get build-dep ffmpeg sudo apt-get install liblame-dev libfaad2-dev libx264-dev x264-bin checkinstall libfaac-dev libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev apt-get source ffmpeg cd ffmpeg-*/ ./configure –enable-gpl –enable-pp –enable-vorbis –enable-libogg –enable-a52 –enable-dts –enable-dc1394 –enable-libgsm –disable-debug –enable-mp3lame –enable-faad –enable-faac –enable-xvid –enable-pthreads –enable-x264 make sudo checkinstall -D make install

It will go through a bunch of stuff and prompt you on the last command for a few things. First, hit y to create docs, then just hit enter at the EOF question. Next, it will take you to the name and version. Edit #2 (name) to be ffmpeg, then edit #3 (version) to be something newer than what it is…so, either 1.cvsxxxxxx or some other way. I had a bit of trouble with this step, so I simply did a sudo make install instead of the whole checkinstall. If you don’t mind not having a dpkg for it, then I’d recommend going straight to a sudo make install. Now, ffmpeg is fixed.”

Now that ffmpeg is installed we can move on to the encoding.

There are a couple ways to do this. first is the command prompt way, the other is scripting it.

First the command prompt:

ffmpeg -i YOUR-DOWNLOADED.avi -f psp -r 14.985 -s 320×240 -b 768 -ar 24000 -ab 128 M4V00001.MP4

This command outputs a MP4 file named M4V00001.MP4. You can upload it to your PSP and play it all you want. The reason it is named that way is Sony is dumb.

Now to script it. I found an Ipod script that works really well and I converted it to encode for the PSP.

To make this work through out the system you will need to place the script it /usr/bin and change the permissions to execute. Open a terminal and type the following:

sudo gedit /usr/bin/pspenc

Copy the script below into the text editor.


pspenc – The PSP Video Encoder for Linux

Based upon ipodvidenc – The iPod Video Encoder for Linux.

Created by Eric Hewitt, January 9, 2006.

Updated by Jeremy Schroeder May 21, 2006

Released under the GPL. Go nuts, and have fun.


echo “What would you like to name the output file (sans extension) [M4V00001]?”

read output_file_name

echo “$output_file_name will be located in $PWD. Is this acceptable? [y/n]”

read output_file_loc_permis

if [ $output_file_loc_permis = ‘n’ ] || [ $output_file_loc_permis = ‘N’ ]
echo “Where would you like to store $output_file_name.MP4?”
read output_dir

original command for ipod

ffmpeg -i “${input_file}” -f mp4 -vcodec mpeg4 -maxrate 1000 -b 700 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec aac -ab 192 -s 320×240 -aspect 4:3 “${output_dir}/${output_file_name}.mov”

New command for PSP

ffmpeg -i “${input_file}” -f psp -r 29.970030 -b 768 -ar 24000 -ab 128 -s 320×240 “${output_dir}/${output_file_name}.MP4″

Command to create Image file .THM

ffmpeg -y -i “${input_file}” -f image2 -ss 5 -vframes 1 -s 160×120 -an “${output_dir}/${output_file_name}.THM”

Now save and close the text editor. Then issue the following command.

sudo chmod +x /usr/bin/pspenc

Alright, you now can find an AVI and convert it. Using the following command:

pspenc YOUR-AVI.avi


My Super wallpaper changer script

Open a terminal and type the following:

cd ~

mkdir theme

mkdir theme/Wallpapers

cd theme/Wallpapers

gedit AutoWallpaper

copy and paste the following into the text editor


NIMGS=find ~/theme/Wallpapers -iname ‘*.jpg’ -o -iname ‘*.png’ -o -iname ‘*.bmp’ | tr -d ‘ ‘

IMGS=find ~/theme/Wallpapers -iname ‘*.jpg’ -printf “%p#”

RANGE=echo $NIMGS | wc -w


BGNAME=echo $IMGS | cut -d ‘#’ -f $NUMBER

gconftool-2 -t str –set /desktop/gnome/background/picture_filename “$BGNAME”

gconftool-2 -t str –set /desktop/gnome/background/picture_options “stretched”

save and close

chmod +x AutoWallpaper

Now to automate it

crontab -e

copy and paste this into the terminal

30 * * * * /home/USERNAME/theme/AutoWallpaper

ctrl+o to save and ctrl+x to exit (if you are using nano)
!!!make sure you change the USERNAME to your username!!!

Now copy your wallpapers into theme/Wallpapers directory and every 30 minutes the wallpaper should change to a new random wallpaper.

have fun…



Utopia Machine

Enthusiastic highly imaginative senior technologist with creative approaches to solving problems