Normal Ubuntu User Guide!
Concepts
-
Everything is file.
-
Open source.
Useful knowledge
.desktop file - short icon
A .desktop file is simply a shortcut that is used to launch applications
in Linux. Without the .desktop file, your application won’t show up in
the Applications menu and can’t be launched with third-party launchers
such as Ulauncher and Albert
# create desktop file
# Store .desktop file to .local/share/applications/
[Desktop Entry]
Type=Application
Name=Personal File
Exec=/home/user/file
Icon=gedit
add pinyin
Note: These instructions are ONLY meant for vanilla Ubuntu and ONLY for 22.04 for basic pinyin input for simplified characters.
Ubuntu has never provided an easy, well-documented option for adding
pinyin input support. However, to get basic pinyin support in 22.04 you
can simply:
- Open Settings, go to
Region & Language
->Manage Installed Languages
->Install / Remove languages
. - Select
Chinese (Simplified)
. Make sureKeyboard Input method system
hasIbus
selected. Apply. - Reboot
- Log back in, reopen Settings, go to
Keyboard
. - Click on the "+" sign under
Input sources
. - Select
Chinese (China)
and thenChinese (Intelligent Pinyin)
.
You should now have a little "en" (or whatever the language code of your Ubuntu install is) at the top right of your main screen which you can click on and get a list of available input methods, including Chinese (Intelligent pinyin)
.
Open anything that can receive text (like gedit, openoffice, vim, FF,...) and try it out. You can also change between them with Super/Win + space
.
- Reboot to make sure it is still there after a reboot.
- Be happy that you didn't lose any more time on this ridiculously trivial issue that is still a massive pain in 2022!
If you don't need extra bells and whistles then do NOT bother with fcitx
(and the supposedly excellent "google pinyin"), uim
or any other exotic option! They are extremely hit-and-miss trying to install, and finding a guide that is relevant to 22.04 is almost
impossible. Some claim to have "tested with 22.04" but they have done upgrades of previous versions that they had working, not fresh installs.
File System
Concepts
-
Just one file tree.
-
Disk is mounted under any directory.
Disk
# report file system disk space usage
$ df -hT
# display a list of the file systems currently mounted
$ mount
# Mount some device on a new directory
$ mount -t _fs_type _source _diretory
# Unmount a device
$ umount _source
Struct
SCOPE + CATEGORY + APPLICATION -- Linux Pocket GUide
Operates
# working directory path
$ pwd
# cd old pwd
$ cd -
# cd current user's root directory
$ cd ~
# all, long, human-readable
ls -alh _directory
# determine file type
file _file
mkdir _name
cp _source _dest / _source... _directory
mv _source _dest / _source... _directory / _old_name _new_name
rm -iv _files... / -riv directory
# create hard links(is backup)
ln _target _link_name
# create symbolic links(just a pointer)
ln -s _target _link_name
Using Bash
Concept of shell
- The command-line user interface of the operating system
Features of bash
Expansions
# Command arguments will be expanded before execution
# 1. space & word splite expansion
$ echo a b c -> a b c
# 2. path-name expansion
# The mechanism by which wildcards(*) work is called pathname expansion.
$ ls * / $ ls *D / $ ls D* / $ ls /usr/*/bin
# 3. tilde(~) expansion
# expand to user root directory.
$ echo ~(current user) / $ echo ~xx_user_name
# 4. arithmetic expansion(+ - * / % **)
$ echo $((2**5))
# 5. brace expansion
{001..5} / a{A{1,2},B{1..5}}b
# 6. parameter expansion
$ echo $any_var_in_env
# 7. command substitution expansion
$ ls -alh $(which cp)
Quoting
# limit expansion
# double quotes
# Allmost expansions can't work. The exceptions are $, \, and `.
# Use \$ \\
# single quotes
# All expansions can't work
Command help
$ type _buitin_command
# option
$ help / --help
$ man _command
$ whatis
# locate a command
$ which
# locate the binary, source, and manual page files for a command
$ whereis
# list all alias
$ alias
I/O Redirection
# stdoutput & truncate file
>
# stdoutput & error
&
# stdoutput & don't truncate file
>>
# stdinput
<
# concatenate files and print on the standard output
cat
# pipe, different with >,< to overwriting file
# just transfer result as command parameter
|
# omit repeated lines
uniq
sort
# print newline, word, and byte counts for each file
wc
# filter result
$ dpkg -l | grep fire*
# !tail -f output appended data as the file grows
head/tail
# duplicating pipe content & write to stdoutput
tee
Keyboard Tricks
Editing
# Move cursor to the beginning or end of the line
$ ctrl + a
$ ctrl + e
# Move cursor forward or backward one word
$ alt + f
$ alt + b
# Clear screen
$ ctrl + l
# cut text from the cursor location to the end or start of line.
$ ctrl + k
$ ctrl + u
# past
$ ctrl + y
History
# list all history
$ history
# !history_num to runing history command
# entery keyworld to seraching history
$ ctrl + r
Permissions
What is permissions ?
Each file has three types of permissions, owner, group, other. We just need to know what permissions we want to share to own group and others when we create the file.
Permission Operate
# change default permission
# every file init permission is 0666, and using umask 0002 to mask bit.
$ umask [mode]
# change file permission
# using u(user), g, o(other), a(all) + - = , r w x to change file mode
$ chmod u+rwx
$ chmod ug+rx, o=r
$ chmod g-x, o=r
# some special permission
# suid, guid, sticky bit
https://linuxhandbook.com/suid-sgid-sticky-bit/
# change owner or group owner
$ chown _new_owner:_new_group_owner
# run root user
# On Ubuntu, there is no root user account, just can use sudo command.
$ su -
# run command as root
# commands that sudo can work is settled by /etc/sudoers
$ sudo _command
# list sudo privileges
sudo -l -U _user_name
Manage User
# print real and effective user and group IDs
$ id
# change user password
$ passwd
# add new user
$ adduser _user_name
# Add a user group
$ addgroup [--gid ID] _GROUP
# add new sudo user
# default user is not a sudoer,it not in sudo group that can't use sudo.
# just need append to sudo group
$ usermod -aG sudo _user_name
# delete user
$ userdel -rf _user_name
Processes manager
# viewing processes
# snapshot
$ ps aux
# dynamically
$ to
# controlling processes
# list process that start in the bash
$ jobs
# running in the back ground
$ bg _%jobs_id
# running in the front ground
$ fg _%jobs_id
# linux uses sending signal to control process
# Stop
$ ctrl + z
$ kill -TSTP _pid
$ kill -STOP _pid # rude
# Terminate
$ ctrl + c
$ kill -INT _pid # interrupt
$ kill [-TERM] _pid # terminate
$ kill -KILL _pid # rude
# continue, restore process that was stopped
$ kill -CONT _pid
Editor
vim
# enhanced behavior
$ echo "set nocp" >> ~/.vimrc
# editing mode or execute vim command(ready to set mode after enter esc)
1. i (INSERT MODE)
2. :w (save)
3. :q (quit)
# move cursor(must enter esc)
1. k -> up
2. j -> down
3. h -> left
4. l -> right
5. 0 -> line begin
6. $ -> line end
7. w -> next word
8. G -> end line
# basic editing(must enter esc)
# delete next n line(include cureent line)
ndd
# copy-past
0. p -> past
1. yy -> current line
2. nyy -> next n line
3. y$ -> from current location to line end
4. y0 -> from current location to line begin
# search
step1: /key_word
step2: enter (first match)
step3: n (next match)
# edit mode
# move cursor
# basic editing
# search
Environment
Concept of environment
Global data for every program(include shell script), the data consist of environment var and shell var.
IMPORTANT VAR PATH: A colon-separated list of directories that are searched when you enter the name of a executable program
Default Environment
Environment will be established when startup shell
-
Login shell session : /etc/profile, ~/.bash_profile or ~/.bash_login or ~/.profile
-
Non-login shell session: /etc/bash.bashrc, ~/.bashrc
# list all env var
$ printenv
# Export environment to subsequently executed programs
export PATH
# list all alias
$ alias
$ alias _xx 'ls -alh'
Manage Environment Scheme
-
PATH or define additional environment variables, place those change in .profile
-
For everything else, place the change in .bashrc
Manage Software
# set software center mirror
GUI: softwareupdate >
# dpkg low tools
$ dpkg -i/-r/-l
# apt* hight tools
$ apt update # update software index cache
# snap is interface of snap store.
Networking
Test tools
# ping
# traceroute
View information
# ip
$ ip a
# netstat
# check tcp connections
$ netstat -at
# check udp conections
$ netstat -au
Archiving and Backup
Compression
# gzip & bzip2 [option] [file]...
# -d decompression
# -v verbose
Archiving
1. create a tarball
# !no -
$ tar cvf _output_name.tar _source_directory
2. create a gzip tarball
$ tar cvzf _output_name.tar.gz _source_directory
3. create a bzip2 tarball
$ tar cvjf _output_name.tar.bz2 _source_directory
4. list the contents of a tarball
$ tar tvf _target.tar
5. add more files to a tarball
# you can't forward add file to compressed tarball
$ tar rvf _target.tar _update_directory
6. Extract a tarball
$ tar xvf _target.tar[.gz, .bz2]
7. Extract the tarball to a specific directory
$ tar xvf _target.tar -C _target_dir
标签:name,tar,command,user,file,Linux,directory,Guide,User
From: https://www.cnblogs.com/ivanohohoh/p/17065550.html