I am currently maintaining this page for Ubuntu 8.04 (Hardy Heron). Older versions are online but are no longer maintained.
The information presented here is for you to use freely but at your own risk.
Much information on this page comes from the following sources:
You can visit my home page to find out how to contact me with feedback and suggestions for this site.
Installing Ubuntu is quicker and easier than ever with Hardy Heron.
| Purpose | Size | Filesystem |
| swap space | 1-2GB | linux-swap |
| root directory (/) | 6-9GB | ReiserFS (or ext3) |
| home directory (/home) | remaining free space | ReiserFS (or ext3) |
sudo apt-get update sudo apt-get upgrade
Uncomplicated Firewall is a simple command-line front-end to Linux's powerful built-in firewall called iptables.
Explanation: Although the Linux kernel has a built-in firewall, it is turned off by default since Ubuntu installs in such a way that no ports are listened to by any program or process. Since nothing is listening to any of the ports, there is no need for a firewall. However, once you enable something like file or printer sharing, remote desktop, etc., processes will start to listen to some of the ports for external connections. You should therefore enable the firewall and create rules to restrict access of the appropriate ports to the IP addresses of the desired set of machines. Iptables is somewhat complicated to configure, so instead Ubuntu allows you to easily create and maintain firewall rules using a simple command-line tool called ufw.
sudo ufw enable sudo ufw default denyImportant: Remember that from this point on, if you want to do anything that requires other computers to connect to yours (e.g., share a file or printer, allow a remote desktop or SSH connection, etc.), you will have to explicitly add a rule to allow such a connection.
sudo ufw allow from 192.168.0.0/16 to any port $PORT
To allow connections on any port from any IP on your private network:
sudo ufw allow from 192.168.0.0/16 to anyHere are some instructions for creating other rules.
Note that installing the nVidia driver will fix some screen resolution problems.
sudo apt-get install nvidia-glx-new sudo nvidia-xconfigNote: If you have a GeForce4 video card, you may need to use nvidia-glx instead of nvidia-glx-new. And if you have a very old card, like a TNT, you may need to use nvidia-glx-legacy instead.
sudo nvidia-xconfig --twinview --enable-all-gpusFinally, exit the root shell by pressing CTRL+D, and choose the Resume normal boot option.
sudo apt-get install nvidia-settings sudo nvidia-settingsYou can change the settings in the X Server Display Configuration section and then click the Save to X Configuration button and save the file as /etc/X11/xorg.conf. The settings will take effect the next time you log in.
Important: This only applies if you had put the /home directory on another partition during a previous installation, and you now want to use that partition's /home directory.
What is /home? The /home directory contains a sub-directory for each desktop user (e.g., /home/john, /home/paul, etc.). Each desktop user's files (documents, music, pictures, desktop folder, user-specific desktop- and application-settings, etc.) all go into his or her sub-directory. Thus, if the /home directory resides on a partition different from the one that Ubuntu is installed in, you can re-install the operating system without worrying about blowing away your users' files so long as you don't touch the partition on which /home resides. This is why, if the /home directory currently resides on the sane partition as the operating system, it is wise to migrate it to another partition. In order to perform such a migration, you must first copy the /home directory to the new partition, and then you must switch to the /home on that partition.
su $CURRENT_USERNAME cd /media/$PARTITION/home sudo mv $OLD_USERNAME $USER sudo chown -r $USER:$USER $USER exitwhere
su $CURRENT_USERNAME
mkdir /media/$USER/old_config_files
mv /media/$USER/.* /media/$USER/old_config_files/
cp -pr ~/.* /media/$USER/
exit
where
sudo cp /etc/fstab /etc/fstab.backup sudo nano /etc/fstabChange
# /dev/$PARTITION UUID=... /media/$PARTITION ...to
# /dev/$PARTITION
UUID=... /home ...
where
Important: These instructions describe only how to backup the /home directory to another drive/partition. If you want to then use that resulting /home directory, you will need to subsequently switch to that /home directory.
What is /home? The /home directory contains a sub-directory for each desktop user (e.g., /home/john, /home/paul, etc.). Each desktop user's files (documents, music, pictures, desktop folder, user-specific desktop- and application-settings, etc.) all go into his or her sub-directory. Thus, if the /home directory resides on a partition different from the one that Ubuntu is installed in, you can re-install the operating system without worrying about blowing away your users' files so long as you don't touch the partition on which /home resides. This is why, if the /home directory currently resides on the sane partition as the operating system, it is wise to migrate it to another partition. In order to perform such a migration, you must first copy the /home directory to the new partition, and then you must switch to the /home directory on that partition.
sudo cp -pr /home/* /media/$PARTITION/
where
gconftool --type string --set /desktop/gnome/font_rendering/hinting "slight"This will fix many fonts, such as Nimbus Roman, Norasi, etc. Note that the DejaVu and Bitstream Vera fonts will look a little "heavier", but that's actually the way they're supposed to look. In Firefox, the settings will take effect the next time you restart it.
sudo apt-get install tango-icon-theme-common openoffice.org-style-tango gconftool --type string --set /desktop/gnome/interface/icon_theme "Tango"
sudo apt-get install ttf-liberationIf you can't do without Windows fonts, install the Microsoft core fonts.
sudo apt-get install msttcorefonts
Quick explanation: In order to associate an application (e.g., gThumb Image Viewer) with a file-type (e.g., PNG image files), the application needs to have a "desktop entry" (e.g., gthumb.desktop) located in the /usr/share/applications/ directory. Furthermore, the file-type needs to have a mime-type located in the /usr/share/mime/ directory (e.g., /usr/share/mime/images/png.xml). Finally, there should be a line in the ~/.local/share/applications/mimeapps.list file that associates the desktop entry with the mime-type (e.g., images/png=gthumb.desktop).
cp ~/.local/share/applications/mimeapps.list ~/.local/share/applications/mimeapps.list.backup gedit ~/.local/share/applications/mimeapps.listAdd/change appropriate line to:
[Added Associations] $MIME_TYPE=$NEW_APP.desktop;To figure out what $NEW_APP should be (if necessary):
ls /usr/share/applications/*.desktop | sed -e "s@/usr/share/applications/@@g" | lessTo figure out what $MIME_TYPE should be (if necessary):
find /usr/share/mime/ -mindepth 2 -maxdepth 2 -name "*" | sed -e "s@/usr/share/mime/@@g" -e "s@[.]xml@@g" | less
killall nautilus
gksudo network-adminSelect the General tab, and change the hostname as desired.
Firefox is Ubuntu's default browser. Here are some useful customizations.
sudo apt-get install sun-java6-plugin flashplugin-nonfreeRestart Firefox for the plugins to take effect.
wget -c -P /tmp/ http://download.macromedia.com/pub/labs/flashplayer10/flashplayer10_install_linux_070208.tar.gz pushd /tmp; tar -xzvf flashplayer10_install_linux_*.tar.gz; popd mkdir -p ~/.mozilla/plugins cp /tmp/install_flash_player_9_linux/libflashplayer.so ~/.mozilla/plugins/Restart Firefox for the plugin to take effect.
general.autoScroll=true network.http.pipelining=true network.http.proxy.pipelining=true network.prefetch-next=false browser.backspace_action=0 browser.link.open_newwindow=3 (3: new tab; 2: new indow; 1: current tab) browser.link.open_newwindow.restriction=2 (0: use open_newwindow setting; 1: new window; 2: use open_newwindow setting unless javascript specifies window size) browser.search.openintab=true browser.tabs.autoHide=false browser.tabs.closeButtons=3 browser.tabs.loadFolderAndReplace=false browser.tabs.loadGroup=0 [seems to have vanished in Firefox 3.0] browser.tabs.warnOnClose=false linkification.settings.Linkify_OpenInTab=true (if you have the Linkification extension) linkification.settings.Linkify_OpenTabinBG=true (if you have the Linkification extension) linkification.settings.Linkify_Toggle=false (if you have the Linkification extension)
sudo apt-get install fastjar pushd /tmp; fastjar -xf /usr/lib/firefox-3.0/chrome/browser.jar content/browser/browser.js; popd sed -i -e"s/if (aTriggeringEvent \&\& aTriggeringEvent.altKey)/if (!(aTriggeringEvent \&\& aTriggeringEvent.altKey))/" /tmp/content/browser/browser.js sudo fastjar -uf0 /usr/lib/firefox-3.0/chrome/browser.jar -C/tmp content/browser/browser.js
Thunderbird is a fast and polished email client.
sudo apt-get install thunderbirdYou can run Thunderbird from the Applications > Internet menu.
gconftool --type string --set /desktop/gnome/url-handlers/mailto/command "thunderbird %s"
mailnews.default_news_sort_order=2 mailnews.default_sort_order=2
Pidgin is an IM client that comes pre-installed on Ubuntu. Here are some useful customizations.
cp /usr/share/applications/pidgin.desktop ~/.config/autostart/Alternatively, you can go to the System > Preferences > Sessions menu, click on the Startup Programs tab, and an entry with name "Pidgin" and command pidgin.
sudo apt-get install pidgin-extprefsNow run Pidgin, press CTRL+U to go to the Plugins window, turn on the Extended Preferences plugin, click on Configure Plugin, and turn on the Hide Buddy List at startup option.
sudo apt-get install pidgin-otrNow run Pidgin, press CTRL+U to go to the Plugins window, and turn on the Off-the-Record Messaging plugin.
sudo apt-get install libqt4-gui wget -c -O /tmp/skype.deb http://www.skype.com/go/getskype-linux-ubuntu sudo dpkg -i /tmp/skype.debYou can access Skype from the Applications > Internet menu.
cp /usr/share/applications/skype.desktop ~/.config/autostart/Alternatively, you can go to the System > Preferences > Sessions menu, click on the Startup Programs tab, and an entry with name "Skype" and command skype.
Ekiga is a VoIP/video-conferencing client that comes installed with Ubuntu.
Totem is a great media player that comes installed by default. With the setup described below (using the xine back-end), it can play CDs, DVDs, and almost any media file.
gconftool --type string --set /desktop/gnome/applications/media/exec "totem"
cp /usr/share/applications/totem.desktop ~/.local/share/applications/totem-enqueue.desktop nano ~/.local/share/applications/totem-enqueue.desktopChange the following lines
Name=Movie Player ... Exec=totem %U ...to
Name=Movie Player (Enqueued) ... Exec=totem --enqueue %U NoDisplay=true ...Save and close the file.
nano ~/.local/share/applications/mimeapps.listAdd the following lines.
[Added Associations] application/ogg=totem.desktop;totem-enqueue.desktop; application/vnd.rn-realmedia=totem.desktop;totem-enqueue.desktop; application/x-extension-m4a=totem.desktop;totem-enqueue.desktop; application/x-extension-mp4=totem.desktop;totem-enqueue.desktop; application/x-flac=totem.desktop;totem-enqueue.desktop; application/x-flash-video=totem.desktop;totem-enqueue.desktop; application/x-matroska=totem.desktop;totem-enqueue.desktop; application/x-ogg=totem.desktop;totem-enqueue.desktop; application/x-shockwave-flash=totem.desktop;totem-enqueue.desktop; audio/mpeg=totem.desktop;totem-enqueue.desktop; audio/mpegurl=totem.desktop;totem-enqueue.desktop; audio/vnd.rn-realaudio=totem.desktop;totem-enqueue.desktop; audio/x-flac=totem.desktop;totem-enqueue.desktop; audio/x-m4a=totem.desktop;totem-enqueue.desktop; audio/x-mod=totem.desktop;totem-enqueue.desktop; audio/x-mp3=totem.desktop;totem-enqueue.desktop; audio/x-mpeg=totem.desktop;totem-enqueue.desktop; audio/x-mpegurl=totem.desktop;totem-enqueue.desktop; audio/x-ms-asf=totem.desktop;totem-enqueue.desktop; audio/x-ms-asx=totem.desktop;totem-enqueue.desktop; audio/x-ms-wax=totem.desktop;totem-enqueue.desktop; audio/x-ms-wma=totem.desktop;totem-enqueue.desktop; audio/x-pn-aiff=totem.desktop;totem-enqueue.desktop; audio/x-pn-au=totem.desktop;totem-enqueue.desktop; audio/x-pn-realaudio-plugin=totem.desktop;totem-enqueue.desktop; audio/x-pn-realaudio=totem.desktop;totem-enqueue.desktop; audio/x-pn-wav=totem.desktop;totem-enqueue.desktop; audio/x-pn-windows-acm=totem.desktop;totem-enqueue.desktop; audio/x-real-audio=totem.desktop;totem-enqueue.desktop; audio/x-s3m=totem.desktop;totem-enqueue.desktop; audio/x-vorbis+ogg=totem.desktop;totem-enqueue.desktop; audio/x-wav=totem.desktop;totem-enqueue.desktop; audio/x-xm=totem.desktop;totem-enqueue.desktop; image/vnd.rn-realpix=totem.desktop;totem-enqueue.desktop; misc/ultravox=totem.desktop;totem-enqueue.desktop; video/dv=totem.desktop;totem-enqueue.desktop; video/mp4=totem.desktop;totem-enqueue.desktop; video/mpeg=totem.desktop;totem-enqueue.desktop; video/msvideo=totem.desktop;totem-enqueue.desktop; video/quicktime=totem.desktop;totem-enqueue.desktop; video/vnd.rn-realvideo=totem.desktop;totem-enqueue.desktop; video/x-anim=totem.desktop;totem-enqueue.desktop; video/x-avi=totem.desktop;totem-enqueue.desktop; video/x-flc=totem.desktop;totem-enqueue.desktop; video/x-fli=totem.desktop;totem-enqueue.desktop; video/x-mpeg=totem.desktop;totem-enqueue.desktop; video/x-ms-asf=totem.desktop;totem-enqueue.desktop; video/x-msvideo=totem.desktop;totem-enqueue.desktop; video/x-ms-wmv=totem.desktop;totem-enqueue.desktop; video/x-nsv=totem.desktop;totem-enqueue.desktop; video/x-theora+ogg=totem.desktop;totem-enqueue.desktop; x-content/audio-cdda=totem.desktop x-content/audio-dvd=totem-xine.desktop x-content/audio-player=totem.desktop x-content/video-dvd=totem-xine.desktop x-content/video-vcd=totem-xine.desktop x-content/video-svcd=totem-xine.desktop x-content/video-blueray=totem-xine.desktop x-content/video-hddvd=totem-xine.desktop application/x-cd-image=totem.desktop;totem-enqueue.desktop;totem-xine.desktop;Save and close the file, and then restart Nautilus.
killall nautilus
Totem-xine combines the excellent Totem player front-end with the powerful xine back-end to play almost any media format.
sudo apt-get install totem-xine libxine1-plugins
wget -c -P /tmp/ http://debian-multimedia.org/pool/main/w/w32codecs/w32codecs_20071007-0.1_i386.deb wget -c -P /tmp/ http://debian-multimedia.org/pool/main/libd/libdvdcss/libdvdcss2_1.2.9-0.0_i386.deb sudo dpkg -i /tmp/w32codecs*.deb /tmp/libdvdcss2*.deb sudo apt-get -f install
sudo update-alternatives --config totemand enter the number corresponding to /usr/bin/totem-xine.
sudo update-alternatives --config gnome-video-thumbnailerand enter the number corresponding to /usr/bin/totem-xine-video-thumbnailer.
Totem-GStreamer combines the excellent Totem player front-end with the extensible GStreamer back-end.
sudo apt-get install totem-gstreamer gstreamer0.10-ffmpeg gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse
sudo update-alternatives --config totemand enter the number corresponding to /usr/bin/totem-gstreamer.
sudo update-alternatives --config gnome-video-thumbnailerand enter the number corresponding to /usr/bin/totem-gstreamer-video-thumbnailer.
MPlayer is a very powerful media player with a rubbish interface! It's handy for that rare case when Totem-xine can't play something.
sudo apt-get install gnome-mplayer sudo sed -i.backup -e's@gmplayer@mplayer@g' /usr/share/applications/mplayer.desktop sudo sed -i.backup -e's@vo=x11,@vo=xv,@g' /etc/mplayer/mplayer.conf
sudo apt-get install mozilla-mplayer
WildMidi is a much faster sequencer than TiMidity.
sudo apt-get install wildmidi freepats
wildmidi $MIDI_FILE
wget -c -P /tmp/ http://www.fbriere.net/debian/dists/stable/misc/deb/eawpatches_12-1~fbriere.4_all.deb sudo dpkg -i /tmp/eawpatches_12-1~fbriere.4_all.deb sudo cp /etc/wildmidi/wildmidi.cfg /etc/wildmidi/wildmidi.cfg.backup echo "dir /usr/share/midi/eawpatches" | sudo tee /etc/wildmidi/wildmidi.cfg cat /etc/timidity/eawpatches/gravis.cf /etc/timidity/eawpatches/gsdrums.cfg /etc/timidity/eawpatches/gssfx.cfg /etc/timidity/eawpatches/xgmap2.cfg | sudo tee -a /etc/wildmidi/wildmidi.cfg
TiMidity++ is a software MIDI synthesizer. See also the MIDI Software Synthesis How-To.
sudo apt-get install timidity freepats
timidity -iA -B2,8 -Os1l -s 44100Play MIDI on an available port:
aplaymidi -p $MIDI_PORT $MIDI_FILEYou can see the list of available MIDI ports as follows:
aplaymidi -l
wget -c -P /tmp/ http://www.fbriere.net/debian/dists/stable/misc/deb/eawpatches_12-1~fbriere.4_all.deb sudo dpkg -i /tmp/eawpatches_12-1~fbriere.4_all.deb sudo gedit /etc/timidity/timidity.cfgChange:
source /etc/timidity/freepats.cfgto:
source /etc/timidity/eawpatches.cfg
sudo gedit /etc/timidity/timidity.cfgAdd:
opt EFresamp=d #disable resampling (or "opt EFresamp=l" for linear resampling) opt EFvlpf=d #disable VLPF opt EFreverb=d #disable reverb opt EFchorus=d #disable chorus opt EFdelay=d #disable delaySave and close the file.
FluidSynth is a software MIDI synthesizer.
sudo apt-get install fluidsynth fluidsynth-soundfont-gm
fluidsynth -m alsa_seq /usr/share/sounds/sf2/FluidR3_GM.sf2Play MIDI on the appropriate port (e.g., 128:0):
aplaymidi -p 128:0 $MIDI_FILE
Audacity is a powerful audio editor with a fugly interface.
sudo apt-get install audacityYou can find Audacity in the Applications > Sound & Video menu.
GIMP is Ubuntu's default raster editor and acts as a reasonable replacement for Adobe Photoshop.
Inkscape is a vector graphics editor.
sudo apt-get install inkscapeYou can find Inkscape in the Applications > Graphics menu.
Blender is an open-source 3D modeler and animation editor.
sudo apt-get install blenderYou can find Blender in the Applications > Graphics menu.
Brasero is the CD/DVD burning utility that comes with the default installation of Ubuntu.
sudo apt-get install gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-ffmpeg
nano ~/.local/share/applications/mimeapps.listAppend the following lines.
[Added Associations] x-content/blank-bd=brasero.desktop; x-content/blank-cd=brasero.desktop; x-content/blank-dvd=brasero.desktop; x-content/blank-hddvd=brasero.desktop;Save and close the file, and then restart Nautilus.
killall nautilus
SoundConverter can convert between various audio formats like Ogg/Vorbis, MP3, FLAC, and WAV.
sudo apt-get install soundconverter gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-ffmpeg gstreamer0.10-plugins-badYou can run SoundConverter from the Applications > Sound & Video menu.
MEncoder is a command-line tool to encode and decode videos.
sudo apt-get install mencoder
Rosegarden is a musical sequencer and score editor.
sudo apt-get install rosegarden
GParted is a disk partition editor with which you can create, delete, and resize partitions.
sudo apt-get install gpartedYou can find GParted in the System > Administration menu under the name of Partition Editor.
FSlint is a great tool for maintaining a clean and tidy file system. It can locate files that have duplicate content, empty directories, large packages, etc.
sudo apt-get install fslintYou can find FSlint in the Applications > System Tools menu.
gvim is my favorite plain-text editor.
sudo apt-get install vim-gnome
nano ~/.local/share/applications/mimeapps.listAdd the following lines.
[Added Associations] text/plain=gvim.desktop; text/html=gvim.desktop; text/css=gvim.desktop; text/xml=gvim.desktop; text/x-chdr=gvim.desktop; text/x-csrc=gvim.desktop; text/x-csharp=gvim.desktop; text/x-c++hdr=gvim.desktop; text/x-c++src=gvim.desktop; text/x-csharp=gvim.desktop; text/x-tex=gvim.desktop; text/x-java=gvim.desktop; text/x-dtd=gvim.desktop; text/x-bibtex=gvim.desktop; text/x-tex=gvim.desktop; text/x-readme=gvim.desktop;Save and close the file, and then restart Nautilus.
killall nautilus
sudo update-alternatives --config editorand select your choice.
TeX Live allows you to compile LaTeX files.
sudo apt-get install texlive texlive-latex-extra texlive-math-extra texlive-pstricks texlive-science latex-beamer
Octave is an open-source Matlab replacement.
sudo apt-get install octave
Maxima is a computer algebra system similar to Maple and Matlab although not as sophisticated.
sudo apt-get install wxmaxima
gnuplot is a tool for plotting and graphing data.
sudo apt-get install gnuplot
Dia is a diagram editor useful for drawing circuits, flowcharts, and various other technical diagrams.
sudo apt-get install dia-gnomeYou can find Dia in the Applications > Graphics menu.
sudo apt-get install build-essential
sudo apt-get install nvidia-glx-new-dev libglew1.4-dev libsdl1.2-dev libsdl-ttf2.0-dev libsdl-image1.2-dev libsdl-mixer1.2-dev
CVS is a version control system.
sudo apt-get install cvs
sudo apt-get install meld
sudo apt-get install tkcvs
Subversion is a version control system.
sudo apt-get install subversion
mkdir $SVN_DIR
Typically, use /home/$USER/svn as $SVN_DIR.
svnadmin create $SVN_DIR/$PROJECTwhere $PROJECT is your project name
nano $SVN_DIR/$PROJECT/conf/svnserve.confAdd the following lines:
[general] #section heading anon-access = none # turn off anonymous access
svn import /path/to/original/content/ file://$SVN_DIR/$PROJECT[/deeper]
svn checkout svn+ssh://$SVN_SERVER/$SVN_DIR/$PROJECT[/deeper/]
svn update/commit/add/remove/rename/revert [filenames]
sudo apt-get install meld
Eclipse is an open-source integrated development environment for Java, C, C++, and Python.
sudo apt-get install eclipse eclipse-cdt eclipse-pydevYou can find Eclipse in the Applications > Programming menu.
OpenSSH server allows you to securely access your computer from another computer via the SSH protocol.
sudo apt-get install openssh-server
sudo nano /etc/ssh/sshd_configAdd the following line:
AllowUsers $USER_1 $USER_2 ... $USER_Nwhere $USER_1, $USER_2, ..., $USER_N are the users you want to allow (all other users will be disallowed SSH access).
sudo /etc/init.d/ssh restart
sudo ufw allow proto tcp from 192.168.0.0/16 to any port 22
If you have a dynamic IP address, it can be difficult to access your computer over the Internet (e.g., via an SSH) over an extended period of time because the IP address keeps changing. An elegant solution is to use a free service called DynDNS to create a hostname (e.g., name.dyndns.org) with which you can access your computer over the Internet so long as you keep DynDNS updated with your current IP address. We will use a script called ipcheck to automatically update DynDNS with your IP address.
sudo apt-get install ipcheck
sudo mkdir /root/ipcheck
sudo nano /root/ipcheck/dyndns_accountEnter your DynDNS account information into the file as below:
$DYNDNS_USERNAME $DYNDNS_PASSWORD $HOSTNAME.$DOMAINSave and close the file. Here, $DYNDNS_USERNAME and $DYNDNS_PASSWORD are your DynDNS account username and password. $HOSTNAME is the hostname you chose, and $DOMAIN is the domain you selected (e.g., dyndns.org, podzone.org, etc.).
sudo chmod o-r /root/ipcheck/dyndns_account
sudo nano /root/ipcheck/dyndns_update.shEnter the following code into the script file:
#!/bin/sh cd /root/ipcheck/ if [ -f ipcheck.dat ]; then /usr/sbin/ipcheck -l -r checkip.dyndns.org:8245 --acctfile dyndns_account else /usr/sbin/ipcheck --makedat -l -r checkip.dyndns.org:8245 --acctfile dyndns_account fiSave and close the file. When called, this script will get the current IP address (using a free service provided by DynDNS). Then, if the IP address changed, the script will update DynDNS with the new address.
sudo chmod +x /root/ipcheck/dyndns_update.sh
sudo crontab -eAppend the following line to the list of crontab tasks in order to schedule our script to run every 10 minutes:
*/10 * * * * test -x /root/ipcheck/dyndns_update.sh && /root/ipcheck/dyndns_update.sh > /dev/nullSave and close the file.
sudo mount /dev/$DEVICE $MOUNT_DIR -t reiserfs -o notailwhere
sudo fdisk -l
sudo mount /dev/$DEVICE $MOUNT_DIR -t ext3
sudo mount /dev/$DEVICE $MOUNT_DIR -t ntfs -o nls=utf8
sudo mount /dev/$DEVICE $MOUNT_DIR -t vfat -o iocharset=utf8
sudo mount /dev/$DEVICE $MOUNT_DIR -t iso9660 -o unhide,ro
sudo modprobe loop sudo mount $ISO_FILE $MOUNT_DIR -t iso9660 -o loop,unhide,ro
sudo umount $MOUNT_DIR
sudo umount -l $MOUNT_DIR
An ISO image file is a file that stores the complete contents of a disk or directory.
INFO=$(isoinfo -d -i /dev/$DEVICE) && echo "$INFO" && dd if=$DEVICE of=$ISO_FILENAME bs=$(echo "$INFO" | grep "^Logical block size is:" | cut -d " " -f 5) count=$(echo "$INFO" | grep "^Volume size is:" | cut -d " " -f 4) conv=notrunc,noerror,syncwhere
sudo umount -l /dev/$DEVICE eject /dev/$DEVICE sudo mount /dev/$DEVICEIf the disk is an audio or video disk, try playing it with Totem or MPlayer first.
mkisofs -o $ISO_FILENAME.iso $DIRECTORY
An MD5 checksum of a file is a tiny fingerprint that can be used to verify (with high probability) the correctness of the contents of the file.
md5sum $FILE > $FILE.md5
md5sum -c $FILE.md5
tar -cvzf $ARCHIVE_NAME.tar.gz $FILE_OR_DIRECTORY
tar -xvzf $ARCHIVE_NAME.tar.gz
gpg -c $FILE
You will be asked to enter (and re-enter) a password which will used to create the encrypted file called $FILE.gpg
gpg $FILE.gpg
find $DIR -name "$PATTERN" -okdir rm {} \;
find $DIR -mindepth 1 -maxdepth 1 -regextype posix-extended \ -regex '(.*/)([^/]*($REGEXP1)+[^/]*)' \ -execdir bash -c 'mv "$0" "$(echo "$0" | sed -e"s@$REGEXP1@$REGEXP2@g")"' '{}' \;
find $DIR -mindepth 1 -maxdepth 1 -regextype posix-extended \ -regex '(.*/)([^/]*(([A-Z][^/]*($REGEXP))|(($REGEXP)[^/]*[A-Z]))+[^/]*)' \ -execdir bash -c 'mv "$0" "$(echo "$0" | sed -e"y@ABCDEFGHIJKLMNOPQRSTUVWXYZ@abcdefghijklmnopqrstuvwxyz@")"' '{}' \;
ssh -fN -L $LOCAL_PORT:$SERVER:22 $BASTION ssh localhost:$LOCAL_PORTwhere
Quick explanation: Public key authentication works as follows. First you create a public key and a private key. Think of the public key as being a lock which only opens with the private key. The private key should reside only on your local machine and is stored in encrypted form using a passphrase that you choose when you first create the key. Never send your private key to anyone. The public key is copied to the various systems that you want to access. Once the public key is installed on another system, you can access that system using your private key as authentication. This authentication is done automatically and there is no need for a password entry. You do however need to enter your passphrase in order to decrypt the private key on your local machine in the first place, but you can do this just once per session on your local machine (e.g., when you first log in to your local machine). This will store the decrypted private key in memory until you log out or until you manually tell the local machine to forget the decrypted private key.
ssh-keygen -f ~/.ssh/$KEYFILE -t dsa
I highly recommend using a non-empty passphrase; you can later set up key management so that you only enter your passphrase once per session.
You will now have two files in your ~/.ssh folder:
ssh -i $KEYFILE $SERVERAlternatively, you can add the following line to the appropriate host entry in your ~/.ssh/config file:
IdentityFile ~/.ssh/$KEYFILE
and then ssh to that host as usual without having to use the -i $KEYFILE command line option.
cp ~/.ssh/known_hosts ~/.ssh/known_hosts.backup
ssh -fN $BASTION
ssh-keyscan -H -t rsa,dsa -p 2001 localhost >> ~/.ssh/known_hosts
ssh-keyscan -H -t rsa,dsa -p 2002 localhost >> ~/.ssh/known_hosts
ssh-keyscan -H -t rsa,dsa -p ... localhost >> ~/.ssh/known_hosts
where
The following allows you to set things up so that you only have to enter your SSH key passphrase once per login session.
ssh-add(You will be prompted for your passphrase.)
ssh-add -D
NOTE: This assumes that you use GRUB to dual boot and that you do not use dmraid.
WARNING: In Edgy, after performing the steps below, I ran into GRUB "Error 18: Selected cylinder exceeds maximum supported by BIOS" and could not boot into Ubuntu. To solve this, I had to boot into Ubuntu recovery mode, and then edit /boot/grub/menu.lst and comment out the savedefault line in the Ubuntu stanza. You probably can't do this remotely once you run into this error (since the computer requires a physical CTRL+ALT+DEL to reboot after encountering the error), so make sure to comment out the savedefault before you perform a remote grub-reboot.
sudo nano /boot/grub/menu.lstChange:
default 0to:
default savedSave and close the file by hitting CTRL+O and then CTRL+X.
sudo grub-reboot $NUMBER
where $NUMBER is the number of lines that show up in your GRUB menu before the "Windows" line (typically 4, 6, or 8).
(Don't include the "Windows" line into your count, but do include the "Other operating systems:" line.)
For example, $NUMBER is 4 in this screenshot because there are four lines above the "Windows" option.
NOTE: this assumes that you use GRUB to dual boot, and that Ubuntu is the first boot option in /boot/grub/menu.lst.
shutdown /r /t 00
gconftool --type boolean --set /desktop/gnome/remote_access/local_only true gconftool --type boolean --set /desktop/gnome/remote_access/prompt_enabled false gconftool --type boolean --set /desktop/gnome/remote_access/view_only false gconftool --type boolean --set /desktop/gnome/remote_access/lock_screen_on_disconnect true gconftool --type boolean --set /desktop/gnome/remote_access/enabled true
gconftool --type boolean --set /desktop/gnome/remote_access/enabled false
ssh -fN -L 5903:[::1]:5900 $SERVER
Note that the "::1" in the above line is the IPv6 name for localhost.
vinagre localhost:5903
Note: The remote machine must be booted into Windows XP, so you may have to reboot remotely from Ubuntu to Windows first.
rdesktop -r disk:sync=/home/$USER/$SYNC_DIR $SERVER:3389where
ssh -fN -L $LOCAL_PORT:$SERVER:3389 $BASTION rdesktop -r disk:sync=/home/$USER/$SYNC_DIR localhost:$LOCAL_PORTwhere
SFTP is a secure protocol for file transfer using SSH.
sftp://$SERVER
where
sftp://$SERVER/$DIR
Samba allows you to share files and printers with both Windows and Ubuntu computers. Note that SFTP is a more secure method for sharing files.
sudo apt-get install samba libpam-smbpassThen log out and log back in. (You'll get a permissions error if you try to share a folder in the same login session that you installed Samba.)
sudo ufw allow from 192.168.0.0/16 to any port 137 sudo ufw allow from 192.168.0.0/16 to any port 138 sudo ufw allow from 192.168.0.0/16 to any port 139 sudo ufw allow from 192.168.0.0/16 to any port 445
smb://$SERVER
where
\\$SERVER
where
sudo ufw allow from 192.168.0.0/16 to any port 631
http://$SERVER:631/printers/$PRINTERwhere $SERVER is the server hostname or IP address and $PRINTER is the printer name on the server, and then click Forward and follow the remaining steps as you would for local printer setup. You can see the names of all the printers shared by a server by visiting the following URL in your web browser:
http://$SERVER:631/printers
where $SERVER is the server hostname or IP address.
See https://wiki.ubuntu.com/FixVideoResolutionHowto for more information. The following worked for me:
sudo ddcprobe | grep monitorrangeThe first two values returned are your HorizSync rates, the second pair is your VertRefresh values.
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup.sync_and_refresh sudo gedit /etc/X11/xorg.confFind the following section and make sure the HorizSync and VertRefresh lines exist and have the appropriate values (e.g., 30-96 and 50-160):
Section "Monitor"
...
HorizSync 30-96
VertRefresh 50-160
EndSection
cp ~/.xine/catalog.cache ~/.xine/catalog.cache.backup gedit ~/.xine/catalog.cacheFind the following section:
[/usr/lib/xine/plugins/1.0.0/xineplug_decode_w32dll.so] size=173768 mtime=1112804124 type=131 api=15 id=win32a version=10000 supported_types=50593792 52428800 52822016 ... (long line truncated) decoder_priority=1Replace (in this section only):
decoder_priority=1With:
decoder_priority=7
sudo gedit /etc/fstabFind the line corresponding to the FAT32 partition giving you the warning:
... vfat ... 0 1and change the last number from 1 to 0.
sudo /etc/init.d/gdm restart
sudo grubAt the GRUB command prompt, run the following commands:
find /boot/grub/stage1You should see something like (hdX,Y) where X and Y will be numbers, e.g., (hd0, 1).
root (hdX,Y)where X and Y above should be replaced by the appropriate numbers returned in step 1.
setup (hdX)
where X above should be replaced by the appropriate number returned in step 1.
quit
Wine is a Windows compatibility layer that allows you to run Windows applications directly in Linux.
wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add - sudo wget http://wine.budgetdedicated.com/apt/sources.list.d/hardy.list -O /etc/apt/sources.list.d/winehq.list sudo apt-get updateDoing the above will allow you to stay updated with the latest Wine version which comes out about every two weeks. Of course, you can choose not to do the above and stick with Ubuntu's own Wine package which is updated much less frequently.
sudo apt-get install wine
wine $WINDOWS_EXECUTABLE_FILE
I have an old Lexmark Z23 printer, and it takes a little extra work to get it running.
sudo apt-get install alien libstdc++5 wget -c -P /tmp/ http://www.downloaddelivery.com/srfilecache/CJLZ35LE-CUPS-2.0-1.TAR.GZ pushd /tmp tar -xvzf CJLZ35LE-CUPS-2.0-1.TAR.GZ tail -n +143 lexmarkz35-CUPS-2.0-1.gz.sh > install.tar.gz tar -xvzf install.tar.gz sudo alien --to-deb *.rpm sudo dpkg -i *.deb sudo ldconfig popd cd /usr/share/cups/model sudo gunzip Lexmark-Z35-lxz35cj-cups.ppd.gz sudo /etc/init.d/cupsys restart
gksudo /usr/bin/system-config-printerand then click the New Printer button.
http://$SERVER:631/printers/$PRINTERwhere $SERVER is the server hostname or IP address and $PRINTER is the printer name on the server, and then click Forward. You can find the names of the shared printer on a server by visiting the following URL in your web browser:
http://$SERVER:631/printers
where $SERVER is the server hostname or IP address.
You might have noticed that, upon installation, Ubuntu automatically created folders in your home directory called Desktop, Documents, Music, Pictures, Videos, and Templates. The instructions presented here allow you to change these defaults to use different directories for your desktop, documents, music, etc. This is useful if, for example, you like your directories to be lower-case (e.g., ~/desktop instead of ~/Desktop), or if you want a slightly different organization for your directories (e.g., ~/ instead of ~/Documents).
gedit ~/.config/user-dirs.dirsFor example, to set the default music directory to ~/audio/music instead of ~/Music, use the following line:
XDG_MUSIC_DIR="$HOME/audio/music"
gedit ~/.gtk-bookmarksFor example, to add a bookmark named "Music" pointing to /home/user/audio/music, use the following line:
file:///home/user/audio/music Music
I find this method faster and more reliable than using Samba.
ssh -fN herakles sftp lion
sftp://lion/home/$USER_NAME
Windows home directory:
sftp://lion/home/WIN/$USER_NAME
Linux Bigbox directory:
sftp://lion/home/BIGBOX/$USER_NAME
Windows Bigbox directory:
sftp://lion/home/BIGBOX.win/$USER_NAME
\\cucs\home\UNIX\$USER_NAME
Windows home directory:
\\cucs\home\Windows\$USER_NAME
Windows Bigbox directory:
\\cs.cornell.edu\home\bigbox\$USER_NAME
Suppose you can't directly SSH from a client to a server (for example, if the server is behind a router for which SSH port forwarding is not set up). Nevertheless, if both the client and the server can SSH to a middle host, then we can set up a reverse tunnel via middle host through which the client can connect to the server.
ssh -R $MIDDLE_LOCAL_PORT:localhost:$SERVER_SSH_PORT $MIDDLE_HOSTwhere
ssh -fN -L $CLIENT_LOCAL_PORT:localhost:$MIDDLE_LOCAL_PORT $MIDDLE_HOST ssh -p $CLIENT_LOCAL_PORT localhostwhere