Ubuntu: Generic Hints Tweaks and Tips

Add / Edit BASH Command Line Aliases For Root And Users
Open a terminal and edit the .bashrc file

nano ~/.bashrc ... alias ll='ls -lah' alias la='ls -A' alias l='ls -CF' alias ping='ping -c3' alias rm='rm -iv'

Reload the file...

source ~/.bashrc

Check...

alias

Change from DHCP to Fixed IP Address
sudo killall dhclient sudo nano /etc/network/interfaces ... auto lo iface lo inlet loopback auto eth0 iface eth0 inet static address 192.168.0.101 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.1

Reboot system

After reboot edit resolv.conf

nameserver 192.168.0.1

Change the Hostname (or what the computer is called)
The name needs to be changed in the 'hostname' and 'hosts' files.

Open a terminal, type:

sudo nano /etc/hostname

Edit the name displayed and required, save changes (CTRL+o) then exit (CTRL+x)

sudo nano /etc/hosts

Edit the system name to match that which was entered in the 'hostname' file, save changes (CTRL+o) then exit (CTRL+x)

Exit the terminal and reboot the system.

Creating a 'Root' (Super User) User Account
Unlike many other Linux distributions Ubuntu does not by default come with a Root (super user) account.

Open a terminal and run the following commands:

sudo -i sudo passwd root

To be able to log in as 'root' via Gnome Display Manager (GDM) run the following in the terminal:

nano /etc/gdm/gdm.conf-custom

Find the section titled [security] and add the line:

AllowRoot=true

Save changes (CTRL+o) then exit (CTRL+x)

Note: If the file you open is completely blank add the [security] line as well.

Close the terminal and restart system

Generate a list of installed packages and use it to reinstall packages
Make the list, open a terminal and run the following commands:

sudo dpkg --get-selections | grep -v deinstall > ubuntu-files

The file 'ubuntu-files' is created in the root directory of your home folder, save it to a safe place like a USB drive.

Install Ubuntu on another PC.

When you have finished and rebooted, run the following commands to update...

sudo apt-get update sudo apt-get dist-upgrade

Now copy that special file from your USB drive to the root directory of your home folder, and run the following commands to set the list of software you wish to install to match the first PC...

dpkg --set-selections < ubuntu-files sudo dselect

Reboot and enjoy the extra time you just saved... :-)

Handy Commands To Run
After a basic install and addition of repositories the following are handy commands to run:

sudo apt-get dist-upgrade sudo apt-get update sudo apt-get upgrade sudo apt-get autoremove

Re-enable Ctrl-Alt-Backspace Disabled By Default In Xorg - 9.04 onwards
In Jaunty the option of Ctrl+Alt+Backspace key combination to force a restart of X is now disabled by default, with the aim of eliminating the problem of accidentally triggering the key combination. The following re-enables the behaviour.

Open a terminal and run the following commands:

dontzap --disable.

Network Card - Reset Naming
After cloning one system to another Ubuntu will see the new PC's network card as 'eth1' as well as retaining the details of the original card. To reset all the network details undertake the following:

Open a terminal, switch to root and run the following commands:

> /etc/udev/rules.d/70-persistent-net.rules reboot

Update Manager - Change the Default Behaviour - 9.04 onwards
In previous versions of Ubuntu the Update Manager has displayed an icon in the notification area when updates are available. In 9.04/Jaunty this has been replaced by the Update Manager opening a window, if you find this an intrusion there are two methods to revert its behaviour.

Method One:

Open a terminal, type:

gconf-editor

This will load up the gconf editor window

Navigate to Apps, Update Notifier. On the right, unchecked the auto_launch box.

Close the window and the terminal

To recover the auto launch pop up function, simply repeat the above step, but place a check in the auto_launch box.

Method Two:

Open a terminal, type:

gconftool -s --type bool /apps/update-notifier/auto_launch false

To recover:

gconftool -s --type bool /apps/update-notifier/auto_launch true