Linux is a family of free and open-source software operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds.



Here some options should be effective in all Linux Distros :)


How to install and switch to a specific shell?

# print current shell
echo $SHELL

# list installed shells
cat /etc/shells

# switch to a specific shell, such as zsh
sudo yum install -y zsh
chsh -s /bin/zsh

How to install oh-my-zsh?

# Via curl
sh -c "$(curl -fsSL"

# Via wget
sh -c "$(wget -O -)"

Keymap of Ctrl

# swap Caps and Ctrl
sudo nano /etc/profile
setxkbmap -option ctrl:swapcaps

# or just map Caps to Ctrl (Recommended)
sudo nano /etc/default/keyboard
# update

Wifi Connection

sudo nano /etc/modprobe.d/blacklist.conf

Append blacklist acer-wmi to the file, save, exit and reboot your PC.

Keep SSH Connecting

Here two ways, just choose one:

  • [client], edit /etc/ssh/ssh_config, append a line ServerAliveInterval 60
  • [server], edit /etc/ssh/ssh_config, append a line ClientAliveInterval 60



In CentOS, there are three type of hostnames:

  • static hostname, which is readed from /etc/hostname;
  • transient hostname, which is a temporary hostname via DHCP or mDNS;
  • pretty hostname.

In centOS 7, it offers a hostnamectl command here, by which you can query and update the hostname configuaration.

# set hostname as 'jk'
hostnamectl -set-hostname jk

# more about hostnamectl
hostnamectl -h

How to update /etc/hosts manually???

New User and Authorization

How to add a new user?

# new user 'jack'
adduser jack
# set passwd
passwd jack

How to add authorization?

Note that, the new user don’t have the permission of sudo, and you must add an authorization by editing /etc/sudoers/.

## allow root to run any commands anywhere
root    ALL=(ALL)        ALL
jack    ALL=(ALL)        ALL       # authorize 'jack'


EPEL (Extra Packages for Enterprise Linux) is maintained by Fedora and having no conllisions of Offical Package.

# RHEL/CentOS7 install EPEL
yum install

# Query & Update
ll /etc/yum.repos.d/
yum clean all && yum makecache

How to Install Nodejs

Source Codes Compile

# install gcc , gcc-c++
yum -y install gcc gcc-c++

# download the corresponding source code

# extract it to current folder
tar -zxvf node-v10.15.1.tar.gz

# cd 'node-v10.15.1'
cd node-v10.15.1

# make & install
./configure --prefix=/usr/local/node
make && make install

# set PATH
export PATH=$PATH:/usr/local/node/bin

Archive Installation

# download the newest archive package

# extract
xz -d node-v10.15.1-linux-x64.tar.xz
tar -xvf node-v10.15.1-linux-x64.tar

# move it to a specific folder, like '/opt'
mv node-v10.15.1 /opt/node

# set PATH
export PATH=$PATH:/opt/node/bin

Taobao Mirror

# temporary
npm --registry install xxx

# permanent
npm config set registry

Via npm config get registry to check weather it successful.

How to install Python3.x

# install commpile tools, such as 'gcc' 'g++'
yum -y install gcc gcc-c++
# necessary libs
yum -y install zlib zlib-devel
yum -y install libffi-devel

Source Code Installation

# download source code package

# extract
tar -zxvf python-3.7.2

# make & install
cd python-3.7.2
./configure --prefix=/usr/local/python3
make && make install

# set PATH
export PATH=$PATH:/usr/local/python3/bin

How to Install Git

# install a compile tool
yum install perl-devel

# download & extract source code
xz -d git-2.9.5.tar.xz
tar -xvf git-2.9.5.tar

# make & install
cd git-2.9.5
make && make install

# set PATH
export PATH=$PATH:/usr/local/git/bin

How to Install Emacs26

# download source code package

# ready for compiling
# . not found: gnutls
yum install gnutls gnutls-devel
# . tputs was not found
yum install ncurses-devel

# extract & make & install
xz -d emacs-26.1.tar.xz
tar -xvf emacs-26.1.tar

./configure --prefix=/usr/local/emacs26
make && make install

# set PATH
export PATH=$PATH:/usr/local/emacs26/bin


Here some frequently used options of Nginx.

  • nginx - start nginx server
  • nginx -s stop - forcibly stop nginx server
  • nginx -s quit - stop nginx when all tasks done
  • nginx -s reload - reload nginx configuaration
  • nginx -s reopen - restart log

Note that you can check if nginx running by ps aux | grep nginx.

How to Install Tmux

# dependce packages
yum install ncurses-devel libevent-devel

# download source code package

# extract & make & make install
tar -zxvf tmux-2.8.tar.gz
cd tmux-2.8
./configure --prefix=/opt/tmux
make && make install

# set PATH
export PATH=$PATH:/opt/tmux/bin


Chinese Input Way

# Install fcitx modules
# fcitx-im includes all 'Gtk+/Qt' modules
# fcitx-configtool is a GUI configtool
pacman -S fcitx-im fcitx-configtool

Fcitx has a built-in ‘Pingyin’, and if you want to install ‘sogoupinyin’:

# install sogoupinyin
pacman -S fcitx-sogoupinyin
# and
nano ~/.xprofile

Append the following contents to .xprofile:

export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx

Software Source Mirrors

Software Source, a remote software archives repo, like:

  • TUNA (Tsinghua Open Software Source)
  • USTC (University of Science and Technology Mirrors)

Sort the mirrorlist

nano /etc/pacman.d/mirrorlist

Move tuna and ustc ahead of the mirrorlist.

Add archlinuxcn Repo

nano /etc/pacman.conf
# append the following contents to 'pacman.conf'

# TUNA (ipv4, ipv6, http, https)
Server =$arch
# Save & Exit, and exec
sudo pacman -Syy

# Install GPG keys of archlinuxcn
sudo pacman -S archlinuxcn-keyring

# Update & Upgrade
sudo pacman -Syyu

Chinese Inputing of Emacs

# edit .bashrc or .zshrc
sudo nano ~/.bashrc
# set an alias to start Emacs
alias myemacs ='LC_CTYPE="zh_CN.utf8" emacs'
# make it effective
source ~/.bashrc

How to make it effective with Emacs GUI?

sudo nano /etc/profile

# append the following contents
export LC_CTYPE="zh_CN.UTF-8"

Restart you PC, and it will be okay.

Resize of Org Inline Image

Resize of Org Inline Image1

In Org Mode, it offers a org-toggle-inline-images command, which can show the inline-image.

You can adjust the size of the image via org-image-actural-width variable, like:

  • t, (setq org-image-actual-width t), stands for its origin size;
  • number, (setq org-image-actual-width 300), stands for 300;
  • number list, (setq org-image-actual-width '(300)), if without #+ATTR.* of .org file;
  • nil, (setq org-image-actual-width nil), just #+ATTR.* can make it effective, the other ways will be origin size.


Reset Font-Family of Mint

You need to remove two installed packages, like:

sudo apt remove fonts-arphic-ukai fonts-arphic-uming