Ubuntu: Generic Hints Tweaks and Tips

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.

Command Line Aliases For Root And Users - Add / Edit BASH
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

DVD Menu Navigation
To fully enable DVD Menu support open a terminal and type:

sudo /usr/share/doc/libdvdread4/install-css.sh

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

Icons: Enable on System Menu - 9.10 and on
 Method One 

By default in Karmic Koala the icons on the System menu are by default disabled (!), to re-enable them:

System --> Preferences --> Appearance --> Interface (tab)

Find and tick 'Show icons in menu'

 Method Two 

Open a terminal

gconftool-2 --set /desktop/gnome/interface/buttons_have_icons --type bool true gconftool-2 --set /desktop/gnome/interface/menus_have_icons --type bool true

Login Sound - Disable
 Method One 

Open a terminal, type:

sudo -u gdm gconftool-2 --set /desktop/gnome/sound/event_sounds --type bool false

 Method Two 

System --> Preferences --> Startup Applications --> Startup Programs (tab)

Find and untick 'GNOME Login Sound' entry

Re-enable Ctrl-Alt-Backspace Disabled By Default In Xorg - 9.04 onwards
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.

System -> Preferences -> Keyboard --> Layouts (tab)

Click the 'Layout Options' button

Click on "Key sequence to kill the X server" option to expand it

Tick the check box to enable

Root (Super) User Account - How To Create
Unlike many other Linux distributions Ubuntu does not by default come with a Root (super user) account.

Open a terminal, type:

sudo -i sudo passwd root nano /etc/gdm/gdm.conf-custom

Add the lines:

[security] AllowRoot=true

Save changes (CTRL+o) press enter, 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

Root User - How To Switch To
Open a terminal, type:

sudo su - root

Enter the password for the user profile you are in.

Network Card - Change From DHCP to Fixed IP Address
Open a terminal

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

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

Upgrade Items - The following packages have been kept back
When trying to upgrade the system via the terminal you may receive a message similar to the one below:

Reading package lists... Done Building dependency tree Reading state information... Done The following packages have been kept back: banshee banshee-extension-mirage 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

To force the upgrade of the packages that have been held back run the following:

sudo aptitude safe-upgrade

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:

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

To revert open a terminal, type:

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

Method Two:

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 revert the behaviour simply repeat the above step, but place a check in the auto_launch box.

Stop CDROM Auto Close
Quick fix...

sudo sysctl -w dev.cdrom.autoclose=0

...and to survive a reboot...

nano /etc/sysctl.d/60-cdrom-autoclose.conf dev.cdrom.autoclose = 0
 * 1) do not autoclose cdrom

To Find The Version Of A Piece Of Software
Open a terminal, type:

apt-cache showpkg 

Replace  with the name of the package you are investigating, for example to find the version of OpenVPN:

apt-cache showpkg openvpn

Move Window Buttons Back to the Right in Ubuntu 10.04
http://www.howtogeek.com/howto/13535/move-window-buttons-back-to-the-right-in-ubuntu-10.04/