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.

Contents

HOWTO: DISABLE

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

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
enabled=0

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)

DNSMasq

sudo nano /etc/NetworkManager/NetworkManager.conf

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

[main]
plugins=ifupdown,keyfile,ofono
# dns=dnsmasq

[ifupdown]
managed=false

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:

<allow_active>yes</allow_active>

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

<allow_active>no</allow_active>

Thanks Liberian Geek.

Synaptic Touchpad

synclient TouchpadOff=1 # To disable

synclient TouchpadOff=2 # To enable

List of options:

synclient -l

Output

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

HOWTO: ENABLE

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
fi

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
      fi
    fi'

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_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:-

sudo update-grub && sudo reboot

Linux Thermal Daemon (Intel Chipsets)

http://www.webupd8.org/2014/04/prevent-your-laptop-from-overheating.html

HOWTO: FIX:

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

Problem...

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

Fix...

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

HOWTO: INSTALL

Latest Available Kernel

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.10.0-27-generic linux-image-extra-4.10.0-27-generic linux-headers-4.10.0-27-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/

Fix for Intel Chipset

The latest kernel will most likely need a newer Firmware for your chipset, otherwise Video, Wireless and USB will not work!

Error...

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

Save the following lines of code to a file and make it executable, then run it from the command line...

#!/bin/bash
cd
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

https://01.org/linuxgraphics/downloads/kabylake-dmc-1.01

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
or
sudo dpkg -i --force-depends *.deb

Download But Not Install A Package

sudo aptitude download package-name

Fonts

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

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

HOWTO: MODIFY:

Default Text Editor System Wide

sudo update-alternatives --config editor

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

HOWTO: UPDATE:

Upgrade or Dist-Upgrade

Ubuntu_Server#APT-GET_UPGRADE_OR_APT-GET_DIST-UPGRADE.3F

A Single Package Using Aptitude

sudo aptitude safe-upgrade 'packagename'

A Package Group Using Aptitude

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

HOWTO: UNINSTALL:

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

HOWTO: INFO:

Graphics Chipset

inxi -G

Taken from...

NAME
      inxi  - Command line system information script for console and IRC

SYNOPSIS
      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

/var/cache/apt/archives/

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

http://www.tecmint.com/useful-basic-commands-of-apt-get-and-apt-cache-for-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"

HOWTO: LIST:

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 11.2.202.228-0oneiric1 Adobe Flash Player plugin version 11

Next:

sudo dpkg -L adobe-flashplugin

The output generated will look similar to the following:

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

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

HOWTO: ALTER:

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

alias

Buttons Location On Window

http://www.howtogeek.com/howto/13535/move-window-buttons-back-to-the-right-in-ubuntu-10.04/

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

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.

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

         <value>
           <string>workspace_switcher</string>
         </value>

 <-- Workspace Switcher Applet -->

   <entry>
     <key>applets/workspace_switcher/object_type</key>
     <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
     <value>
       <string>bonobo-applet</string>

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

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.

HOWTO: TERMINAL/CLI:

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

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

HOWTO: FIND:

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

or

dpkg-query -L ffmpeg

Why A Package Has Been Installed

sudo aptitude why <packagename>

What Package Is That File In?

dpkg -S whatever

Example

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

or

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

Example:

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?

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

or

cat /etc/issue

or

uname -a && cat /etc/*release

or

lsb_release -a

or

hostnamectl

NETWORKING

HOWTO: NETWORK CARD NAMING:

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
reboot

HOWTO: STATIC IP ADDRESS:

Up To 11.04

sudo nano /etc/network/interfaces

Edit the file to read (this example uses 192.168.0.100 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
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 8.8.8.8 8.8.4.4

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

127.0.0.1       localhost.localdomain   localhost
192.168.0.100   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
hostname -f

Both of the above commands should return:

Desktop.example.com

At this point it is possible to remove Network Manager:

sudo gedit /etc/NetworkManager/NetworkManager.conf

Edit the [ifupdown] line to read:

managed=true

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

http://adamish.com/blog/archives/315

HOWTO: FIX:

eth0 Missing With NFS Mount

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

SOUND

DISABLE:

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

FIX:

ALSA + NVIDIA + ION + HDMI

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

alsamixer

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

MODIFY:

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.

Examples:

Rhythmbox:

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

VLC:

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

Banshee:

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

THEME

HOWTO: SET: Gnome Theme For New Users

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

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

Testing

sudo do-release-upgrade -s

HOWTO: Use Ubuntu Nemo File Manager With Specific User Name

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

smb://username@123.456.789.0/sharedfolder/

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

http://askubuntu.com/questions/90406/startup-script-for-a-specific-user-on-ubuntu-server

HOWTO: Stop

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.

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="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT="text"
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
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

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

OR

Create your script and make sure you have the BASH shebang line at the top;

#!/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

Domain

http://www.markwilson.co.uk/blog/2007/05/using-active-directory-to-authenticate-users-on-a-linux-computer.htm

How To Reset Ubuntu To Factory Defaults

Terminal...

dconf reset -f /

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