Archive for the ‘Ubuntu’ Category

Reboot linux at specific time

August 13th, 2019 No comments

Sometimes you want to reboot a server in the middle of the night. With linux it’s as simple as this command:

shutdown -r 04:00

Which will reboot the machine at 4 am in the morning. If you need to abort the reboot, use the following to abort the reboot:

shutdown -c
Categories: Bash, Linux, Red Hat / CentOS, Ubuntu Tags:

Mount exFAT in Ubuntu 18.04

August 8th, 2019 No comments

The exFAT file system is created by Microsoft to overcome the 4GB file size limit in FAT. To mount such an partition you need to enable exFAT. Otherwise you’ll get an error saying can’t mount unknown filesystem type “exfat”. In Ubuntu 18.04 it’s simple, just open a terminal and type:

sudo apt install exfat-fuse exfat-utils

If this doesn’t work you might need to add the “universe” repository first. Here’s an example followed by a mount of the device at /dev/sdb1. Replace this device with your own device:

sudo add-apt-repository universe
sudo apt update
sudo apt install exfat-fuse exfat-utils
sudo mkdir /mnt/myEXFAT
sudo mount /dev/sdb1 /mnt/myEXFAT

To list devices and their partitions, use the command:

sudo parted -l

Beware that exFAT can’t handle certain characters in the file names, like “:”. If you need to rename multiple file names you can modify the below example that replaces all “:”-characters with an underscore “_” in the current directory:

find . -depth -maxdepth 1 -name '*:*' -execdir bash -c 'mv -- "$1" "${1//:/_}"' bash {} \;

Categories: Bash, Linux, Ubuntu Tags:

Upgrade Ubuntu Linux using command line

August 6th, 2019 No comments

To upgrade Ubuntu Linux open up a terminal and type:


The old way using apt isn’t needed in Ubuntu to upgrade the system. dist-upgrade has been superseded in Ubuntu by full-upgrade.

The do-release-upgrade command can be run as an user with admin rights without sudo. The user password will be asked when starting the command. The system will then make different checks before the upgrade starts. If using SSH an additional port will be opened on port 1022 that can be used if the ordinary SSH-tunnel are broken during the update.

Categories: Bash, Linux, Ubuntu Tags:

Prepare Linux for source compile

August 11th, 2012 No comments

1. Install packages to build the kernel modules

sudo apt-get install autoconf automake binutils make cpp gcc linux-headers-$(uname -r)

2. Find out where the kernel headers are (you may need this later)

ls -d /usr/src/linux-headers-$(uname -r)*/include

i.e. /usr/src/linux-headers-2.6.31-14-generic-pae/include

i.e. /lib/modules/2.6.31-14-generic-pae/build/include

3. Get the kernel source

sudo apt-get build-dep linux-image-$(uname -r)

sudo apt-get source linux-image-$(uname -r)

Categories: Bash, Linux, Programmering, Ubuntu Tags:

A faster and safer Firefox experience

August 11th, 2012 No comments

Here are a few tips to make your Mozilla Firefox experience faster, safer and more private. Most “average” users might not bother with these, but the more discerning types will find them helpful.

1. Install the following Firefox extensions – NoScript, Ghostery, Adblock Plus, OptimizeGoogle.

2. Type “about:config” (no quotes) in the address bar.

Toggle network.http.pipelining to “true”.

Toggle network.http.proxy.pipelining to “true”.

Then set integer value for network.http.pipelining.maxrequests to 40.

Right-click anywhere that’s blank on the page and then create a new item called “nglayout.initialpaint.delay” and set its integer value to 0 (zero)

The Ghostery extension will allow you to selectively block hidden data-gathering activities such as traffic-ranking, click-throughs and such stuff like that, which can monitor what you do on the net. Some of that stuff is probably harmless but slows down your browsing experience during its data-gathering phase. The other extension recommendations are well-known as to what they do.

Categories: Ubuntu, Windows Tags:

Installera Java 7 i Ubuntu x64

August 9th, 2012 No comments

Install Java JRE in Ubuntu x64:

Firefox Java plugin installation in Kubuntu x64:

1. Download Java from Oracle/Sun, unpack.

2. cd /usr/lib/mozilla/plugins

3. sudo ln -s /home/user/Downloads/jre1.6.0_29/lib/amd64/

Categories: Linux, Ubuntu Tags:

Download gscan2pdf source and run

May 9th, 2012 No comments


Ladda ner koden:

cd ~/code
git clone git://

Skapa en länk så Perl hittar filerna:

sudo mkdir /usr/local/lib/perl
cd /usr/local/lib/perl
sudo ln -s /home/holm/code/gscan2pdf/lib 5.12.4

Starta programmet:


// Tobias 2012-01-01


Install gscan2pdf from Ubuntu repositories to get most of the dependencies:

$ sudo apt-get install gscan2pdf git libsane-dev libcanberra-gtk-module

You might get the following packages when installing gscan2pdf:

Följande NYA paket kommer att installeras:
cuneiform cuneiform-common gocr gscan2pdf libconfig-general-perl libcuneiform0 libextutils-depends-perl libextutils-pkgconfig-perl libfont-ttf-perl libgoo-canvas-perl libgtk2-ex-podviewer-perl libgtk2-ex-simple-list-perl libgtk2-imageview-perl libgtkimageview0 libio-stringy-perl libjpeg-progs libjpeg-turbo-progs libleptonica liblog-log4perl-perl libpdf-api2-perl libproc-processtable-perl libreadonly-perl libset-intspan-perl libtesseract3 libtiff-tools libwebp2 perlmagick tesseract-ocr tesseract-ocr-eng tesseract-ocr-equ tesseract-ocr-osd

Download the source via git:

$ git clone git://

Enter the directory. If you try to run it you can get this error:

$ bin/gscan2pdf
 Can't locate Gscan2pdf/ in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.12.4 /usr/local/share/perl/5.12.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.12 /usr/share/perl/5.12 /usr/local/lib/site_perl .) at bin/gscan2pdf line 121.                                      
 BEGIN failed--compilation aborted at bin/gscan2pdf line 121.

This is because the Perl script can’t find some libraries. To solve it, add the following at the top of bin/gscan2pdf:

use lib "/home/holm/code/gscan2pdf/lib/";

This is another problem you can bump into:

$ bin/gscan2pdf
 Sane version 0.05 required--this is only version 0.03 at /etc/perl/Gscan2pdf/Scanner/ line 7.
 BEGIN failed--compilation aborted at /etc/perl/Gscan2pdf/Scanner/ line 7.
 Compilation failed in require at /etc/perl/Gscan2pdf/ line 7.
 BEGIN failed--compilation aborted at /etc/perl/Gscan2pdf/ line 7.
 Compilation failed in require at bin/gscan2pdf line 121.
 BEGIN failed--compilation aborted at bin/gscan2pdf line 121.

To fix it, download Sane version 0.05:

Enter the folder where you downloaded the files and try to install Sane:

$ perl Makefile.PL
 Perhaps you should add the directory containing `sane-backends.pc'
 to the PKG_CONFIG_PATH environment variable
 No package 'sane-backends' found at Makefile.PL line 21
 Writing Makefile for Sane
 Writing MYMETA.yml

Ops! Install sane-backends components:

$ sudo apt-get install libsane-dev

Now compile Sane:

$ perl Makefile.PL
$ make
$ make test
$ sudo make install

Enter gscan2pdf folder and run the program:

$ cd ../gscan2pdf
$ bin/gscan2pdf

This is another error:

$ bin/gscan2pdf 
Bareword "Gscan2pdf::_cancel_process" not allowed while "strict subs" in use at /etc/perl/Gscan2pdf/ line 595.
Compilation failed in require at bin/gscan2pdf line 54.
BEGIN failed--compilation aborted at bin/gscan2pdf line 54.

Fix it by manually cleaning up a previous installation of Gscan2pdf.

sudo apt-get remove gscan2pdf
sudo rm -rf /etc/perl/Gscan2pdf
Categories: Bash, Linux, Ubuntu Tags:

Standard Client Ubuntu 10.10/11.04/11.10

May 6th, 2011 No comments

This is the steps I use to configure a new Ubuntu client:

  • Install Ubuntu from USB/CD/PXE

Then add the following programs in the Program Central:

  • Chromium
  • GIMP
  • gscan2pdf
  • PDF Editor
  • Thunderbird
  • Filezilla
  • KVpnc
  • Pidgin
  • Remmina
  • Wireshark
  • XChat IRC
  • Zenmap
  • tn5250
  • Audacity
  • Desktop recorder
  • GNOME MPlayer
  • ISO Master
  • VLC
  • MuseScore
  • OpenShot Video Editor
  • UNetbootin
  • Filelight
  • TrueCrypt
  • Wine + Spotify
  • apt-get packages to source compile ffmpeg

Install the following programs from different sources (Google 😉 )

sudo add-apt-repository ppa:dockbar-main/ppa
sudo apt-get update && sudo apt-get install dockbarx
sudo apt-get install dockbarx-themes-extra

  • Synergy (
  • BankID (in 64-bit Linux: sudo apt-get install nspluginwrapper && sudo nspluginwrapper -i /usr/local/lib/personal/

After this it’s time to restore my home folder from a backup.

Files to manually restore:

  • /etc/X11/xorg.conf
sudo nvidia-xconfig --post-tree --twinview


Configs to manually restore:

  • Compiz config, effects
  • X key bindings (Super+Up=Maximize vertically, Super=ScrClip)
  • Startup programs (Synergy)
  • add NAS to fstab
  • crontab (Backup once every hour to NAS + SD-card)
  • crontab for root (apt-get autoclean = free space in /var/cache/apt/archives)
  • Ubuntu One
  • Network printers (DeskJet 970, CLJ2600)

Add link support in Firefox for Second Life:

  • Type about:config in Firefox address field
  • Right-click any item in the list and select New > Boolean
  • Type: network.protocol-handler.external.secondlife
  • Set the value to true. This tells Firefox to use an external program to handle the secondlife:// protocol
  • Right-click any item in the list and select New > String
  • Type:
  • Type the path to the program you want to use for that protocol (e.g. /home/holm/dump/SecondLife-i686- )

Add the Q700 (TS-219P) printer: smb://nas/naspr2

To enable OpenShot x264 you must install unrestricted codecs:

Install support for CSS encrypted DVD movies:

  • sudo apt-get install libdvdread4
  • sudo /usr/share/doc/libdvdread4/
    Rebooting may be necessary.

Install Java plugin in Firefox (Kubuntu x64):

  • Download Java from Oracle/Sun, unpack bin-file (first set x-flag)
  • cd /usr/lib/mozilla/plugins
  • sudo ln -s /home/user/Downloads/jre1.6.0_29/lib/amd64/

If you have a folder with scripts you can add it to the path:

  • Edit the file “~/.profile” and add the path.

Disable Overlay Scrollbars in Ubuntu Natty:

  • echo “export LIBOVERLAY_SCROLLBAR=0” | sudo tee /etc/X11/Xsession.d/80overlayscrollbars> /dev/null
  • Or remove the whole package: sudo apt-get remove overlay-scrollbar

Restore debconf backup

According to section 6.4.9 ( of the Debian Reference Manual (, the following will save both the list of packages installed and their debconf configuration:

# dpkg –get-selections “*” >myselections # or use \*
# debconf-get-selections > debconfsel.txt

and the following will reinstall and reconfigure them:

# dselect update
# debconf-set-selections < debconfsel.txt
# dpkg –set-selections <myselections
# apt-get -u dselect-upgrade # or dselect install

Categories: Linux, Ubuntu Tags:

Synergy to control keyboard and mouse

April 14th, 2011 No comments

Synergy is a very good program for sharing mouse and keyboard. It’s free and open source too! There are compiled versions for Windows / Linux and Mac.

Set up one computer as server and then control the mouse and keyboard on several others through the network.
To autostart the client on an Ubuntu after login, add a startup program and run the following script:
sh -c 'ps -A|grep -w synergyc; if [ $? -eq 0 ]; then echo KILLING; \
/usr/bin/killall -9 synergyc; fi; /usr/bin/synergyc YOURSERVERIP
You have to log in to the Ubuntu desktop first before you can control it from another computer. You can start the Synergy client before logon, but it’s a bit harder. In Ubuntu 10.10 with Gnome you can edit the following files to start the Synergy client before logon:
sudo gedit /etc/gdm/Init/Default
sudo gedit /etc/gdm/PostLogin/Default
Put the Synergy start script above in the first file (without the sh -c and quotation marks) and put just the kill code in the second file. See the Synergy home page for more info.


Categories: Bash, Linux, Ubuntu, Windows Tags:

Tweak Ubuntu desktop

April 7th, 2011 No comments

Some tips for tweaking the Ubuntu 10.10 desktop:

Install dockbarx

sudo add-apt-repository ppa:dockbar-main/ppa && sudo apt-get update && \
sudo apt-get install dockbarx && sudo killall gnome-panel

Then right click a Gnome panel, select “Add to panel” and add DockBarX.

Compiz desktop

Enable the screenshot feature. Click “Super”+Left mousebutton to get a screenshot.

Categories: Linux, Ubuntu Tags: