ubuntu

A 8-post collection

Swap Alt and Ctrl Ubuntu 16.04

Using dconf-editor, if you have already tried the xmodmap way, tried this one ... it's superior because the xmodmap will fail (and need to be rerun) after you change the keyboard layout, furthermore, it has no currently reliable way to start it on login or after boot.

So, let's get started, if you don't have one:

sudo apt install dconf-editor  

Open it up, and see the org.gnome.desktop.input-sources.xkb-options, you might see [] for now, but update it to ['ctrl:swap_lalt_lctl','ctrl:swap_ralt_rctl'].

You should see the effect immediately.

Furthermore, you might have problem with alt+tab (now currently is ctrl+tab), if you want to change to ctrl+tab, just to keep it matched with the physical alt, read on.

Change Alt + Tab to Ctrl + Tab

It turns out even you have the unity-tweak-tool it's not at all straightforward to change this, because the tool won't allow you to bind ctrl+tab actually it won't allow even alt+tab, I think it's a bug or the app has no privilege to intercept the alt+tab itself.

So, another way is through the compizconfig-settings-manager, if you don't have it just install.

In it, you should find the Ubuntu Unity Plugin section, go to Switcher.

Now update it to be as follows, see the Key to start the switcher is now set to <Control>Tab:

If you want to also change the shortcut for switching windows in the same app (which default is alt + grave accent), you may change it now with the Key to flip through windows in the Switcher set it to control + grave accent instead.

อ่านต่อ »

A Rule of thumb to Install Ubuntu Alongside with Windows

A rule of thumb is: if you install windows in UEFI mode (which Windows 10 is almost always be), you will need to install Ubuntu in UEFI mode as well.

If you missed that out prepare to have problems with booting. This kind of problem won't be fixed with ANY tools regrading the booting problems, maybe any is an overstatement, but I did try the boot-repair (https://help.ubuntu.com/community/Boot-Repair), all it's saying was boot it with UEFI mode.

So, how to install Ubuntu with UEFI mode then ?

As the link suggests, you can make sure that you do it right if you create an only UEFI bootable usb. This way you can guarantee that if it works it's gonna work right.

The process of creating a UEFI bootable usb is in the link, but I will recap it here:

  1. Insert USB.
  2. Format it to FAT32, flag it with boot and lsb, you might use the Gparted to do this.
  3. Mount the USB.
  4. Copy all files from the .iso file, to the USB, including all hidden files (ctrl + h, in nautilus to see the hidden files)
  5. But, I prefer this way better, 7z x <.iso_file> -o<usb_mount_path_with_trailing_slash>
  6. That's all.

Tried to boot it, you might have to set your bios to enable UEFI mode or even prefer it first.

If you already have problem

You still can make it boot up, but only with the help of Super Grub2 Disk (http://www.supergrubdisk.org/super-grub2-disk/), it will automatically detect all installed bootable OSes in all your drives, you can select one of the option and boot into your os. It's not permanent at least you can boot into.

If you want to reinstall grub2, you can try sudo

อ่านต่อ »

Screenshot in Ubuntu using Shutter

You probably have this app pre-installed so search for it first.
If not, in any case, install it via apt install shutter.

Now, we will start using it.

Open the app Shutter, and go right to the preferences pane.

On the first page you might want to select automatically save file and automatically copy screenshot to clipboard like this:

And to keep the shutter programe from opening after we capture the screenshot you might want to uncheck the present main window after taking a screenshot option like this:

Now, the only part left is to bind it with shortcuts, we'll go to the keyboard settings, if you can't remember it's this one:

Go to the shortcuts menu, and create some:

Each of which is described as follows:

Note that these are the shutter options you can see full list from shutter --help

อ่านต่อ »

Install Samba Server on Ubuntu

(thread: https://help.ubuntu.com/community/How%20to%20Create%20a%20Network%20Share%20Via%20Samba%20Via%20CLI%20(Command-line%20interface/Linux%20Terminal)%20-%20Uncomplicated,%20Simple%20and%20Brief%20Way!)

sudo apt-get update  
sudo apt-get install samba  
sudo smbpasswd -a <user_name>  
# backup 
sudo cp /etc/samba/smb.conf ~  
sudo vim /etc/samba/smb.conf  

Add this at the end of file (shortcut G):

[<folder_name>]
path = <full_path_to_shared_folder>  
valid users = <user_name>  
read only = no  
# restart to take effect
sudo service smbd restart  
อ่านต่อ »

Ubuntu 16.04 Init (with Docker)

This should be a bunch of commands, handy just for my use.

Create User

adduser user  
# add to sudo group
usermod -aG sudo user  
# from your station
ssh-copy-id [email protected]  

Or

# manually
# from your station
cat ~/.ssh/id_rsa.pub  
# copy it
# to your remote (user)
mkdir ~/.ssh  
chmod 500 ~/.ssh  
vim ~/.ssh/authorized_keys  
# paste it, save, quit
chmod 600 ~/.ssh/authorized_keys  

Swapfile

(thread: https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04)

Allocate

sudo fallocate -l 1G /swapfile  

Enable

sudo chmod 600 /swapfile  
sudo mkswap /swapfile  
sudo swapon /swapfile  
# see the result
sudo swapon --show  

Make Swap Permanent

# back up old setting
sudo cp /etc/fstab /etc/fstab.bak  
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab  

Docker

(thread: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04)

sudo apt-get update  
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D  
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'  
sudo apt-get update  
apt-cache policy docker-engine  

Should see:

docker-engine:  
  Installed: (none)
  Candidate: 1.11.1-0~xenial
  Version table:
     1.11.1-0~xenial 500
        500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
     1.11.0-0~xenial 500
        500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
sudo apt-get install -y docker-engine  
sudo systemctl status docker  

Should see:

● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2016-05-01 06:53:52 CDT; 1 weeks 3 days ago
     Docs: https://docs.docker.com
 Main PID: 749 (docker)

Make it run without sudo:

sudo usermod -aG docker $(whoami)  
# relogin
docker info  

Docker Compose

(thread: https://docs.docker.com/compose/install/)

You might be tempted to install it from apt-get but you will get an old version.

sudo curl -L "https:
อ่านต่อ »

Ubuntu Can't Verify SSL Certs

I found something like this while wget a file from https protocol:

Unable to locally verify the issuer's authority.

What it's saying is that its knowledge about ssl certs doesn't cover the one we're using.

Fortunately, it can be solved using :

apt-get install ca-certificates  

And here is the description of the package.

PEM files of CA certificates to allow SSL-based applications to check for the authenticity of SSL connections.

อ่านต่อ »

Using DLink's DWA 171 USB Wireless Dongle with Ubuntu 16.04

It doesn't come with a working official driver though.

So, I googled for it, and found: https://ubuntuforums.org/showthread.php?t=2168426

Here is an excerpt worth mentioning, from user chili555

sudo apt-get install git  
git clone https://github.com/abperiasamy/rtl8812AU_8821AU_linux.git  
cd rtl8812AU_8821AU_linux  
# make with 4 concurrent jobs
make -j4  
sudo make install  
sudo modprobe -a rtl8812au  

After reboot, your device will discover for wireless networks.

It's important to note that after system updates, you'll need to recompile the driver and install it again. Simply, restart the whole process except the cloning one.

อ่านต่อ »