Ubuntu: Generic Hints Tweaks and Tips

From Indie IT Wiki
Jump to: navigation, search

In an example anything shown in bold similar the following, is not to be run.

sudo apt-get install fish # This is an example

So in the above # This is an example is not to be run in the terminal.



Network Route

From this...

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    600    0        0 wlp58s0     U     1000   0        0 wlp58s0   U     600    0        0 wlp58s0

To this...

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    600    0        0 wlp58s0   U     600    0        0 wlp58s0


sudo nano /etc/network/if-up.d/avahi-autoipd

## 2020-03-20 commented out by PCL
#if [ -x /bin/ip ]; then
#       # route already present?
#       ip route show | grep -q '^[[:space:]]' && exit 0
#       /bin/ip route add dev $IFACE metric 1000 scope link
#elif [ -x /sbin/route ]; then
#       # route already present?
#       /sbin/route -n | egrep -q "^[[:space:]]" && exit 0
#       /sbin/route add -net netmask dev $IFACE metric 1000

sudo route del -net netmask dev <interface> metric 1000


Emptying Cache and Buffers in Linux

Clear pagecache:

echo 1 > /proc/sys/vm/drop_caches

Clear dentries and inodes:

sync; echo 2 > /proc/sys/vm/drop_caches

Clear pagecache, dentries, and inodes:

sync; echo 3 > /proc/sys/vm/drop_caches


Monitor Screen Power

sudo apt-get install vbetool
sudo vbetool dpms off
sudo sh -c 'vbetool dpms off; read ans; vbetool dpms on'


sudo nano /etc/modprobe.d/aliases

Find the line:

alias net-pf-10 ipv6

Replace with:

alias net-pf-10 off
alias ipv6 off

Save and close the file. Finally, reboot the system.

Thanks - https://www.cyberciti.biz/tips/linux-how-to-disable-the-ipv6-protocol.html

Snap Daemon

sudo systemctl disable snapd.autoimport.service 
sudo systemctl disable snapd.refresh.timer 
sudo systemctl disable snapd.service 
sudo systemctl disable snapd.socket 
sudo systemctl disable snapd.system-shutdown.service


Apport (much like the Windows Error Reporting tool) is enabled by default to change this behaviour:

sudo nano /etc/default/apport

Edit the file to match below (changes shown in bold):

# set this to 0 to disable apport, or to 1 to enable it
# you can temporarily override this with
# sudo service apport start force_start=1

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

Automatic Mounting Of External Media

By default Ubuntu will automatically mount USB drives/optical disks and open them in the default file manager, to disable this behaviour:

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

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

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)


sudo nano /etc/NetworkManager/NetworkManager.conf

Comment out the dns=dnsmasq line using # as shown in the example below:

# dns=dnsmasq


Thanks Ubuntu Geek.

Installation Of Recommended Packages

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:

  • 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:
APT:Install-Recommends "false"

Optical Drive Auto Close

Quick fix...

sudo sysctl -w dev.cdrom.autoclose=0

...and to survive a reboot...

nano /etc/sysctl.d/60-cdrom-autoclose.conf

# do not autoclose cdrom
dev.cdrom.autoclose = 0

Suspend Item On Session Menu

sudo nano /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; as shown below.

<action id="org.freedesktop.upower.suspend">
<action id="org.freedesktop.upower.hibernate">

Near the end of each section will be a line with:


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


Thanks Liberian Geek.

Synaptic Touchpad

synclient TouchpadOff=1 # To disable

synclient TouchpadOff=2 # To enable

List of options:

synclient -l


Parameter settings: # For ease of reading the list I have put it in to alphabetical order

AccelFactor             = 0.0359777
AreaBottomEdge          = 0
AreaLeftEdge            = 0
AreaRightEdge           = 0
AreaTopEdge             = 0
BottomEdge              = 4550
CircScrollDelta         = 0.1
CircScrollTrigger       = 0
CircularPad             = 0
CircularScrolling       = 0
ClickFinger1            = 1
ClickFinger2            = 1
ClickFinger3            = 0
ClickPad                = 0
ClickTime               = 100
CoastingFriction        = 50
CoastingSpeed           = 20
CornerCoasting          = 0
EmulateMidButtonTime    = 75
EmulateTwoFingerMinW    = 7
EmulateTwoFingerMinZ    = 282
FingerHigh              = 30
FingerLow               = 25
GrabEventDevice         = 1
HorizEdgeScroll         = 0
HorizHysteresis         = 27
HorizScrollDelta        = 111
HorizTwoFingerScroll    = 1
LBCornerButton          = 0
LeftEdge                = 1781
LockedDrags             = 0
LockedDragTimeout       = 5000
LTCornerButton          = 0
MaxDoubleTapTime        = 180
MaxSpeed                = 1.75
MaxTapMove              = 244
MaxTapTime              = 180
MinSpeed                = 1
PalmDetect              = 0
PalmMinWidth            = 10
PalmMinZ                = 200
PressureMotionMaxFactor = 1
PressureMotionMaxZ      = 160
PressureMotionMinFactor = 1
PressureMotionMinZ      = 30
RBCornerButton          = 3
ResolutionDetect        = 1
RightEdge               = 5579
RTCornerButton          = 2
SingleTapTimeout        = 180
TapAndDragGesture       = 1
TapButton1              = 1
TapButton2              = 3
TapButton3              = 0
TopEdge                 = 1644
TouchpadOff             = 2
VertEdgeScroll          = 0
VertHysteresis          = 27
VertScrollDelta         = 111
VertTwoFingerScroll     = 1

A whole host of information can be found at Arch Linux.

Tracker Service

The Tracker project can be found here.

sudo apt-get remove libtracker-extract-0.16-0 libtracker-miner-0.16-0 tracker-extract tracker-miner-fs tracker-utils

User Account

sudo passwd -l username

To re-enable the account:

sudo passwd -u username

White Dots On The Lightdm Log In Screen

The following creates a new user 'lightdm' and logs in to that profile so remember to use CTRL+C to return to your own profile in the terminal.

sudo xhost +SI:localuser:lightdm
sudo su lightdm -s /bin/bash
gsettings set com.canonical.unity-greeter draw-grid false


rc.local startup script

No /etc/rc.local file in Ubuntu 18.04 fix

Force FSCK On Next Reboot

sudo touch /forcefsck
sudo reboot

BASH Command Line Smart Completion

Edit the following file and uncomment the lines shown in bold below...

sudo nano /etc/bash.bashrc

Edit the following lines:

# enable bash completion in interactive shells
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion

Later Version 14.04 >

sudo nano /etc/bash.bashrc

    # enable bash completion in interactive shells
    if ! shopt -oq posix; then
     if [ -f /usr/share/bash-completion/bash_completion ]; then
        . /usr/share/bash-completion/bash_completion
      elif [ -f /etc/bash_completion ]; then
        . /etc/bash_completion

The lines shown above will be commented out, uncomment them to match that shown in bold above.

Save (CTRL+o) and exit (CTRL+x)

Restart bash

exec bash

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

DVD Menu Navigation

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

GRUB Boot Menu

Edit the following file:-

sudo nano /etc/default/grub

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

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

Save and close nano then run the following commands:-

sudo update-grub && sudo reboot

Linux Thermal Daemon (Intel Chipsets)



ERROR: systemd-resolved[739]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001

sudo -i
cd /etc
rm resolv.conf
ln -s /run/systemd/resolve/resolv.conf resolv.conf
systemctl restart systemd-resolved.service

ERROR: failed to execute shell


failed to execute shell: bash -c /usr/share/lighttpd/create-mime.assign.pl: No such file or directory
failed to execute shell: bash -c /usr/share/lighttpd/include-conf-enabled.pl: No such file or directory


Because the Ubuntu Release Upgrader has removed PHP during the upgrade process. God knows why.


Reinstall the PHP CGI module and the PHP MySQL module.


sudo apt-get install php-cgi php-mysql
sudo lighty-enable-mod fastcgi-php
sudo service lighttpd restart

ERROR: unmet dependencies "No space left on device"

Try this command first...

sudo apt-get autoclean
sudo apt-get autoremove

Check to see if you have WAY too many kernels installed! List your kernels with...

sudo apt list --installed | grep 'linux'

Then, remove all of them apart from the latest one you have running now.

sudo uname --kernel-release
sudo dpkg --remove linux-headers-4.4.0-71 linux-headers-4.4.0-71-generic xxxxxx
df -H
sudo apt-get -f install

ERROR: Failed to fetch bzip2:/var/lib/apt/lists/partial/gb.archive.ubuntu.com


sudo apt-get update
Failed to fetch bzip2:/var/lib/apt/lists/partial/gb.archive.ubuntu.com_ubuntu_dists_precise_main_source_Sources  Hash Sum mismatch


sudo rm -fR /var/lib/apt/lists/*
sudo apt-get update

Missing Items and/or Icons System Settings

sudo apt-get install --reinstall gnome-control-center
sudo apt-get install --reinstall gnome-settings-daemon-schemas
sudo apt-get install --reinstall unity-control-center
sudo apt-get install activity-log-manager-control-center
sudo apt-get install unity-control-center-signon gnome-control-center-unity
sudo apt-get install ubuntu-desktop

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

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:

sudo apt-get install aptitude


Latest Mainline Kernel



Latest Approved Kernel

2018-01-15 15:58:37

This will give you the newest available Ubuntu approved Linux kernel for your distribution, which is often not the one that is installed by default. There will be bug fixes and speed improvements. The example below installs the newest available kernel for 16.04 LTS (Xenial)

sudo apt-get update
sudo apt-cache search linux-generic
sudo apt-get install linux-image-4.13.0-26-generic linux-image-extra-4.13.0-26-generic linux-headers-4.13.0-26-generic
sudo update-grub
sudo update-initramfs -t -u -k all
sudo reboot

Thanks - https://www.cyberciti.biz/faq/installing-latest-stable-mainline-linux-kernel-on-ubuntu-with-apt-get/

Spectre Meltdown Checker


Fix for Intel Chipset

Latest Firmware: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915

The latest Linux Kernel (4.16) will most likely need a newer Firmware for your chipset, otherwise Video, Wireless and USB will not work!

GUC 9.2 and GUC 9.3


update-initramfs: Generating /boot/initrd.img-4.16.0-041600-generic
W: Possible missing firmware /lib/firmware/i915/skl_dmc_ver1_27.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_dmc_ver1_04.bin for module i915
W: Possible missing firmware /lib/firmware/i915/kbl_guc_ver9_39.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_guc_ver9_29.bin for module i915
W: Possible missing firmware /lib/firmware/i915/skl_guc_ver9_33.bin for module i915


cd /lib/firmware/i915/
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/skl_dmc_ver1_27.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/kbl_dmc_ver1_04.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/kbl_guc_ver9_39.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/bxt_guc_ver9_29.bin
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/skl_guc_ver9_33.bin
sudo update-initramfs -k all -u

GUC 9.1


update-initramfs: Generating /boot/initrd.img-4.15.0-041500-generic
W: Possible missing firmware /lib/firmware/i915/kbl_guc_ver9_14.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_guc_ver8_7.bin for module i915

Fix (only for Kabylake chipset)...

Run the following lines of code from the command line...

cd /tmp/
wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/kblgucver914.tar_1.bz2
tar xvjf kblgucver914.tar_1.bz2 && cd kbl_guc_ver9_14/ && sudo ./install.sh
cd ..
wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/bxtgucver87.tar_0.bz2
tar xjvf bxtgucver87.tar_0.bz2 && cd bxt_guc_ver8_7/ && sudo ./install.sh
cd ..
sudo update-initramfs -u -k all
sudo reboot


DMC 1.01


update-initramfs: Generating /boot/initrd.img-4.10.0-27-generic
W: Possible missing firmware /lib/firmware/i915/kbl_dmc_ver1_01.bin for module i915

Fix (only for Kabylake chipset)...

Run the following lines of code from the command line...

cd /tmp/
wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/sklgucver61.tar.bz2
tar xvjf sklgucver61.tar.bz2 && cd skl_guc_ver6_1/ && sudo ./install.sh
cd ..
wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/kbldmcver101.tar.bz2
tar xjvf kbldmcver101.tar.bz2 && cd kbl_dmc_ver1_01/ && sudo ./install.sh
cd ..
sudo update-initramfs -u -k all
sudo reboot


Install Group Software (tasks) such As DNS / Web Server In A Single Click

sudo tasksel

Thanks - http://www.cyberciti.biz/faq/tasksel-install-group-software-in-command-line/

exFAT Support

sudo apt install exfat-utils exfat-fuse

Behind A Proxy

Thanks - http://ask.xmodulo.com/install-ubuntu-desktop-behind-proxy.html

.deb Files

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

Download But Not Install A Package

sudo aptitude download package-name


Up to and including 09.04 - copy the font file to /usr/share/fonts/ directory and run

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

Icon Sets

If required unzip your icons set and then copy the folder using the command below in a terminal:

sudo cp -r <the_name_of_your_icon_set> /usr/share/icons


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

sudo apt-get install mesa-utils

Restricted Addons & Extras

sudo aptitude install ubuntu-restricted-addons ubuntu-restricted-extras

Microsoft TrueType Core Fonts

sudo aptitude install ttf-mscorefonts-installer


Default Text Editor System Wide

sudo update-alternatives --config editor

The available alternatives will be displayed, enter its number and press return.


Upgrade or Dist-Upgrade


A Single Package Using Aptitude

sudo aptitude safe-upgrade 'packagename'

A Package Group Using Aptitude

sudo aptitude safe-upgrade '~ipartofpackagename'
sudo aptitude safe-upgrade -v -s '~iclamav'
sudo aptitude safe-upgrade -y '~iclamav'


Old Kernel Versions

Check which are 'automatically' installed...

sudo apt-mark showauto 'linux-image-.*'

Check which are 'manually' installed...

sudo apt-mark showmanual 'linux-image-.*'

Remove a 'automatically' installed kernel...

sudo apt-get autoremove --purge

Remove a 'manually' installed kernel...

sudo dpkg --purge linux-image-4.10.0-27-generic linux-image-extra-4.10.0-27-generic 


A Deb Package Without Removing Its Dependencies

Do not use aptitude, use dpkg instead...

sudo dpkg --remove packagename

Packages With Matching Name

sudo aptitude purge '~npackagename'

sudo aptitude purge '~nabiword' # Using Abiword as an example


DNS Check

systemd-resolve --status

Lock Version Of Package

sudo apt-get install libssl1.1=1.1.1-1ubuntu2.1~18.04.4
sudo apt-mark hold libssl1.1


Debian Package Manager dpkg


Start or Stop Services


Graphics Chipset

inxi -G

Taken from...

      inxi  - Command line system information script for console and IRC

      inxi  - Single line, short form. Very basic output.

      inxi [-AbCdDfFGhHiIlmMnNopPrRsSuw] [-c NUMBER] [-v NUMBER]

      inxi [-t (c or m or cm or mc NUMBER)] [-x -OPTION(s)] [-xx -OPTION(s)] [-xxx -OPTION(s)]

      inxi [--help] [--recommends] [--version] [-@ NUMBER]

Boot Time Hogs

sudo systemd-analyze blame | head -n20

The 3 Different Ways To Start Services In Ubuntu

  • SysV
  • Upstart
  • SystemD

Thanks - http://askubuntu.com/questions/19320/how-to-enable-or-disable-services

Location Of Package Files


View Package Changelog

sudo apt-get changelog packagename

Scan For Wireless WiFi SSIDs On Command Line

sudo iwlist wlan0 scanning | egrep 'Cell |Encryption|Quality|Last beacon|ESSID'

Thanks - http://askubuntu.com/questions/75625/how-do-i-scan-for-wireless-access-points

Nice Documentation On Package Management


Learn What The Aptitude Results Mean

i: Installed package
c: Package not installed, but package configuration remains on system
p: Purged from system
v: Virtual package
B: Broken package
u: Unpacked files, but package not yet configured
C: Half-configured - Configuration failed and requires fix
H: Half-installed - Removal failed and requires fix

Thanks to Server Guide

Clear The Apt Get Cache

To clear the unused downloaded packages:

sudo apt-get autoclean

To clear all downloaded packages:

sudo apt-get clean

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
sudo apt-get update && sudo apt-get --yes upgrade && sudo aptitude -y safe-upgrade

Take A Video Capture Of Your Desktop

ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 -flags gray /tmp/outputFile.mpg

Ubuntu Versions

   Ubuntu 16.04 is xenial
   Ubuntu 15.10 is wily
   Ubuntu 15.04 is "vivid"
   Ubuntu 14.10 is "utopic"
   Ubuntu 14.04.* is "trusty"
   Ubuntu 13.10 is "saucy"
   Ubuntu 13.04 is "raring"
   Ubuntu 12.04.* is "precise"
   Ubuntu 11.10 is "oneiric"
   Ubuntu 11.04 is "natty"
   Ubuntu 10.10 or Trisquel 4.5 is "maverick"
   Ubuntu 10.04 or Trisquel 4.0 is "lucid"
   Ubuntu 9.10 or Trisquel 3.5 is "karmic"
   Ubuntu 9.04 is "jaunty"
   Ubuntu 8.10 is "intrepid"
   Ubuntu 8.04 is "hardy"
   Debian Etch is "etch"
   Debian Lenny is "lenny"


Pending Updates

Nice output...

sudo /usr/lib/update-notifier/apt-check --human-readable

Database output...

sudo /usr/lib/update-notifier/apt-check

This, combined with cron-apt and a daily script will do nicely...

sudo apt-get install cron-apt
sudo nano /etc/cron-apt/config

Applications Where Their Components Are Installed

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.

sudo dpkg -l | grep flash

The returned out put will look similar to this:

ii  adobe-flashplugin Adobe Flash Player plugin version 11


sudo dpkg -L adobe-flashplugin

The output generated will look similar to the following:


Repositories and Back Up The Listing

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup # Or to your desired location

Software Dependencies - or What Associated Packages Does A Programme Rely On?

First you will need to install an additional package:

sudo apt-get install apt-rdepends

Once installed in a terminal:

apt-rdepends <packagename>

For example:

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:

apt-rdepends apache2 | more
apt-rdepends apache2 | less

Services Running

service --status-all

Installed Packages And Use It To Reinstall Packages

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...

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...  :-)


Screen Resolution with HDMI External Monitor

Samsung TV UE49KU6400

xrandr --output HDMI-1 --mode 1440x900

Command Line Aliases

Open a terminal and edit the .bash_aliases file:

nano ~/.bash_aliases

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'
alias pings='ping'
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.yourserver.com'
alias update='sudo apt update'
alias list='sudo apt list --upgradable'
alias upgrade='sudo apt upgrade'
alias uu='sudo apt update && sudo apt upgrade'
alias uuf='sudo apt update && sudo apt dist-upgrade'

Reload the file:

source ~/.bashrc

To confirm the entries:


Buttons Location On Window


Hostname (or what the computer is called) Up To 12.10

The name needs to be changed in the 'hostname' and 'hosts' files.

sudo nano /etc/hostname

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

sudo nano /etc/hosts       localhost.localdomain   localhost       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 is required on an Ubuntu system.

Exit the terminal and reboot the system.

Hostname (or what the computer is called) 16.04 (systemd)

sudo hostname set-hostname new_machine_name

MeMenu Displayed Name

To remove the name from the MeMenu altogether:

gconftool -s /system/indicator/me/display --type int 0

To show your real name/’about me’ name:

gconftool -s /system/indicator/me/display --type int 2

To display the default account username:

gconftool -s /system/indicator/me/display --type int 1

Thanks to OMG Ubuntu.

Panel Icons And Applets Defaults For A New User

sudo nano /usr/share/gconf/defaults/05_panel-default-setup.entries

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


 <-- Workspace Switcher Applet -->


     ...and all the rest up to (but not including) <-- TrashApplet Applet -->

Save and exit the editor, then run...

sudo update-gconf-defaults

Reboot and add a new user to test.

Update Manager 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:

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

To revert the behaviour:

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

Method Two:

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


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.


Open The Additional Drivers Window

sudo software-properties-gtk --open-tab=4

Switch to Root User

sudo su - root

Enter the password for the user profile you are in.

Burning a CD 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'


wodim -scanbus

	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


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


A Package Installed

aptitude search pulseaudio | grep ^i

All Packages Installed

aptitude search '~i!~M'

What CPU Am I Running?

getconf LONG_BIT # Method 1
uname -m  # Method 2
cat /proc/cpuinfo  # Method 3

Thanks to Cyberciti.

What Files Are In The Package X?

apt-file list ffmpeg


dpkg-query -L ffmpeg

Why A Package Has Been Installed

sudo aptitude why <packagename>

What Package Is That File In?

dpkg -S whatever


dpkg -S xfce4-terminal
xfce4-terminal: /usr/bin/xfce4-terminal


sudo apt-get install apt-file
sudo apt-file update
apt-file search whatever


which 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?

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:

apt-cache showpkg openvpn

Which Version Of Ubuntu Linux Am I Running?

cat /etc/lsb-release


cat /etc/issue


uname -a && cat /etc/*release


lsb_release -a





Renaming On Post 15.10 Systems

First determine the names of your network cards:

ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 61:a3:5c:ad:08:f6 brd ff:ff:ff:ff:ff:ff

In the above example the physical network card is name by systemd/udev as enp3s0.

To alter the name to something more conventional:

sudo nano /etc/udev/rules.d/10-network.rules

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="61:a3:5c:ad:08:f6″,KERNEL=="enp3s0″, NAME="eth1″

The above command replaces then name of the network card issued by the kernel to a friendly name.

Save the file and reboot the system.

Thanks to Ubuntu Geek.

Post System Cloning

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:

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


Up To 11.04

sudo nano /etc/network/interfaces

Edit the file to read (this example uses for the system and Google's DNS servers):

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static

Save and close the file, then restart the network:

sudo /etc/init.d/networking restart

Edit the 'hosts' file:

sudo nano /etc/hosts

Edit the file to read (Desktop used for this example):       localhost.localdomain   localhost   Desktop.example.com     Desktop

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Then run:

sudo echo Desktop.example.com > /etc/hostname
sudo /etc/init.d/hostname restart

Check the configuration:

hostname -f

Both of the above commands should return:


At this point it is possible to remove Network Manager:

sudo gedit /etc/NetworkManager/NetworkManager.conf

Edit the [ifupdown] line to read:


Finally remove Network Manager and if you are not using a wireless network card wpasupplicant:

sudo apt-get purge network-manager
sudo apt-get remove wpasupplicant

11.10 onwards



eth0 Missing With NFS Mount



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



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

Login Sound

Method One

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



Unmute all the S/PDIF + S/PDIF Default + S/PDIF 1.


Test to make sure your hardware works first.

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.

aplay /usr/share/sounds/alsa/Noise.wav


Sound Menu Default Player

To add media players to the Ubuntu sound menu do:

gsettings set com.canonical.indicator.sound interested-media-players “['media_player']“

To remove media players from the Ubuntu sound menu do:

gsettings set com.canonical.indicator.sound blacklisted-media-players “['media_player']“

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



gsettings set com.canonical.indicator.sound interested-media-players "['rhythmbox']"


gsettings set com.canonical.indicator.sound interested-media-players "['vlc']"


gsettings set com.canonical.indicator.sound interested-media-players "['banshee']"


HOWTO: SET: Gnome Theme For New Users

sudo nano /usr/share/gconf/defaults/16_ubuntu-artwork


/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...

sudo update-gconf-defaults

Reboot and add a new user to test.

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:

sudo cp -r /home/username/.themes/your_GTk_theme/ /usr/share/themes/

HOWTO: do-release-upgrade

Upgrade Policy

Check the file /etc/update-manager/release-upgrades. Prompt=normal is needed when upgrading from any version to a newer version, Prompt=never will never upgrade your OS. Prompt=lts will make sure you upgrade from LTS to LTS. You need to be root to edit this file.

sudo nano -w /etc/update-manager/release-upgrades


sudo do-release-upgrade -s

HOWTO: Use Ubuntu Nemo File Manager With Specific User Name

Type the following into the address bar of Nemo...


HOWTO: See The Contents Of A Downloaded Debian Package File

sudo dpkg-deb -c package-file.deb

HOWTO: Run A Command On System Startup As Another User

Edit /etc/rc.local and add a line like the following...

# mpdscribble
su -c 'mpdscribble' paully &

# last line
exit 0



Blacklist Modules On Grub Boot

You can also blacklist modules from the bootloader.

Simply add modprobe.blacklist=modname1,modname2,modname3 to your bootloader's kernel-line parameter list.

To do this, press the RIGHT SHIFT key on Ubuntu Boot to show the GRUB Menu. Press the e key to edit, then add the modprobe.blacklist=modulename to the end of the kernel line...

linux /boot/vmlinuz-3.8.0-32-generic root=UUID=1726742d-f8ff-4fd2-a0e3-75c1dd57b65a ro noquiet nosplash modprobe.blacklist=wl

...then press CTRL+X to boot with these temporary options.

X Server

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.


Method B

sudo nano /etc/default/grub

Change the following lines:



sudo update-grub
sudo reboot

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.

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.

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

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


HOWTO: Run A Script When Computer Is Booted Or Shutdown Or Rebooted

To execute a script at startup of Ubuntu

  • Edit /etc/rc.local and add your commands
  • The script must always end with exit 0

To execute a script upon rebooting Ubuntu

  • Put your script in /etc/rc0.d
  • Make it executable (sudo chmod +x myscript)
  • Note: The scripts in this directory are executed in alphabetical order
  • The name of your script must begin with K99 to run at the right time.

To execute a script at shutdown

  • Put your script in /etc/rc6.d
  • Make it executable (sudo chmod +x myscript)
  • Note: The scripts in this directory are executed in alphabetical order

Thanks - http://en.kioskea.net/faq/3348-ubuntu-executing-a-script-at-startup-and-shutdown


Create your script and make sure you have the BASH shebang line at the top as well as the LSB variables...


# Provides:          scriptname
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: scriptname
# Description:       description line in here


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



How To Reset Ubuntu To Factory Defaults


dconf reset -f /

Thanks - http://www.omgubuntu.co.uk/2017/10/how-to-reset-ubuntu-desktop-to-default