Category Archives: linux

Install (x)Ubuntu 18.04 on an Asus Zenbook 13

Recently I bought an Asus Zenbook 13 RX333FN. I removed Windows 10 and installed xUbuntu 18.04 on the laptop. However, not every feature I use works out of the box. In these notes explain how to fix this. Probably these notes will apply for similar Asus Zenbooks as well. I expect that these fixes become obsolete with never versions of Ubuntu. Don’t forget to check the ArchLinux wiki on the Asus Zenbook UX333 as well.

Enable deep suspend mode

The Zenbook doesn’t go into deep suspend mode automatically when I close the lid. To enable deep suspend mode open /etc/default/grub, and add to GRUB_CMDLINE_LINUX_DEFAULT the line mem_sleep_default=deep. In my case I have

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash mem_sleep_default=deep"

(partially) Reduce power usage and heat

The laptop overheats quickly. I followed the Most Effective Ways To Reduce Laptop Overheating In Linux. Still the cpu easily heats up to 40 to 50 Celsius. I’m guessing that this is the downside of having such a small laptop.

Fix sound

The sound card is supported in the Linux operating system 4.20 and onward. I installed the 4.20.17 kernel using ukuu.

sudo add-apt-repository ppa:teejee2008/ppa
sudo apt update
sudo apt install ukuu
sudo ukuu-gtk  # Install Kernel 4.20.17

In order to boot the latest Linux operating system, navigate to BIOS, go to “Advanced Menu”, then the “Security” tab and set “Secure Boot” to Off.

Enable Nvidia CUDA support

To enable the Nvidia CUDA support, first disable the nouveau driver. Open /etc/modprobe.d/blacklist-nvidia-nouveau.confand add

blacklist nouveau
options nouveau modeset=0

Next open Software & Updates in the menu, go to Additional Driversand select nvidia-driver-418 (open source). Click on Apply Changes.

Go to the Nvidia home page and download CUDA Toolkit and cuDNN. To download cuDNN you’re required to create an Nvidia account. Install the packages:

sudo dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.168-418.67_1.0-1_amd64.deb
sudo dpkg -i libcudnn7_7.6.0.64-1+cuda10.1_amd64.deb

Reboot your machine and check if CUDA works.

> nvidia-smi
Mon Jun 10 15:02:51 2019       
| NVIDIA-SMI 418.67       Driver Version: 418.67       CUDA Version: 10.1     |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|   0  GeForce MX150       On   | 00000000:02:00.0 Off |                  N/A |
| N/A   57C    P0    N/A /  N/A |    111MiB /  2002MiB |      0%      Default |
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|    0      3348      G   /usr/lib/xorg/Xorg                           109MiB |
|    0      6656      G   /usr/lib/firefox/firefox                       1MiB |

Retrieve the Windows 10 license key

The zenbook comes with a Windows 10 license key hardcoded in the firmware. You can extract the license key as follows

sudo grep -aPo '[\w]{5}-[\w]{5}-[\w]{5}-[\w]{5}-[\w]{5}' /sys/firmware/acpi/tables/MSDM

How I use Tmux

Last years I’ve been using Tmux extensively. Tmux is a terminal multiplexer, i.e. Tmux enables you to create, access, and control multiple terminal from a single screen. Additionally Tmux can be detached from a screen and continue running in the background. Therefore the Tmux session can be reattached later in time, and not in particular in the same screen. For example you could run a Tmux session on a server, detach the session, logout in the evening, sleep, login the next morning, and reattach the same session as you detached the previous day.

Because I use Tmux on many different systems: laptops, home pcs, servers, IoTs, I rarely change anything to the default Tmux settings. Hence I know that all Tmux multiplexers have the same key bindings and commands. To my surprise 98% of the time I use less than 20 commands of Tmux. I took some time to summarize these Tmux commands. This list is by no means complete, nor is it meant to serve as a cheat sheet.


Sessions are used for separating different projects. To handle sessions outside Tmux.

  • tmux new -s session-name, creates a new session named session-name.
  • tmux list-sessionsor tmux ls, show the list of existing sessions.
  • tmux attach -t session-name, opens an existing session named session-name. Without the parameter -t session-name, Tmux will select the first session.

Inside Tmux sessions can be managed as well.

  • C+b s, shows the list of all existing sessions. This list can be used to switch sessions.
  • C+b :new -s session-name, creates a new session. This session can be renamed with C+b $.
  • C+b d, detaches the session. And you’ll end up in the original terminal.


Inside each session you can create windows.

  • C+b c, creates a new window.
  • C+b w, list all existing windows in the session.
  • C+b n and C+b p, will move to the next and previous window respectively.
  • C+b 0-9, moves to the window with the given id-number.
  • C+b &, kills the current window. The window is also killed if all panes are killed.


Inside each window you can create panes.

  • C+b ", split pane horizontally.
  • C+b %, split pane vertically.
  • C+b o, switch to next pane. You can also use C+b <arrow> to move to another pane. But usually I don’t have more than three panes open in one window. Therefore I rarely use the arrows to switch panes.
  • C+b+<arrow>, increases or decreases the size of a pane. If you hold down the arrow key the pane continues to increase or decrease.
  • C+b x, close current pane. You can also close the pane by killing the terminal inside the pane.

Copy mode

I’m not using copy mode that often. Usually I pipe output of commands with tee to a text file instead. But if I use it the most used commands are:

  • C+b [, enter copy mode. You can move around the pane with the arrow keys. I usually use the arrow keys to read back older messages.
  • C+<space>, will start selection. Hit Alt+w when you’re done selecting the text. The selection is moved to the copy buffer. With C+b ]the buffer is copied in to the current cursor position.
  • tmux list-buffers or C+b :list-buffers, show the list of buffers stored.
  • tmux show-buffer -n buffer_n foo.txt or C+b :show-buffer -n buffer_n foo.txt, outputs buffer_n to foo.txt.
  • q exists copy mode.

Create swap space on disk

My webserver doesn’t have a swap section installed by default. This is not a big deal as long as you don’t require a lot of memory. Running this website doesn’t require more than 300mb of ram. But sometimes I would like to run other tools or programs on this server as well that do require more memory than I have available.

I found this nice method to create a swap space on my disk. In the following example we create a swap space of 2GB. Create an empty file of exactly 2GB. Then set up the empty file as a swap space.

sudo dd if=/dev/zero of=/var/swap.img bs=2048k count=1000
sudo chmod 600 /var/swap.img
sudo mkswap /var/swap.img

Enable or disable the swap space can be done in the terminal. To enable the swap space run sudo swapon /var/swap.img. To disable the swap space run sudo swapoff /var/swap.img.

Invert colors in Zathura (a.k.a. night mode)

Zathura is a highly customized, functional, fast pdf reader, focused on vim-like keyboard interactions. I use Zathura for reading pdf, postscript, and djvu, and Zathura is one of my main tools on every Linux distribution I use. One of the things I like about Zathura is inverting colors. This saves my eyes during the night, therefore I like to call it night mode. Inverting colors in Zathura is called recoloring, and is binded to Ctrl+r. This took some time before I found out. I like to key bind inverting colors to Ctrl+i, in ~/.config/zathura/zathurarc add:

map <C-i> recolor

This will do the trick.

Encrypt your drive with cryptsetup in linux

I prefer to encrypt all my external hard drives and usb sticks. One way to do this is with cryptsetup. Below I added instructions how to encrypt your drive. Suppose you have a partition on your drive at /dev/sdb1.

  1. Install cryptosetup, in ubuntu run sudo apt install cryptsetup.
  2. Encrypt the partition:
    sudo cryptsetup -v --verify-passphrase luksFormat /dev/sdb1
  3. Open then encrypted partition:
    sudo cryptsetup luksOpen /dev/sdb1 crypted-partition

    The partition can be found in /dev/mapper/encrypted-partition.

  4. Create your favorite filesystem on the the encrypted partition. I install the ext4 filesystem.
    sudo mkfs.ext4 -L label-name /dev/mapper/encrypted-partition
  5. Close the encrypted partition:
    sudo cryptsetup luksClose /dev/mapper/encrypted-partition