Category Archives: Ubuntu

Linux variant primarily used on Desktops and Laptops.

How to mount NTFS volume

 

  • ls /media
  • If you don’t see a folder for your Windows partition, you should create one with the following command:

    sudo mkdir /media/windows

  • Next, mount the partition in read-only mode onto this folder with this command:

    mount -t ntfs-3g -o ro /dev/sda3 /media/windows

 

Remove VirtualBox from Ubuntu

If you need to completely remove VirtualBox, e.g. because a new version install fails preventing future installations then from the Console run commands below:

List VirtualBox installations

sudo dpkg -l | grep virtualbox

Example below

sudo dpkg -l | grep virtualbox
rc virtualbox-4.3 4.3.30-101610~Ubuntu~raring amd64 Oracle VM VirtualBox
iW virtualbox-5.0 5.0.28-111378~Ubuntu~trusty amd64 Oracle VM VirtualBox

Purge these installations in sequence replacing 4.3 and 5.0 with your versions  and answering ‘Y” to questions

sudo  apt-get purge virtualbox-4.3 virtualbox-qt

sudo  apt-get purge virtualbox-5.0 virtualbox-qt

After reboot you should be able to reinstall VirtualBox without errors

Download project folder from GitHub using subversion

Install Subversion (SVN) as follows:

sudo apt-get install subversion

This command exports the GitHub PROJECT folder and subfolders and to DEST

svn export https://github.com/USER/PROJECT/trunk/PATH DEST

Suffix the PROJECT folder with /trunk and append the folder /PATH you wish to download. If the DEST folder does not exist it is automatically created.

For example the following command copies Tutsplus 30-days-to-jquery/lessons folder to lessons folder on the local drive:

svn export https://github.com/tutsplus/30-days-to-jquery/trunk/lessons lessons

 

 

Create ISO file from CD/DVD using DD

In Linux/Ubuntu to create an ISO from a CD/DVD is simplicity itself using the DD command

Use lsbk to determine the CD device name

lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0   1.8T  0 disk
├─sda1   8:1    0    50G  0 part /
├─sda2   8:2    0    10G  0 part [SWAP]
├─sda3   8:3    0   1.6T  0 part /home
└─sda4   8:4    0    50G  0 part
sdb      8:16   0   1.8T  0 disk
├─sdb1   8:17   0   100G  0 part
├─sdb2   8:18   0    20G  0 part
├─sdb3   8:19   0   250G  0 part
├─sdb4   8:20   0     1K  0 part
├─sdb5   8:21   0    50G  0 part
├─sdb6   8:22   0  1000G  0 part /media/NTFS_DATA
└─sdb7   8:23   0   443G  0 part
sr0     11:0    1  25.6M  0 rom  /media/mike/NEW 
loop1    7:1    0  25.6M  1 loop /media/iso

Create ISO file with DD

dd if=/dev/sr0 of=/home/mike/Downloads/test.iso

Create Mount Point

sudo mkdir /media/iso

Mount ISO file

sudo mount -o loop /home/mike/Downloads/test.iso /media/iso

Unmount ISO File

sudo umount /media/iso

Remove Mount Point

sudo rmdir /media/iso

Terminal History Manipulation

 BASH (Bourne Again SHell) is the default command line shell used in Ubuntu and Kubuntu and many other Linux distributions. BASH allows you view and manipulate the command line history.

The following examples are from Kubuntu Konsole

List History

user@hostname:~$ history
1 sudo restart
2 sudo restart --help
3 reboot
4 sudo reboot
.
..
...
709 history
user@hostname:~$

List last 10 lines of history

user@hostname:~$ history 10
700 dmesg | less | grep error
701 sudo nano /etc/modprobe.d/alsa-base.conf
702 history
703 ls
704 cd Annex
705 cd Annex 1
706 cd Music
707 cd ..
708 echo $PROMPT_COMMAND
709 history 10
user@hostname:~$

Search History

Search history for lines containing “fastboot”

user@hostname:~$ history | grep fastboot
170 sudo apt-get install android-tools-fastboot android-tools-adb
172 fastboot ?
175 fastboot devices
176 fastboot getvar ?
177 fastboot reboot
178 fastboot devices
183 fastboot devices
184 fastboot reboot
187 fastboot devices
516 fastboot oem get_identifier_token
518 fastboot oem get_identifier_token
520 fastboot oem get_identifier_token
711 history | grep fastboot
user@hostname:~$

Run Previous Command

!n where n is the command line number

user@hostname:~$ !138
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.3 LTS
Release:        14.04
Codename:       trusty
user@hostname:~$ 

Note that the first line of output echoes the command itself

For more information see Chris Jean’s excellent blog Command Line History

 

Disable Linux Mouse Wheel Click Paste

Follow the steps below to disable mouse middle or wheel click button:

  1. First from Terminal run “xinput list” to discover your mouse device name, e.g. in this example it is “Microsoft Microsoft Wheel Mouse Optical®“.
xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Belkin Corporation Flip KVM id=8 [slave pointer (2)]
⎜ ↳ Microsoft Microsoft Wheel Mouse Optical® id=10 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
 ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
 ↳ Power Button id=6 [slave keyboard (3)]
 ↳ Power Button id=7 [slave keyboard (3)]
 ↳ Belkin Corporation Flip KVM id=9 [slave keyboard (3)]
 ↳ LITE-ON Technology USB NetVista Full Width Keyboard. id=11 [slave keyboard (3)]
  1. From the console run xinput get-button-map with the mouse device name above to output the mouse button map. The first three digits (1 2 3) of the button map of interest represent the left, middle, and right mouse buttons. A non-zero digit means the button is enabled. Setting digit 2 to zero  disables the mouse middle or wheel click button, e.g. the map would read 1 0 3 4 5 6 7 is it is disabled.
/usr/bin/xinput get-button-map "Microsoft Microsoft Wheel Mouse Optical®"
1 2 3 4 5 6 7
  1. To disable the wheel click at login create a desktop file, e.g. “mousewheelpasteoff.desktop” with the contents below and save it to ~/.config/autostart folder. The xinput set-button-map command below disables the mouse middle or wheel click button
[Desktop Entry]
Name=Disable mouse wheel click at login
Exec=xinput set-button-map "Microsoft Microsoft Wheel Mouse Optical®" 1 0 3 4 5 6 7
Icon=utilities-terminal
Terminal=false
Type=Application
Categories=Utility;Application;
  1. Alternatively in Terminal run the command directly to disable it only for the current session.
/usr/bin/xinput set-button-map "Microsoft Microsoft Wheel Mouse Optical®" 1 0 3 4 5 6 7

 

Stop Spotify Stealing Windows Focus

This cure is applicable to Linux based systems such as Kubuntu and Ubuntu.

Stop those annoying pop-ups intruding into your workspace by simply running Spotify Music player in a second desktop window and leave it maximised as follows:

  1. Go to System Settings/Workspace Behaviour/Virtual desktops and increase the number of desktops to 2
  2. Activate second desktop by typing Ctrl-F2
  3. Launch Spotify and select the music you like to play
  4. Switch back to main desktop by typing Ctrl-F1 or select desktop from System Tray icon and continue working!

This leaves Spotify nicely out of sight but still controllable from the System Tray icon.

This works for Ubuntu too. Here Desktops are better known as Workspaces. Use Ctrl+Alt+Right or Ctrl+Alt+Left-arrow or System Tray icon to switch workspace.

From Ubuntu 13.04 onwards extra Workspaces are disabled by default. To enable Workspaces  go to System Settings/Appearance/Behaviour and tick the “Enable Workspaces” .