How to enlarge root partition and filesystem size of cloud Linux VM at runtime without rebooting Linux

Posted on

It is common that the root disk space is not enough when running a Virtual Machine in the cloud such as Amazon Web Service (AWS). The cloud storage usually provides tools or facilities to enlarge a virtual disk size. However, to make the Linux recognize and and use the enlarged disks without rebooting the OS,
Read more

How to synchronize Google Drive and Google Docs files in Ubuntu/Debian/Mint Linux using Insync

Posted on

Google Drive is a nice cloud storage service. It provides a suite of nice online document spreadsheet and slide editors Google Docs, Google Sheets and Google Slides. The collaborative editing and full history tracking features of Google Docs are excellent. Google Drive gives 16GB free storage which is pretty much larger compared to other free
Read more

How to get date and time using date command from another timezone in Linux?

Posted on

date command on Linux gets the date and time in the system timezone. But how to get date and time using date command from another timezone in Linux? You can make date print the time of another timezone by setting the TZ environment variable. For example, export TZ=Hongkong; date Sat Dec 1 09:39:13 HKT 2018
Read more

GNOME 3 "Natural scrolling" mouse option does not work

Posted on

In GNOME 3 “Settings” -> “Devices” -> “Mouse & Touchpad”, after setting “Natural scrolling” to On, the scrolling is still as the same before (non-natural). How to fix this? This is likely related to the X11 driver. Remove the xorg-x11-drv-synaptics driver if it is installed. And install the xorg-x11-drv-libinput driver if it is not installed.
Read more

How to install GNOME 3 in Ubuntu MATE 18.04?

Posted on

How to install the GNOME 3 (gnome-shell) desktop environment in Ubuntu MATE 18.04? To install gnome3 to Ubuntu, install these packages sudo apt install gnome-session gdm3 ubuntu-desktop During installation, the installation tools will let you choose the default display manager. You may choose gdm3. Then reboot you Ubuntu Linux and gdm3 will be shown. Click
Read more

Installing Zlib from Source Code in Ubuntu Linux

Posted on

Zlib is a popular open-source compression library used by many software applications to compress and decompress data. While it can be installed in Ubuntu using the apt package manager, you may need to install it from the source code if the version available in the Ubuntu repositories is outdated or if you need to customize
Read more

Handling Sparse Files on Linux

Posted on

Sparse files are common in Linux/Unix and are also supported by Windows (e.g. NTFS) and macOSes (e.g. HFS+). Sparse files uses storage efficiently when the files have a lot of holes (contiguous ranges of bytes having the value of zero) by storing only metadata for the holes instead of using real disk blocks. They are
Read more

How to Add a File Based Swap for Linux

Posted on

We may want to add some swap space for a Linux box while only find that all disk space is partitioned and mounted. Some partition has large available free space. For such cases, we may not want to change the partition allocation. The solution may be to add a file based swap for Linux as
Read more

How to decode a quoted URL in Python?

Posted on

How to decode a quoted URL in Python? For example, an quoted URL as follows https://www.example.com/tag/%E9%93%B6%E8%A1%8C/ should be decoded to https://www.example.com/tag/银行/ In Python 3, we can use `urllib.parse_plus()` (for URL only). One example is as follows. $ python3 Python 3.6.8 (default, Oct 7 2019, 12:59:55) [GCC 8.3.0] on linux Type “help”, “copyright”, “credits” or “license”
Read more

How to configure /dev/shm size of Linux?

Posted on

/dev/shm is a nice in memory disk on Linux. The default size seems half of the physical memory’s size. How to configure shm size of Linux? And what’s the consequence? To change the configuration for /dev/shm, add one line to /etc/fstab as follows. tmpfs /dev/shm tmpfs defaults,size=8g 0 0 Here, the /dev/shm size is configured
Read more

How to exclude a package from a specific repository only in yum?

Posted on

This post https://www.systutorials.com/1661/making-dnf-yum-not-update-certain-packages/ introduces how to exclude a package from yum. But is it possible to exclude a package from a specific repository only? For example, a repository R1 I am using contains an updated version of gdb while I don’t want to use the gdb from it as I trust the version (although older)
Read more

How to resize a virtual disk of KVM

Posted on

I test it for qcow2 format. Other formats are TBA. qemu-img resize kvm1.qcow2 +20G cp kvm1.qcow2 kvm1-orig.qcow2 virt-resize –expand /dev/sda1 kvm1-orig.qcow2 kvm1.qcow2 Reference: https://fatmin.com/2016/12/20/how-to-resize-a-qcow2-image-and-filesystem-with-virt-resize/ I test it for qcow2 format. Other formats are TBA. qemu-img resize kvm1.qcow2 +20G cp kvm1.qcow2 kvm1-orig.qcow2 virt-resize –expand /dev/sda1 kvm1-orig.qcow2 kvm1.qcow2 Reference: https://fatmin.com/2016/12/20/how-to-resize-a-qcow2-image-and-filesystem-with-virt-resize/

How to split and iterate a string separated by a specific character in C++?

Posted on

How to split and iterate a string separated by a specific character in C++? For example, “a string separated by space” by ‘ ‘=> [“a”, “string”, “separated”, “by”, “space”] and “a,string,separated,by,comma” by ‘,’ => [“a”, “string”, “separated”, “by”, “comma”] C++ standard library’s getline() function can be used to build a function. getline() can accept a
Read more

How to generate a password in Shell on Linux?

Posted on

Admins usually need to generate some passwords for others, such as when creating a new user in a Linux system. How to generate a password in Shell on Linux? Several possible and short methods. Here, we generate a password of length 8. Using pwgen: $ pwgen 8 1 dao3PaW9 Password based on base64 (note that
Read more