Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100 mph.
—— Linus Torvalds
[*] Caution: This blog is written for Debian/Ubuntu, and it is not suit to other Linux distribution, such as Fedora/CentOS.
Basic Operation
Root & User
1 | sudo passwd root # new or modify password of root |
Shut Down & Restart
The following multiple lines of command is common to turn off computer.
1 | halt # shut down immediately |
The following multiple lines of command is common to restart computer.
1 | reboot # restart immediately |
Suspend & Hibernate
Suspend and sleep have the same meaning, which mean that turn off all peripherals and only keep cpu and memory running. And press Fn
multiple times to exit the suspend state.
1 | sudo pm-suspend # valid |
Standby mode means that save state to memory and turn off other devices, especially it resumes slower than suspend but faster than hibernate.
1 | sudo pm-suspend-hybrid # valid |
Hibernate means that save state to disk and turn off all devices, which resumes slower than the above two states.1
2 sudo pm-hibernate # valid
sudo systemctl hibernate # invalid
Change Hostname
1 | su root |
File Management
1 | mkdir [Path] # new path |
Task Management
Manage task by using CLI.
1 | ps -A # list all process |
Manage task by using GUI, if Gnome is exist.
1 | gnome-system-monitor # call Task Manager |
Gnome Management
Press Alt
+ F2
, then typing r
could restart Gnome.
Package & Zip & Unzip
.tar
1 | tar xvf [FileName.tar] # untar |
.gz
1 | gunzip [FileName.gz] # unzip-1 |
.tar.gz & .tgz
1 | tar zxvf [FileName.tar.gz] # unzip |
.bz2
1 | bzip2 -d [FileName.bz2] # unzip-1 |
.tar.bz2
1 | tar jxvf [FileName.tar.bz2] # unzip |
.bz
1 | bzip2 -d [FileName.bz] # unzip-1 |
.tar.bz
1 | tar jxvf [FileName.tar.bz] # unzip |
.Z
1 | uncompress [FileName.Z] # unzip |
.tar.Z
1 | tar Zxvf [FileName.tar.Z] # unzip |
.zip
1 | unzip [FileName.zip] # unzip |
.rar
1 | rar x [FileName.rar] # unzip |
Swap Space
View current swap file.
1 | cat /proc/swaps |
New a swap file and configure it.
1 | swapfile=/mnt/4GiB.swap |
View swap file again.1
2
3
4
5
6
7 cat /proc/swaps
Filename Type Size Used Priority
/mnt/4GiB.swap file 4194300 0 -1
free -h
total used free shared buff/cache available
Mem: 2.0G 1.1G 178M 58M 646M 565M
Swap: 4.0G 0B 4.0G
Modify System Font
Install
Install font file, take consola
as an example.
And download suitable font file from here to linux.
1 | unzip YaHei.Consolas.1.12.zip # unzip font file |
Activate
You should add it to the system font file and activate it, if you want to uing it for the system instead of one program.
1 | sudo mkdir /usr/share/fonts/consola/ # make folder for font file |
Input Method
IBus Pinyin & XIM Pinyin
As me, ibus-pinyin is more easy to use than google-pinyin.
- If language of os is English, it is necessary that install 'ibus-pinyin' or 'fcitx-pinyin'.
1 | sudo apt-get install ibus-pinyin |
Click
Setting
->Region & Language
->Manage Installed Languages
Select
Keyboard input method system
=IBus
->Install / Remove Languages...
->Chinese(simplified)
->Apply
Reboot os.
1 | reboot |
Click
Setting
->Region & Language
->Input Sources
->Chinese(Intelligent Pingyin)
Configure sth such as switching mode in
Preferences
.
Google Pinyin
Open input method configuration.
1
im-config
Select
OK
->Yes
->fcitx
&OK
->OK
1
2
3sudo apt install fcitx-googlepinyin
reboot
fcitx-config-gtk3After adding Google Pinyin is ok.
Change Sources
Back Up older
1 | sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak # back up old sources |
Edit Newer
1 | sudo vim /etc/apt/sources.list # edit new sources |
1 | # /etc/apt/sources.list |
You can also use the following code.
1 | # /etc/apt/sources.list |
Update
1 | sudo apt-get update # update sources |
Package Manager - apt & snap
apt
Normally, the command apt
= ( apt-get
| apt-cache
| apt-config
), although apt
has new usage. In other words, you just need to use the command apt
in most of the time when using Ubuntu OS.
1 | sudo apt install [SoftwarePackage] # install |
snap
Accroding to my experience, the software packages will be managed by the manager - 'snap', if they are installed by the UGI Installer - 'Ubuntu Software', and you can find they in /home/user/snap
. Actually, installing by the command snap
directly is also able.
1 | sudo snap list |
Solution about a Problem:
Unable to install "XXX" | error: snap "YYY" has "install-snap" change in progress
1 | snap changes |
Update System
If your system is Ubunntu 16.04 LTS, and the machine hasn't powerful hardware resources, such RAM, I'll suggest update system to Ubuntu 18.04 LTS by conmand lines instead of re-installing.
Keep your Ubuntu-16.04LTS is newest.
1 | sudo apt-get update |
Start to update system, and make your selection carefully based on the following tips.
1 | sudo do-release-upgrade |
Make Start Disk
GUI Way
A simple way is to using 'Startup Disk Creator' if you have it, or you could install it from 'Ubuntu Software'. And using CLI way is also valid.
CLI Way
Download system image that you need, such as Ubuntu 18.04.1 LTS DeskTop.
1 | cd ~/Downloads/ |
Show all the storage device and find your USB.
1 | sudo fdisk -l |
Format USB and change form of it to FAT.
1 | sudo umount /dev/sdb* |
Make start USB.
1 | sudo dd if=~/Downloads/ubuntu-18.04.1-desktop-amd64.iso of=/dev/sdb |
Broswer - Chromium
Download and install Chrome for 64-bit os.
1 | wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb |
Add source of software and install Chromium for 64-bit os.1
2
3 sudo add-apt-repository ppa:chromium-daily
sudo apt-get update
sudo apt-get install chromium-browser
GUI SSR - electron-ssr
Download
Download the latest version .deb file from erguotou520/electron-ssr (another valid address). And you can learn more about the project by reading this blog.
1 | cd ~/Downloads |
Dependence
Associate local python package.
1 | su root |
Install necessary library - libappindicator1 & libsodium.
1 | sudo apt-get install libappindicator1 # maybe you need execute 'apt-get -f install' command by using root permission |
Install
Install electron-ssr.
1 | cd ~/Downloads |
Configure
Paste subscription link if you have. And you also can add VPN node.
Q & A
It probably to meet this following error when using command apt
or apt-get
on Ubuntu.
1 | E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable) |
In fact, there is a similar error you may see:
1 | E: Could not ge lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) |
There could be many reasons why you see this error. The first and most obvious reason is that some other process is using APT package management tool.
The following command will show the id of process running apt or apt-get. Byt the way, the last line contains ‘grep –color=auto’ is your current process, which mustn't be killed.
1 | ps -aux | grep apt |
Using kill
command to kill some process.
1 | sudo kill -9 <PID> |
The killall
command is also valid.
1 | sudo killall apt apt-get |
Click this link to see more.