"VI Use"
1. In command line mode
: Place the cursor on the function in the VI editor.SHIFT + KCan direct man manual, Exit man manual direct press two times Q
: Directgg=gCan make files automatically aligned
:GGNavigates to the beginning of the file, G navigates to the end of the file
:MNavigate to the middle of the file,HThe top row,LThe bottom line of the screen,GLine at the end of the article
:Shift+ctrl+nOpen a new terminal
:[5]yyCopy cursor below 5 lines, p paste
:ywCopy a Word
:0Navigate to the beginning of each line without entering the input mode,$Navigate to the end of each line
:[N]ddClip n rows, p paste
:DGDelete all content after the cursor
:DWDelete 1 words
:DDelete the section after the current line cursor
:d0/d^By deleting to the beginning of thed$Delete to end of line
:vRevoke.Repeat
:!commandExecute Shell Mission
:R!commandSaves the execution result of the shell command to a file
:nr!commandSaves the execution result of the shell command to row n
2, in the bottom row mode:
:xSave exit
:NewOpen a new terminal
:Read 1.txtThe 1.txt is also read into the file
:%! sudo tee% >/dev/nullForce save when permissions are insufficient
: $You can position the cursor to line 45th
:W 1.txtSave a file as a 1.c file
:SP 1.txtTurn 1.txt on simultaneously (landscape) in the same terminal
:Vsp/vs 1.txtIbid. (Portrait)
3. On the shell command line:
:Ctrl + ANavigate to the beginning of the command,ctrl+eNavigate to the end of the command line
:VI 1.txt +45Open the file and navigate to line 45th
:ctrl+l: Clear the screen directly (as clear)
4, block selection:
Ctrl + VThen manipulate the arrow keys
5. Replace
:s/m/n/gReplace the m in the row of the cursor with n
:%s/m/n/gReplace All
6. Quickly edit code
Ctrl + N/ctrl + PFast completion of variables and functions
Ctrl + X + LCode line completion
"Dpkg tool (Local installation)"
1. Install the software (take the directory where the software download package is executed):
dpkg-i Xxxx.deb
2. Uninstalling the Software:
dpkg-r xxxx
"Apt tool (remote download)"
1. Important Catalogue and documents:
/var/cache/apt/archives: This directory holds the Deb packages that have already been downloaded
/etc/apt/source.list: Image source URL
2. Install the SOFTWARE:
1: Update the image source:apt-get Update
2: Install the package:Apt-get Install g++
3. Reinstall:
apt-get Install--reinstall g++
4. Uninstalling the Software:
Apt-get RemovePackage Name
5. Software Upgrade:
Apt-get Upgrade---> Upgrade all software in the system to the latest version (if the network speed is slow, it will take a long time, use caution)
6. Delete the download package:
apt-get Clean---> Remove all downloaded packages from the/var/cache/apt/archives directory
"Network Configuration"
1. Network Configuration
Catalog :/etc/network/interfaces
Configuration: Address/gateway/netmask
2. DNS Configuration
Catalog:/etc/resolv.conf
Configuration: nameserver
3. Restart the network
/etc/init.d/networking Restart
4. Test Network
Ping www.baidu.com
"Shell"
The shell is a command-line interpreter that interprets commands as something that the kernel can recognize, and we currently use bash
Vi/etc/shells#查看系统中支持哪些shell
CD ~#切换到用户主目录
Ls-al #详细实现当前目录中的文件内容
LS-AL;CD/#在一行中输入多个命令, Middle plus semicolon
CD-#回到上一次所在目录
alias myls= ' Ls-al '#将ls-al command to define an alias Myls
Unalias MylsCancel Alias
CP./*.C 123 #将当前目录中所有的. c Files to 123 directories
CP./* 123 #将当前目录中所有的文件拷贝到123目录
ls-al | grep txt#使用管道来查找当前目录中的txt文件
ls-al > 1.txt#将ls the output of the-al command is written to the 1.txt file (>> Append method)
Wc-w < 1.txt#将1. txt as the input source for the WC command, count the number of words (DUP,DUP2)
ls ' pwd '#将pwd命令的输出作为ls命令的参数, ("inverted quote")
Man 2/3 commands# 2: System call 3: library function
LS--help #查看ls命令的帮助信息
Info ls #查看ls程序的帮助页
Sync#保证内存中的缓冲数据, dynamic real-time write to disk file
sudo su#只切换用户, do not switch shell (user directory)
sudo su-#用户和目录都切换
Env#查看系统中所有的环境变量
Echo $HOME #查看环境变量HOME的值
mount/dev/cdrom/mnt/#将dev下的光盘cdrom挂载到mnt目录下
umout/mnt/#卸载
"User ID"
UID #用户ID
GID #组ID
CUID #创建者的用户ID
Cgid #创建者的组ID
EID #有效用户ID
adduser Zhangsan #添加用户
deluser Zhangsan #删除用户
deluser--remove-home user1 #删除用户user1的同时删除用户的工作目录
"PS"
PS #查看当前终端运行进程, foreground process (corresponding to daemon)
Ps-aux #查看系统中所有运行的进程 (Process table)
1. Status of the process (STAT):
S: Sleep
R: Run
T: Stop
Z: Zombie Process
N: Low-priority process
S: Initiator of the session
L: Process that contains threads
<: high-priority process
+: Foreground process
[]: System-level processes
Ps-ef#同时可以查看系统中进程的父进程ID (PPID)
Ps-el#可显示所有进程的优先级
Top#动态查看系统进程的状态
2. Priority of the process ( -20~19):-20 Highest, 19 lowest, default is 0
sudo nice--5./hello#将hello运行时的优先级设为-5
sudo renice-5 19807#将一个正在运行的进程 (PID 19807) The priority of the process is modified to-5
kill-l#显示系统中所有的信号 #define SIGKILL 9
Kill-sigkill (or -9) 1152#给pid为1152的进程发送SIGKILL信号, kill it.
"LS"
ls-al
1, File type:
-: Normal file (text file, binary file)
L: Link file (soft connection)
d: Directory file
p: Pipe file
c: Character device file (keyboard, mouse)
b: Block device (HDD, Flash)
s: Socket file (socket)
2, file permissions:
r (4) W (2) x (1) r - x - w x
owning user user groups other users
&NBSP;&NBSP;&NBSP;&NBSP;CD. /.. / : Go back to the top-level directory
MV file_old.c file_new.c : Implementing renaming of the file
rm 1_day/-fr : Forcibly deleting the directory
rm./*-fr : Empty current directory
cp –r dir1/ dir2: Copy directory
mkdir –p dir1/dir2/dir3 : Nested creation of directories
Ln-s PAI.C 1: Create a soft connection to the file Pai.c 1, equivalent to a shortcut (delete the PAI.C, the link error, and then re-establish PAI.C, and can take effect)
ln PAI.C 1: Create a hard link to the file 1, after pai.c Delete, will not affect 1 access to the source files (PAI.C and 1 shared files of the I node)
"Compression and decompression"
1. zip Format:
zip-r dir.zip dir/: compressing the directory
Unzip Dir.zip : Unzip
2. gz Format:
gzip 1.c : gzip Compresses only one file at a time, and the compressed name is the source file name plus the suffix
gunzip 1.c.gz: Unzip
TAR–CF Myexamples.tar Myexamples: Archive only, do not compress = "TAR–XVF Myexamples.tar
TAR-CJF myexamples.tar.bz/bz2 myexamples: Compressed with bzip2 format = "TAR-XVJF myExamples.tar.bz
TAR-CZF myExamples.tar.gz myexamples: Compressed with gzip format = "Tar-xvzf myExamples.tar.gz
"Modify host Name"
hostname Myubuntu : Temporarily modified, resumed after reboot
vi/etc/hostname : permanent; After modifying the hostname, to modify the file /etc/hosts, so that the new host name has a corresponding IP (typically loopback address: 127.0.0.1)
DNS: Modify the file/etc/resolv.conf This file setting can have up to three DNS, as long as one has a valid
@ Ajmer Zhi Yuan | 2013-03-12