Tips & tricks

Ubuntu

How to install/update/upgrade Firefox browser

Best and recommended way to update Firefox is to update Ubuntu. From Lucid (10.04) and higher, Firefox will be upstreamed in main. You don't need to add any PPA to get the newest Firefox.
To update Firefox along with other Update run following commands

$ sudo apt-get update
$ sudo apt-get upgrade

Update Firefox with latest available version in Ubuntu. [Security-testing packages]

Not recommended but useful for developer.
Usually new Firefox version available within a few hours of Mozilla's announcement, sometimes faster, depending on the archive builders, and the speed of your local mirror, etc. You can update Firefox with latest version anytime if you do not want to wait till it available in official repository.

$ sudo add-apt-repository ppa:ubuntu-mozilla-security/ppa
$ sudo apt-get update
$ sudo apt-get install firefox

How to install/update/upgrade Opera browser

Add Opera repository:

$ sudo sh -c 'echo "deb http://deb.opera.com/opera-stable/ stable non-free" >> /etc/apt/sources.list.d/opera.list' 
$ wget -O - http://deb.opera.com/archive.key | sudo apt-key add -
$ sudo apt-get update

The packages in repository:

To install Opera browser (stable):

$ sudo apt-get install opera-stable

Mongo database not working after crash

$ locate mongod.lock
$ sudo rm /var/lib/mongodb/mongod.lock

'locate' could not find the file

$ sudo updatedb

How to reset unity panel (bar at the top)

$ killall unity-panel-service

Menubar icons broken, wrong menubar colors

Create .sh script, make it executable and put it in the startup:

#!/bin/bash
killall unity-panel-service

Date / time on unity panel (bar at the top)

$ gsettings set com.canonical.indicator.datetime show-date true
$ gsettings set com.canonical.indicator.datetime show-date false
$ gsettings set com.canonical.indicator.datetime show-day true
$ gsettings set com.canonical.indicator.datetime show-day false
$ gsettings set com.canonical.indicator.datetime show-clock true
$ gsettings set com.canonical.indicator.datetime show-clock false

How to list files beginning with “D”

$ ls -ald D*
$ ls -al --ignore='[!D]*'
$ find -maxdepth 1 -iname "D*"
$ find -maxdepth 1 -name '[D]*' -print

How to install light themes

$ sudo  apt-get  install  light-themes

How to reinstall light themes

$ sudo  apt-get  remove  light-themes

Then log off or restart.
Again log in.

$ sudo  apt-get  install  light-themes

How to disable Shopping Suggestions in search (For Ubuntu 12.10 and newer)

When you do a search from the Dash in Ubuntu 12.10 or newer versions, it offers additional search results including shopping suggestions, a feature known as “Shopping Lens” or “Unity Smart Scopes”, underneath the local search results by default.
If you don't like these suggestions, you can turn them off or back on.

For Ubuntu 13.10

Click the Dash Home icon on the Launcher and click “Filter results” next to the search box.
Deselect the categories or sources that you want to exclude from the search results.

For Ubuntu 12.10 and 13.04

You can disable (or re-enable) the Shopping Lens by entering the command below in the Terminal, then log out and back in.
To disable:

$ sudo apt-get remove unity-lens-shopping

To re-enable:

$ sudo apt-get install unity-lens-shopping

Alternatively in either of the versions above, you can follow these simple steps to opt out of the online search results:
Click the Control Gear and select “System Settings”.
Under Personal, select “Security & Privacy” (or just “Privacy” in older versions).
Under the Search tab, turn off “When searching in the Dash: Include online search results”, then log out and back in.

How to set keyboard layout to Croatian after reboot

Create .sh script, make it executable and put it in the startup:

#!/bin/bash
setxkbmap hr

Mount additional hard drive

Create partitions

$ sudo gparted

Find out drive’s address and UUID

$ sudo blkid

Add drive to /etc/fstab

$ sudo vi /etc/fstab

The example of line to add in /etc/fstab:

/dev/sdb1    /media/DATA    ext4    defaults    0    0

Dual monitor config

First let’s see your output devices:

$ grep 'Output .*connected' /var/log/Xorg.0.log

The output will be similar to this lines:

[     5.664] (II) intel(0): Output VGA1 connected
[     5.664] (II) intel(0): Output HDMI1 connected
[     5.664] (II) intel(0): Output DP1 disconnected
[     5.664] (II) intel(0): Output VIRTUAL1 disconnected

Please notice device names “VGA1” and “HDMI1”.
Your devices can have different names.

Next create config file:

$ vi /usr/share/X11/xorg.conf.d/10-monitor.conf

The contents of the file:

Section "Device"
        Identifier "IntelCard"
        # Driver "intel"
        Option "monitor-VGA" "VGA1"
        Option "monitor-HDMI" "HDMI1"
EndSection

Section "Monitor"
        Identifier "HDMI1"
        ModelName "Acer"
        Modeline "2560x1440_40.00"  200.80  2560 2712 2984 3408  1440 1441 1444 1473  -HSync +Vsync
        Modeline "2560x1440_45.00"  227.75  2560 2720 2992 3424  1440 1443 1448 1480 -hsync +vsync
        Modeline "2560x1440_50.00"  256.25  2560 2736 3008 3456  1440 1443 1448 1484  -HSync +Vsync
        Option "PreferredMode" "2560x1440_40.00"
        Option "Primary" "On"
EndSection

Section "Monitor"
        Identifier "VGA1"
        ModelName "LG"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device "IntelCard"
        Monitor "HDMI1"
        DefaultDepth 24
        SubSection "Display"
                Depth 24
                Modes "2560x1440_40.00" "2560x1440_45.00" "2560x1440_50.00"
        EndSubSection
EndSection

Section "Screen"
        Identifier "Screen1"
        Device "IntelCard"
        Monitor "VGA1"
        DefaultDepth 24
EndSection

How to Disable overlay Scrollbars on ubuntu 14.04 LTS

Open terminal and run this command

$ gsettings  set  com.canonical.desktop.interface  scrollbar-mode  normal

If you want to get back overlay Scrollbars, enter this command:

$ gsettings  reset  com.canonical.desktop.interface  scrollbar-mode

How top disable HUD popup

HUD (Head-Up Display) is the search that pops up when Alt key is pressed.

System Settings --> Keyboard --> Shortcuts --> Launchers --> Key to show the HUD
Use "Backspace" key to remove key binding (disable)

How to prevent files from being shown in Unity dash? (to have only applications)

The files and folders lens is just another package in Ubuntu. To remove it all you have to do is:

$ sudo  apt-get  remove  unity-lens-files

You will have to log out and back in, or reboot for it to take effect.

How to disable Zeitgeist

As first step I suggest you just disable logging, you can also blacklist everything or turn off logging altogether. To check if the daemon is running you can run a ‘ps’ like this one:

$ ps -ef |grep zeit

linuxaria  2085     1  0 16:31 ?        00:00:00 /usr/bin/zeitgeist-daemon
linuxaria  2093     1  0 16:31 ?        00:00:00 /usr/lib/zeitgeist/zeitgeist-fts
root       8372  8300  0 18:48 pts/0    00:00:00 grep --color=auto zeit

Now on a terminal run these commands with your normal user (not root):

$ chmod -rw ~/.local/share/zeitgeist/activity.sqlite
$ zeitgeist-daemon --replace

[16:53:46.292663 WARNING] Could not access the database file.
Please check the permissions of file /home/linuxaria/.local/share/zeitgeist/activity.sqlite.

The first command remove the possibility to read and write to the file ~/.local/share/zeitgeist/activity.sqlite to everyone and the second restart zeitgeist, and you’ll get an error, congratulations you have just stopped the zeitgeist daemon while keeping your information.

Enable Zeitgeist

If you see that is something is wrong and you want to reactivate the daemon previously disabled by the script above just run:

$ chmod +rw ~/.local/share/zeitgeist/activity.sqlite
$ zeitgeist-daemon --replace

How to remove Zeitgeist

As first thing discover which Zeitgeist packages are installed on your system with:

$ dpkg -l | grep zeit

ii  libzeitgeist-1.0-1     0.3.18-1ubuntu1     library to access Zeitgeist - shared library
ii  python-zeitgeist       0.9.0-1ubuntu1      event logging framework - Python bindings
ii  zeitgeist-core         0.9.0-1ubuntu1      event logging framework - engine

And once you have the names of the packages (the second column) you can run the command apt-get purge names such as:

$ sudo apt-get purge libzeitgeist-1.0-1 python-zeitgeist zeitgeist-core

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  gedit libzeitgeist-1.0-1 python-zeitgeist zeitgeist-core
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
After this operation, 3,921 kB disk space will be freed.
Do you want to continue [Y/n]? y

How to sort text in Geany editor

How to check Ubuntu version from shell

$ lsb_release -a

(c) 2017 horvoje.net