Setting Up Ubuntu


This is one of a series of posts where I document software configurations for personal reference. This post documents the configurations for Ubuntu.

Controlling the boot process

The grub file controls the behavior of the GRand Unified Bootloader, which is a flexible and powerful boot loader program. The full path to the file is /etc/default/grub; use the following command to edit the file:

sudo nano /etc/default/grub

There are two settings that may be of particular interest:

  1. GRUB_DEFAULT=0: choose Ubuntu as the default operating system.
  2. GRUB_TIMEOUT=5: boot the default system in five seconds if no keyboard input is performed during this time.

Remember to run the following command after changing the settings to update the /boot/grub/grub.cfg file:

sudo update-grub

Dealing with a dual-boot system time conflict

When Linux and Windows constitute a dual-boot system, there will be an issue concerning system time. The solution is to use the following command to tell Ubuntu that the hardware clock is set to ‘local’ time:

sudo timedatectl set-local-rtc 1

Note that invoking this will also synchronize the RTC (i.e., real-time clock, which stores hardware time) from the system clock (which stores system time), unless --adjust-system-clock is passed.

The following command can be used to update system time, but note that the program is no longer installed on Ubuntu by default (install it with sudo apt install ntpsec-ntpdate).

sudo ntpdate

Auto mount a partition on boot

Edit the /etc/fstab file to auto mount a partition on boot. An example entry could be: UUID="" /data ntfs uid=1000,gid=1000,umask=0077.

Use the following command to get the UUID of a partition:


Use the following command to get user and group IDs:


Miscellaneous packages

sudo apt install aria2 fcitx meld vlc flameshot filezilla gimp git virtualbox virtualbox-ext-pack tree keepassxc

Miscellaneous templates

if [[ -d "${HOME}/模板" ]]; then
elif [[ -d "${HOME}/Templates" ]]; then

# CSV file template
echo '' > "${TEMPLATESDIR}/CSVfile.csv"

# Python script template
echo '#!/usr/bin/python3' > "${TEMPLATESDIR}/"

# Markdown template
echo '' > "${TEMPLATESDIR}/"

# R Markdown template
echo '---
title: "Untitled"
author: "zenggyu"
date: "2021-11-23"
output: html_document
---' > "${TEMPLATESDIR}/RMarkdown.Rmd"

# R script template
echo '#!/usr/bin/Rscript

library(glue)' > "${TEMPLATESDIR}/Rscript.R"

# Shell script template
echo '#!/usr/bin/bash' > "${TEMPLATESDIR}/"

# SQL script template
echo '' > "${TEMPLATESDIR}/SQLscript.sql"

# Text file template
echo '' > "${TEMPLATESDIR}/Textfile.txt"


comments powered by Disqus