Ubuntu: Generic Hints Tweaks and Tips

HOWTO: Find All Packages Installed
aptitude search '~i!~M'

HOWTO: Find A Package Installed
aptitude search pulseaudio | grep ^i

HOWTO: Take A Video Capture Of Your Desktop
ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 -flags gray /tmp/outputFile.mpg

HOWTO: FIX: Tearing Picture In VLC Videos
vlc Tools > Preferences > Video > Accelerated Video Output (Overlay) Save

HOWTO: FIX: No Sound In Youtube Videos With S/PDIF Digital Audio
This fix follows on from the fix below on AC3 Audio.

If you have no sound in videos on youtube, then make sure that your Digital Card is the default sink for PulseAudio.

pacmd list-sinks pacmd set-default-sink 2

To check...

paman

This should show 'Default Sink' as 'SPDIF'

pavucontrol

This should have the tick box pressed in for 'Set As Fallback'

HOWTO: 5.1 Surround Sound Digital AC3 Audio S/PDIF PulseAudio
https://help.ubuntu.com/community/DigitalAC-3Pulseaudio

Add or edit this file...

/usr/share/alsa/alsa.conf.d/a52.conf

pcm.a52 { @args [CARD] @args.CARD { type string }  type rate slave { pcm { type a52 bitrate 448 channels 6 card $CARD }  rate 48000 #required somehow, otherwise nothing happens in PulseAudio } }

Build the library files, and copy them to the correct locations...

sudo apt-get build-dep libasound2-plugins sudo apt-get install libavcodec-dev libavformat-dev mkdir ~/tmp cd ~/tmp apt-get source libasound2-plugins cd alsa-plugins-* ./configure libtoolize --force --copy && aclocal && autoconf && automake && make cd a52/.libs sudo cp libasound_module_pcm_a52.la libasound_module_pcm_a52.so /usr/lib/x86_64-linux-gnu/alsa-lib/ sudo cp libasound_module_pcm_a52.so /usr/lib/`uname -i`-linux-gnu/alsa-lib/

Edit these files to add the new 'SPDIF' sink to PulseAudio...

/etc/pulse/default.pa

load-module module-alsa-sink device=a52 rate=48000 channels=6 tsched=0 sink_properties=device.description=SPDIF sink_name=SPDIF channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe
 * 1) s/pdif tweaks

/etc/pulse/daemon.conf

; default-sample-format = s16le default-sample-rate = 48000 default-sample-channels = 6 default-channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe

Restart ALSA and PulseAudio...

sudo alsa reload pulseaudio --kill pulseaudio --start pidof pulseaudio

Various tests...

pacmd list-sinks speaker-test -t wav -c 6 -D a52 vlc dvd://

Fix VLC to play 5.1 Channel Surround instead of 2 Channel Stereo...

vlc Tools > Preferences > Show Settings > All > Audio > Output Modules > ALSA > Audio Output Device > Default > Audio Output Channels > Surround 5.1 Save

HOWTO: Stop PulseAudio From Auto Starting
pulseaudio is a stubborn little daemon. man pulseaudio says you can turn it off with the command pulseaudio --kill. But it won't stay killed-- it respawns itself. There is a normal init script to start it at boot, /etc/rc2.d/S50pulseaudio. But when you try controlling this the normal Linux way it doesn't work, because running /etc/init.d/pulseaudio stop doesn't stop it. Removing /etc/rc2.d/S50pulseaudio doesn't prevent it from starting at boot.

To stop its respawning habit, open /etc/pulse/client.conf, change autospawn = yes to autospawn = no, and set daemon-binary to /bin/true. Make sure these lines are uncommented, like this:

autospawn = no daemon-binary = /bin/true

Disable The Suspend Item On Session Menu
gksudo gedit /usr/share/polkit-1/actions/org.freedesktop.upower.policy

There are two sections in this file, the first for suspend and the second for hibernate. Near the end of each section will be a line with:

yes

Change this entry from “yes” to “no” to disable hibernate/suspend.

no

http://linuxexpresso.wordpress.com/2010/05/09/disable-suspend-and-hibernate-ubuntu/

Fix Missing Network eth0 NFS Mount issue Problem bug
http://www.cyberciti.biz/faq/setting-up-an-network-interfaces-file/

/etc/network/interfaces

auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp

Backup / Clone System
On old system...

sudo -i cd / tar -cvpzf backup.tar.gz --exclude=/backup.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/media --exclude=/dev /

...then copy the backup.tar.gz to a usb disk drive.

On new system, boot from SystemRescueCD...

mkdir /mnt/sda1 mkdir /mnt/usb mount /dev/sda1 /mnt/sda1 mount /dev/sdb1 /mnt/usb tar -xzvpf /mnt/usb/backup.tar.gz -C /mnt/sda1/ mkdir /mnt/sda1/{dev,lost+found,mnt,media,proc,sys} blkid >> /mnt/sda1/etc/fstab nano /mnt/sda1/etc/fstab mount -t proc none /mnt/sda1/proc mount -o bind /dev /mnt/sda1/dev chroot /mnt/sda1 /bin/bash grub-install /dev/sda update-grub exit reboot

The section in bold is where you fix the hard drive UUIDs so that the system will boot.

https://help.ubuntu.com/community/BackupYourSystem/TAR

Stop Recommended Packages During Install
There is a way to stop installing the so-called “recommends” packages automatically. For single packages, you should use the --no-install-recommends switch with apt-get. To turn off installing recommends for all packages, do one of the following:

APT::Install-Recommends "false"
 * In Synaptic, go to Settings » Preferences » tab General and uncheck “Consider recommended packages as dependencies”
 * Create the file /usr/apt/apt.conf.d/05norecommends and add the following line in the file:

YouTube Blue Faces Fix with Nvidia Cards
NVIDIA

How To Install A .deb File
sudo dpkg -i filename.deb

sudo dpkg -i --force-depends *.deb

List Of Services Running
service --status-all

Method A
To disable gdm from running during boot, you can either boot with the "text" boot parameter or disable the rc service like this:-

sudo update-rc.d -f gdm remove sudo update-rc.d -f x11-common remove

Then to re-enable it later:-

sudo update-rc.d gdm defaults sudo update-rc.d x11-common defaults

This option is useful if gdm or X locks up the system during boot, or if you wish to run X in complete isolation from gdm.

https://wiki.ubuntu.com/X/NonGraphicalBoot

Method B
sudo nano /etc/default/grub

Change the following lines:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" GRUB_CMDLINE_LINUX_DEFAULT="text"

to:

GRUB_CMDLINE_LINUX_DEFAULT="text"
 * 1) GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

sudo update-grub sudo reboot

Apport - System Report Tool: Disable
In 12.04 Apport (much like the Windows Error Reporting tool) is enabled by default unlike previous versions, to change this behaviour:

Linux Terminal:~$ gksudo gedit /etc/default/apport

Change the 'enabled' line to read:

enabled=0

To re-enable just revert the 'enabled' line back to '1'

Burning a CD on the Command Line with Wodim
Scan for the drive...

wodim --devices wodim: Overview of accessible drives (1 found) : - 0 dev='/dev/scd0'	rwrw-- : 'HL-DT-ST' 'BDDVDRW GGC-H20L' -

or

wodim -scanbus scsibus2: 2,0,0	200) 'HL-DT-ST' 'BDDVDRW GGC-H20L' '1.03' Removable CD-ROM 	2,1,0	201) * 2,2,0	202) * 	2,3,0	203) * 	2,4,0	204) * 	2,5,0	205) * 	2,6,0	206) * 	2,7,0	207) *

What media or type of disc do I have in the drive?

wodim dev=/dev/scd0 -v -atip

Now burn the CD...

wodim dev=/dev/scd0 -v -data cd_image.iso

or

wodim dev=2,0,0 -v -data cd_image.iso

Network Configuration
https://help.ubuntu.com/11.10/serverguide/C/network-configuration.html

Applications - Discover Where Their Components Are Installed: How To
The first step below will help you identify the system name for the software, that is what the operating systems sees it as not what your call it. In this example we are using Adobe's Flash.

Linux Terminal:~$ sudo dpkg -l | grep flash

The returned out put will look similar to this:

Linux Terminal:~$ ii adobe-flashplugin 11.2.202.228-0oneiric1 Adobe Flash Player plugin version 11

Next:

Linux Terminal:~$ sudo dpkg -L adobe-flashplugin

The output generated will look similar to the following:

Linux Terminal:~$ /. /usr /usr/lib /usr/lib/xulrunner /usr/lib/xulrunner/plugins /usr/lib/xulrunner-addons /usr/lib/xulrunner-addons/plugins /usr/lib/mozilla /usr/lib/mozilla/plugins /usr/lib/iceape /usr/lib/iceape/plugins /usr/lib/iceweasel /usr/lib/iceweasel/plugins /usr/lib/firefox /usr/lib/firefox/plugins /usr/lib/midbrowser /usr/lib/midbrowser/plugins /usr/lib/adobe-flashplugin /usr/lib/adobe-flashplugin/libflashplayer.so /usr/share /usr/share/icons /usr/share/icons/hicolor /usr/share/icons/hicolor/32x32 /usr/share/icons/hicolor/32x32/apps /usr/share/icons/hicolor/32x32/apps/flash-player-properties.png /usr/share/icons/hicolor/22x22 /usr/share/icons/hicolor/22x22/apps /usr/share/icons/hicolor/22x22/apps/flash-player-properties.png /usr/share/icons/hicolor/24x24 /usr/share/icons/hicolor/24x24/apps /usr/share/icons/hicolor/24x24/apps/flash-player-properties.png /usr/share/icons/hicolor/16x16 /usr/share/icons/hicolor/16x16/apps /usr/share/icons/hicolor/16x16/apps/flash-player-properties.png /usr/share/icons/hicolor/48x48 /usr/share/icons/hicolor/48x48/apps /usr/share/icons/hicolor/48x48/apps/flash-player-properties.png /usr/share/pixmaps /usr/share/doc /usr/share/doc/adobe-flashplugin /usr/share/doc/adobe-flashplugin/copyright /usr/share/doc/adobe-flashplugin/changelog.Debian.gz /usr/share/pixmaps/flash-player-properties.png

ALSA + NVIDIA + ION + HDMI
Unmute all the S/PDIF + S/PDIF Default + S/PDIF 1.

Linux Terminal:~$ alsamixer

Test to make sure your hardware works first.

Linux Terminal:~$ aplay -D plughw:0,3 /usr/share/sounds/alsa/Noise.wav

Add the following contents to the file /etc/asound.conf.

pcm.!default { type plug slave.pcm { type hw card 0 device 3 } }

Retest it with the following command.

Linux Terminal:~$ aplay /usr/share/sounds/alsa/Noise.wav

Automount USB Drives: How To Disable
Gnome 2

Alt + F2, then type in gconf-editor and select.

Navigate to: apps --> nautilus --> preferences --> media automount (untick)

Gnome 3 - Unity

Alt + F2, to bring up the Dash, then type dconf-editor and select.

Navigate to: org --> gnome --> desktop --> media-handling --> automount (untick)

BASH Command Line Smart Completion: How To Enable
Edit the following file and uncomment the lines shown in bold below... Linux Terminal:~$ sudo nano /etc/bash.bashrc

Edit the following lines:

'''if [ -f /etc/bash_completion ] && ! shopt -oq posix; then''' . /etc/bash_completion fi
 * 1) enable bash completion in interactive shells

Blank / Black / Missing Login Screen
http://ubuntu-tutorials.com/2010/05/06/ubuntu-10-04-lucid-blank-screen-at-startup-workaround/

"From the command line, please enter sudo dpkg-reconfigure xserver-xorg. Keep the default answers if you do not know what to answer. Pay attention to your screen settings, this is probably what makes your graphical session (starting with GDM) not available. Once you're done, enter sudo reboot, and your session should be running back again."

Clear The Apt Get Cache
To clear the unused downloaded packages; Linux Terminal:~$ sudo apt-get autoclean

To clear all downloaded packages; Linux Terminal:~$ sudo apt-get clean

Command Line Aliases: How To Add/Edit
Open a terminal and edit the .bashrc file:

Linux Terminal:~$ nano ~/.bashrc

Edit or add the following lines:

alias egrep='egrep --color=auto' alias empty='rm -rf ~/.local/share/Trash/files/*' alias fgrep='fgrep --color=auto' alias get='get_iplayer/get_iplayer' alias grep='grep --color=auto' alias hg='history |grep' alias install='sudo apt-get install' alias l='ls -CF' alias la='ls -A' alias ll='ls -lah' alias ls='ls --color=auto' alias myip='curl ifconfig.me' alias ping='ping -c3 -n -i 0.2 -W1' alias pingg='ping www.google.co.uk' alias pingp='ping www.paully.co.uk' alias pingm='ping 10.0.0.1' alias pings='ping 192.168.0.1' alias rav='rsync -a -v' alias remove='sudo apt-get autoremove' alias rm='rm -iv' alias search='sudo apt-cache search' alias ss='gksudo software-properties-gtk' alias sshg='ssh username@server1.indie-it.com' alias update='sudo apt-get update' alias upgrade='sudo apt-get upgrade' alias uu='sudo apt-get update && sudo apt-get upgrade' alias uuf='sudo apt-get update && sudo apt-get dist-upgrade'

Reload the file:

Linux Terminal:~$ source ~/.bashrc

To confirm the entries:

Linux Terminal:~$ alias

Ctrl-Alt-Backspace Disabled By Default In Xorg: How To Re-enable 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

DVD Menu Navigation: How To Enable It
Linux Terminal:~$ sudo apt-get install libdvdread sudo /usr/share/doc/libdvdread4/install-css.sh

Dependencies: What Associated Packages Does A Programme Rely On?
First you will need to install an additional package:

Linux Terminal:~$ sudo apt-get install apt-rdepends

Once installed in a terminal:

Linux Terminal:~$ apt-rdepends

For example:

Linux Terminal:~$ apt-rdepends remmina

Most packages will output more data than the standard settings for the terminal will allow, in these instances you can use the pipe command:

Linux Terminal:~$ apt-rdepends apache2 | more apt-rdepends apache2 | less

File --> Open --> Cannot See Hidden Files
By default the 'Open' dialogue window does not show hidden files or folders.

To display them press CTRL+H.

This will then temporarily display the hidden files and folders, they will revert to hidden the next time the 'Open' dialogue is used.

Fonts: How To Install
Up to and including 09.04 - copy the font file to /usr/share/fonts/ directory and run

Linux Terminal:~$ fc-cache -f -v

09.10 - copy the font file to /usr/share/fonts/ directory and run

From and including 10.04 - right click on font and choose install OR double click and press Install button

Generate A List Of Installed Packages And Use It To Reinstall Packages: How To
Linux Terminal:~$ 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.

''' Installing packages on another Ubuntu installation. '''

When you have finished and rebooted, run the following commands to update... Linux Terminal:~$ 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... Linux Terminal:~$ dpkg --set-selections < ubuntu-files sudo dselect

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

GPG Repository Keys Missing: How To Fix
Copy the following in to a text editor and save as: launchpad-update.sh

# for APT in `find /etc/apt/ -name *.list`; do    grep -o "^deb http://ppa.launchpad.net/[a-z0-9\-]\+/[a-z0-9\-]\+" $APT | while read ENTRY ; do          # work out the referenced user and their ppa USER=`echo $ENTRY | cut -d/ -f4` PPA=`echo $ENTRY | cut -d/ -f5` # some legacy PPAs say 'ubuntu' when they really mean 'ppa', fix that up        if [ "ubuntu" = "$PPA" ] then PPA=ppa fi        # scrape the ppa page to get the keyid KEYID=`wget -q --no-check-certificate https://launchpad.net/~$USER/+archive/$PPA -O- | grep -o "1024R/[A-Z0-9]\+" | cut -d/ -f2` sudo apt-key adv --list-keys $KEYID >/dev/null 2>&1 if [ $? != 0 ]        then echo Grabbing key $KEYID for archive $PPA by ~$USER sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com $KEYID else echo Already have key $KEYID for archive $PPA by ~$USER fi    done done echo DONE
 * 1) ! /bin/sh
 * 1) Simple script to check for all PPAs refernced in your apt sources and
 * 2) to grab any signing keys you are missing from keyserver.ubuntu.com.
 * 3) Additionally copes with users on launchpad with multiple PPAs
 * 4) (e.g., ~asac)
 * 1) Author: Dominic Evans https://launchpad.net/~oldman
 * 2) License: LGPL v2

Alternatively you can download it from here.

Remember to set the file permissions to allow execution of the file.

Run the script via the terminal:

Linux Terminal:~$ sh ./launchpad-update

GRUB Boot Menu - Enable: How To
Edit the following file:-

Linux Terminal:~$ sudo nano /etc/default/grub

Change the lines in bold to match what is shown below:-

GRUB_DEFAULT=0 # GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=false GRUB_TIMEOUT=10 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" GRUB_CMDLINE_LINUX=""

Save and close nano then run the following commands:-

Linux Terminal:~$ sudo update-grub && sudo reboot

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

Linux Terminal:~$ sudo apt-get dist-upgrade sudo apt-get update sudo apt-get upgrade sudo apt-get autoremove sudo apt-get update && sudo apt-get --yes upgrade && sudo aptitude -y safe-upgrade

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

Linux Terminal:~$ sudo nano /etc/hostname

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

Linux Terminal:~$ sudo nano /etc/hosts

127.0.0.1      localhost.localdomain   localhost 127.0.1.1      machine_name_1.fish   machine_name_1

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

The line starting 127.0.1.1 is required on an Ubuntu system.

Exit the terminal and reboot the system.

Icons: Enable on System Menu - 9.10 onwards
 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 

Linux 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

Icon Sets: How To Install
If required unzip your icons set and then copy the folder using the command below in a terminal:

Linux Terminal:~$ sudo cp -r  /usr/share/icons

Keyboard Indicator
Allow you to add an indicator applet to the Gnome panel which will show whether your Caps, Scroll or Page Lock keys are inactive or active. It is also configurable to show only those keys you are interested in, for instance on my ThinkPad Edge I am only interested in the Caps Lock.

In a terminal:

sudo apt-get install lock-keys-applet killall gnome-panel

Right click the Gnome panel, click "Add to panel" and add the "Lock Keys" applet. To configure right-click on the applet and select 'Preferences'.

Keyboard Shortcut: Alt+` (or Alt+ the key to the left (on a UK keyboard [correctly known as the Grave accent key]) of the Number 1 Key
This appears to work in Gnome 3 and Unity. Pretty much everyone knows the classic Alt+Tab to scroll through the list of open applications, however using Alt+` will scroll through the open parent and child windows of a particular programme, e.g. Evolution mail with an opened message and a compose window.

Login Sound: How To Disable
 Method One  Linux Terminal:~$ sudo -u gdm gconftool-2 --set /desktop/gnome/sound/event_sounds --type bool false

 Method Two 

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

Locate and untick 'GNOME Login Sound' entry

Media Automount For USB Drives: How To Disable
Alt + F2, then type in gconf-editor, and press Enter

Navigate to apps-->nautilus-->preferences, then uncheck 'media_automount'

Media Automount Open: How To Disable
By default Ubuntu will automount an external drive and open it in Nautilus, if you want to disable the opening of Nautilus undertake the following:

Alt + F2, then type in gconf-editor, and press Enter

Navigate to apps-->nautilus-->preferences, then uncheck 'media_automount_open'

MeMenu Display Your Real Name: How To
To remove the name from the MeMenu altogether: Linux Terminal:~$ gconftool -s /system/indicator/me/display --type int 0

To show your real name/’about me’ name: Linux Terminal:~$ gconftool -s /system/indicator/me/display --type int 2

To display the default account username:

Linux Terminal:~$ gconftool -s /system/indicator/me/display --type int 1

Instructions gleaned from here.

mesa-utils
mesa-utils provides several basic GL utilities, including glxinfo and glxgears.

Linux Terminal:~$ sudo apt-get install mesa-utils

Network Card Reset Naming: How To
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:

Linux Terminal:~$ > /etc/udev/rules.d/70-persistent-net.rules reboot

NotifyOSD - Install GUI Configurator: How To
Out of the box Ubuntu does not support configuration of NotifyOSD's bubble, the following PPAs remedy this oversight:

The first PPA will install a patched version of NotifyOSD

Linux Terminal:~$  sudo add-apt-repository ppa:leolik/leolik sudo apt-get update && sudo apt-get upgrade sudo apt-get install libnotify-bin pkill notify-osd

The second PPA installs the GUI configurator:

Linux Terminal:~$  sudo add-apt-repository ppa:nilarimogard/webupd8 sudo apt-get update && sudo apt-get install notifyosdconfig

The resulting menu entry can be found in Gnome 2 in 'Applications --> Accessories --> NotifyOSD Configuration', in Unity just type NotifyOSD in the Launcher.

NotifyOSD - Keyboard Indicators (Caps/Num/Scroll Lock): How To
NOTE: This section is not yet completed...

The following has been duplicated from here, and will only work if you have undertaken the installation of the modified NotifyOSD from leolik.

Download the shell script [], use right click and 'Save link as...'.

Make the shell script executable

Copy the shell script to the main bin folder

Linux Terminal:~$  sudo cp ~/From_where_you_downloaded_it_to/lock_keys /bin

Open CompizConfig Settings Manager

Under the 'General' section click on 'Commands'

Under the 'Command' tab enter the following in to blank lines:  lock_keys caps lock_keys num lock_keys scrl 

Click on the Key Bindings tab

Link the corresponding Run Command # with the command from the previous tab  Click on Disabled Check Enabled Click Grab Key Combination Press the key 

NOTE: You may need to tick the box under 'Enable this plugin'

Close Settings Manager

Test

Panel Icons And Applets: How To Change The Defaults For A New User
'''Linux Terminal:~$ sudo nano /usr/share/gconf/defaults/05_panel-default-setup.entries

For example, to remove the Workspace Switcher Applet, delete these lines...

workspace_switcher <-- Workspace Switcher Applet --> applets/workspace_switcher/object_type <schema_key>/schemas/apps/panel/objects/object_type</schema_key> bonobo-applet ...and all the rest up to (but not including) <-- TrashApplet Applet -->

Save and exit the editor, then run... '''Linux Terminal:~$ sudo update-gconf-defaults

Reboot and add a new user to test.

Repositories - Back Up The Listing
'''Linux Terminal:~$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

or '''Linux Terminal:~$

Restricted Extras - Install: How To
Linux Terminal:~$ sudo apt-get install ubuntu-restricted-extras

Run A Script When Computer Is Shutdown Or Rebooted: How To
Create your script and make sure you have the BASH shebang line at the top;


 * 1) !/bin/bash

Make your script executable;

chmod a+x scriptname

Copy your script to the main run-level directory;

sudo cp -a -v scriptname /etc/init.d/

Create symbolic links to the shutdown and reboot run-level directories; make sure you have the preceeding K10 in your link name like the examples below; this will make sure it is run first;

sudo ln -s /etc/init.d/scriptname /etc/rc0.d/K10scriptname sudo ln -s /etc/init.d/scriptname /etc/rc6.d/K10scriptname

Root User - Switch To: How To
Linux Terminal:~$ sudo su - root

Enter the password for the user profile you are in.

Sound Menu - Change Default Player: How To
To add media players to the Ubuntu sound menu do:

Linux Terminal:~$ gsettings set com.canonical.indicator.sound interested-media-players “['media_player']“

To remove media players from the Ubuntu sound menu do:

Linux Terminal:~$ gsettings set com.canonical.indicator.sound blacklisted-media-players “['media_player']“

Replace 'media_player' with the programme you want to add.

Examples:

Rhythmbox:

Linux Terminal:~$ gsettings set com.canonical.indicator.sound interested-media-players "['rhythmbox']"

VLC:

Linux Terminal:~$ gsettings set com.canonical.indicator.sound interested-media-players "['vlc']"

Banshee:

Linux Terminal:~$ gsettings set com.canonical.indicator.sound interested-media-players "['banshee']"

Static IP Address: How To (up to 11.04)
Linux Terminal:~$ sudo killall dhclient sudo nano /etc/network/interfaces

Edit the file to match below, substituting IP and subnet numbering to match your set up:

auto lo iface lo inet 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, and then after reboot:

Linux Terminal:~$ sudo nano resolv.conf

Add the following line to the resolv.conf file:

nameserver 192.168.0.1

Static IP Address: How To (11.10 onwards)
Fish

Stop CDROM Auto Close
Quick fix...

Linux Terminal:~$ sudo sysctl -w dev.cdrom.autoclose=0

...and to survive a reboot...

Linux Terminal:~$ nano /etc/sysctl.d/60-cdrom-autoclose.conf dev.cdrom.autoclose = 0
 * 1) do not autoclose cdrom

Theme For New Users: How To Change The Gnome Default
Linux Terminal:~$ sudo nano /usr/share/gconf/defaults/16_ubuntu-artwork

From...

/desktop/gnome/interface/gtk_theme     Ambiance /desktop/gnome/interface/icon_theme    ubuntu-mono-dark /desktop/gnome/peripherals/mouse/cursor_theme  DMZ-White /apps/metacity/general/theme   Ambiance

To... (for example Clearlooks)

/desktop/gnome/interface/gtk_theme     Clearlooks /desktop/gnome/interface/icon_theme    gnome /desktop/gnome/peripherals/mouse/cursor_theme  default /apps/metacity/general/theme   Clearlooks

Save and exit the editor, then run...

Linux Terminal:~$ sudo update-gconf-defaults

Reboot and add a new user to test.

Theme: Have Synaptic Package Manager Use A GTk Theme
If you have set your profile to use a GTk theme when you open the Synaptic Package Manager (SPM) the theme will not be used. This is because essentially it is being run as root so to have it use the theme undertake the following:

Linux Terminal:~$ sudo cp -r /home/username/.themes/your_GTk_theme/ /usr/share/themes/

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:

Linux Terminal:~$ gconftool -s --type bool /apps/update-notifier/auto_launch false

To revert the behaviour:

Linux Terminal:~$ gconftool -s --type bool /apps/update-notifier/auto_launch true

Method Two:

Type 'Alt+F2' to open the run dialogue and enter the following:

gconf-editor

In the right-hand pane navigate to

apps --> update-notifier

In the right-hand pane locate 'auto_launch' and unchecked the tick box.

To revert the behaviour simply repeat the above step, but place a check in the auto_launch box.

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

Linux Terminal:~$ 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:

Linux Terminal:~$ sudo aptitude safe-upgrade

Aptitude will need to be installed, currently up to and including 10.04 it comes as standard however from the release of 10.10 it will not be included by default, to install it:

Linux Terminal:~$ sudo apt-get install aptitude

What CPU Am I Running? How To Find Out
Linux Terminal:~$ uname -m

The above will give you a very basic idea or whether you are running a 32-bit or 64-bit CPU, the following will give you much more information.

Linux Terminal:~$ cat /proc/cpuinfo

What Files Are In The Package X?
apt-file list ffmpeg

or

dpkg-query -L ffmpeg

What Package Is That File In?
Linux Terminal:~$ dpkg -S whatever

Example

Linux Terminal:~$ dpkg -S xfce4-terminal xfce4-terminal: /usr/bin/xfce4-terminal

or

Linux Terminal:~$ sudo apt-get install apt-file sudo apt-file update apt-file search whatever

Example

Linux Terminal:~$ which xfce4-terminal /usr/bin/xfce4-terminal apt-file search /usr/bin/xfce4-terminal xfce4-terminal: /usr/bin/xfce4-terminal xfce4-terminal: /usr/bin/xfce4-terminal.wrapper xfce4-terminal-dbg: /usr/lib/debug/usr/bin/xfce4-terminal

Which Version Of A Software Package Am I Running?
Linux Terminal:~$ apt-cache showpkg <package_name>

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

Linux Terminal:~$ apt-cache showpkg openvpn

Which Version Of Ubuntu Linux Am I Running?
'''Linux Terminal:~$ cat /etc/lsb-release

or

'''Linux Terminal:~$ cat /etc/issue

or

'''Linux Terminal:~$ uname -a && cat /etc/*release

or

'''Linux Terminal:~$ lsb_release -a

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

Fix Random Missing DVD
After a while (perhaps 1 use upon a fresh cold computer start) you may 'lose' your DVD drive. This seems to be a bug with either UDEV or HAL in Ubuntu Linux 9.10 - the symlinks for nodes like 'cdrom' or 'dvd' disappear...

This is what they should look like:-

lrwxrwxrwx 1 root root 3 2010-12-14 09:53 /dev/cdrom -> sr0 lrwxrwxrwx 1 root root 3 2010-12-14 09:54 /dev/cdrw -> sr0 lrwxrwxrwx 1 root root 3 2010-12-14 09:54 /dev/dvd -> sr0 lrwxrwxrwx 1 root root 3 2010-12-14 09:54 /dev/dvdrw -> sr0

To fix this, first check that you have the actual device (like sr0)...

root@mythbuntu-server2:~# dmesg |grep -i dvd [   1.664900] ata3.00: ATAPI: HL-DT-ST BDDVDRW GGC-H20L, 1.03, max UDMA/133 [   1.793129] scsi 2:0:0:0: CD-ROM            HL-DT-ST BDDVDRW GGC-H20L 1.03 PQ: 0 ANSI: 5 [   2.123681] sr0: scsi3-mmc drive: 40x/40x writer dvd-ram cd/rw xa/form2 cdda tray root@mythbuntu-server2:~# lshw -c disk *-cdrom description: DVD-RAM writer product: BDDVDRW GGC-H20L vendor: HL-DT-ST physical id: 1 bus info: scsi@2:0.0.0 logical name: /dev/cdrom logical name: /dev/cdrw logical name: /dev/dvd logical name: /dev/dvdrw logical name: /dev/scd0 logical name: /dev/sr0 version: 1.03 capabilities: removable audio cd-r cd-rw dvd dvd-r dvd-ram configuration: ansiversion=5 status=nodisc

...then recreate the symbolic links:-

sudo -i cd /dev/ ln -s sr0 cdrom ln -s sr0 cdrw ln -s sr0 dvd ln -s sr0 dvdrw

UPDATE #1 - despite doing the above, you can still lose your DVD drive. It actually comes down to Ubuntu thinking the tray is open, when it is clearly not!

setcd -i  (this will show "CD Tray is open") lshw -c disk  (this will show "status=open")

This is obviously a software bug (probably udev or hal) but there is no known software cure, except to reboot :-(

UPDATE #2 - someone has suggested appending the word noapic to the grub boot menu and rebooting...

sudo nano /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noapic"

...so far, so good!