Some basic instructions for Linux:
Shell: Protecting the kernel
What is a shell?
[Email protected] desktop]$
User host name directory user prompt
##################
Date
Watch-n 1 Date # #监控date命令每秒钟执行一次
Date Month month every day hour minute. seconds seconds # #更改时间
date-d +400days +%m ###### #查看400天后的月份
date-d -1200days +%y%j ####### #查看1200天之前的年分和显示那一年的第几天
Watch-n 1 Date ##### #每秒更新一次查看时间
Date Mmddhhmm[cc[yy]]. [SS] # # # #直接输入月份天几时几分 [] not written in the expression
Date--help # #查看date的其他用法
########################
passwd ##### Change Password
passwd Username # # #更改用户密码 (only Superuser root can)
passwd # # #普通用户修改自己的密码
Echo Changed password | --stdin User # # #直接更改密码
File # # #查看文件类型
Cat file name # # #查看文件所有内容到文件的最后
Less file name # # #查看文件所有内容从文件的开始, press Q to exit
Head-Digital file name # # #文件内容前多少
Tail-Digital file name # # #文件内容后多少
Wc-l # # #行数
-C # # #字节数
-M # # #字符数
-W # # #单词数
-L # # #显示最长行的长度
Clear Clear Screen
Useradd/userdel Add/Remove a user userdel-r remove everything from this user
Poweroff|init 0| Shutdown-h now shutdown
Reboot | Init 6 | Shutdown-r now restart
TAB key
History call Ifconfig View IP lftp enter TAR-ZXF unzip
Get get
CTRL + A cursor moves to the beginning of the line
+ e cursor moves to end of line
+ u cursor position deleted to beginning of line
+ k cursor position deleted to end of line
+ R to bring up the most recent command with a keyword
+ left | Right cursor moves in Word units
+ C undo to enter the command
+ D Close the current environment
+ SHIFT + t # #在现有shell中重新打开一个table
+ SHIFT + pageup|pagedown Toggle Table
+ ALT + L lock screen
+ ALT + up | down switch Work interface
+ ALT + F1|F7 into the graphical interface
+ ALT + F2-f6 into Virtual Console
PWD # #显示但前在系统的位置
####################################################
ls
list # #列出目标文件, or list contents in directory
-a # #列出所有
-l # #列出文件属性
-s # #列出文件大小
-R # #第归列出
-d # #指定目录本身
##################################
Cd
Chage Directory # #进入目标目录中
~ # #回到当前用户家目录
~username # #进入到指定用户家目录
.. # #进入当前目录的上一级
-# #进入之前所在系统目录
If the current working directory is/
Executive Cd/mnt/gaga
Re-execute the CD. is to/mnt
If you are performing a CD-just to/
#####################################################
touch # #新建文件
mkdir # #建立目录
Mkdir-p # #第归建立目录
touch/mnt/file{1..10} # # # # #在根目录下建立10个文件
Rm-f??? ##### #删除3个字符的文件
Rm-fr fi? L ###### #删除以fi_l命名的目录
Touch ' fi le ' # # #建立名为fi le file (the filename has a space must be double shadow number)
Touch fl le # # #建立了两个文件
##########################################
CP is copied to the file destination
-R # #第归复制, using and copying directories
##########################################
MV is moved file destination
MV Old name New name
MV Test/file. # #把test/file move to the current
##########################################
Rm-f #强制删除文件
RM-FR #强制删除目录
############################################
Vim filename
Press the I key to enter insert mode
Press ESC to browse mode when the file is written
: Wq Save Launch
######### #通配符 (regular expression) ########################
* #匹配0-Any character
? #匹配任意单个字符
~ #匹配当前用户家目录
~user #匹配到user的家目录
~+ #当前目录
~-#当前目录之前所在的
[ABC] #有a或者有b或者有c
[!ABC] #除了含有a或者b或者c
[^ABC] #除了含有a或者b或者c
[[: Alpha:]] # #单个字母
[[: Lower:] # #单个小写字母
[[: Upper:] # #单个大写字母
[[: Alnum:] # #单个字母或数字
[[:p UNCT:] # #单个符号, without numbers, letters and spaces
[[:d Igit:] # #数字
[: Space:] # #单个空格
Cases:
*[[:d igit:]]*.conf ##### #表示含有数字并且以. conf end of File
/MNT/*[24680] # # #根目录下mnt目录中的文件名以2或4或6或8或0结尾
[Enh]* # #表示以e或n或h开头
PWD # #显示但前在系统的位置
Additional:
Relative path: The location of the file relative to itself
Absolute path: File absolute location
LS-DL/L/A # #显示目录/File/Hide attribute file name before adding. That is, hidden files
which file # #查看命令的路径
Man Handbook Manul, learn how to use instructions by viewing manuals
Man level target
Man 1 File name # # # #查找命令的帮助
Man 5 file name # # # #查找配置文件的帮助
Man Exit # # #按q
Quick usage of man
/Keyword # # #搜索关键字并且高亮显示结果
N # # #向下匹配高亮结果
N # # #向上匹配高亮结果
Pagup # # #向上滚动一个屏幕
Pagdown # # #向下滚动一个屏幕
Up Key # # #向上滚动一行
Next Key # # #向下滚动一行
D # # #向下滚动半个屏幕
U # # #向上滚动半个屏幕
G # # #回到man的最前面
G # # #回到man的最后面
Q # # #退出man页面
#################################### #3
Find
Execute under normal user
Find/etc-name passwd
Output
Find: '/etc/pki/ca/private ': Permission denied
Find: '/etc/pki/rsyslog ': Permission denied
Find: '/etc/audit ': Permission denied
/ETC/PASSWD # # #正确输出
Find: '/ETC/POLKIT-1/RULES.D ': Permission denied
Find: '/etc/polkit-1/localauthority ': Permission denied
Find: '/etc/dhcp ': Permission denied
Find: '/etc/selinux/targeted/modules/active ': Permission denied
Find: '/etc/lvm/archive ': Permission denied
Find: '/etc/lvm/backup ': Permission denied
Find: '/etc/lvm/cache ': Permission denied
Find: '/ETC/GRUB.D ': Permission denied
/ETC/PAM.D/PASSWD # # #正确输出
Find: '/etc/audisp ': Permission denied
Find: '/etc/firewalld ': Permission denied
Find: '/etc/cups/ssl ': Permission denied
Find: '/etc/ipsec.d ': Permission denied
Find: '/etc/libvirt ': Permission denied
Find: '/ETC/SUDOERS.D ': Permission denied
Find: '/etc/named ': Permission denied
How to manage output
Find/etc-name passwd > File # # # #重定向正确输出
Find/etc-name passwd 2> File # # # #重定向错误输出
Find/etc-name passwd &> File # # # #重定向所有输出
Find/etc-name passwd >> File # # #追加正确输出
Find/etc-name passwd 2>> File # # # #追加错误输出
Find/etc-name passwd &>> File # # # #追加输出
Find/etc-name passwd > File 2>&1 # # # #重新定义错误输出为正确
Find/etc-name passwd >/dev/null # #屏蔽正确输出
Find/etc-name passwd 2>/dev/null # #屏蔽错误输出
Find/etc-name passwd 2>&1 >/dev/null | Wc-l # # Mask correct output, statistics error line count
Find/etc-name passwd | Wc-l # #统计正确输出行数
Find/etc-name passwd 2>&1 | Wc-l # #统计所有输出行数
How to apply Pipelines
|
The pipeline allows the correct output to pass
|tee
|tee File|wc-l # # # # #复制一份并输出
Copy an output
2>&1 |
Conversion error output to correct again by pipeline
>/dev/null # # indicates output to black hole
find/etc/-name passwd 2>&1 >/dev/null | Wc-l # #统计错误输出
#########################
Vim
1. Command mode
Set
Vim/etc/vimrc
: Set Nu|nonu # # # #行号的显示
: Set Mouse=a # # # #设定鼠标可以操作光标位置
: Help # # # #查看vim的用法,: Q quit
Ctrl + V # # # #高亮选择模式, you can choose one area to operate
U # # # #恢复到未操作之前
CTRL + R # # # #恢复到操作之后
Bulk Add characters
Ctrl + V Select the bit where you want to add the characters, press the I key, add the characters you want to add, press ESC
# #分屏功能 # #
Ctrl+w S # # # #上下分屏
Ctrl+w v # # # #左右分屏
Ctrl+w C # # # #撤销光标所在屏幕
Ctrl+w | down | left | Right # #移动光标到指定的屏幕中
# #替换字符 # #
in command mode
:%s/Huric/Replace after character/g # # G for full text
%s/^\ */g # #消除文章开头的空格
# #搜索关键字 # #
/keywords
N Match down
N Up match
# #字符的管理 # #
DW Delete Word with cursor
DL Delete the letter of the light
DD Delete a whole row
D Digit D Deletes the number of rows specified by the number
D number up on key to delete specified number of rows
YW copy the word where the cursor is located
YL Copy the letter of the light
YY Copy a whole line
P Paste
Y number y copy number of rows specified
cw clipping cursor word
cl clipping light in the same letter
cc cut a whole line
C number c cut number of lines specified
When cut is finished, it goes into insert mode. To paste exit Insert mode and press the P key
to move the cursor to the specified line:
: line number
g # #移动光标到文件末行
2.vim insert mode
i Cursor seated at position insertion character
i cursor inserted at line beginning
a Next insertion of the character of the cursor
a The line at the end of the cursor inserts the
o next line of the cursor
o The previous row of the cursor
s DELETE cursor insertion
s Delete cursor line insert
Exit mode of 3.vim
Enter in command mode
: Q # # #退出, can be used when no changes have been made to the file
: q! # # #强制退出
: Wq # # #退出保存
: wq! # # #强制退出保存
Vimtutor is a description tool for VIM
Use: Q to exit the tool
# #图形中的文本编辑器gedit # #
Crtl+n # #新建窗口
Ctrl+s # #保存文件
Ctrl+o # #打开文件
Ctrl+x # #剪切
Ctrl + V # #粘贴
CTRL + C # #复制
For Giedit software help view can be used
Yelp Help:gedit
Some basic operating instructions for Linux systems