Linux is the most commonly used commands (3)

System commonly used commands

command Options Examples meaning
top top Display process consumes the most resources in the current system
date date The system displays the current time
ps Less used alone, with the options according to the needs, ps -ef or ps -aux
-e ps -e Show all processes
-f ps -ef Full format
-a PS-A Display all processes for all users (including other users)
-u ps - the Order a user name and start time to show progress
-x ps aux Showed no process control terminal
kill -9 kill -9 pid Forced to kill a process
df -h df -h Display case where disk space using the system in human-readable manner
of -sh df -sh The sum of the specified directory and its subdirectories display has been used in a human readable form of disk space
free free Display current memory usage and swap space
ifconfig ifconfig eth0 192.168.116.2 NIC network configuration, P temporarily modify the system, the failure reboot
ping ping baidu.com Test network connectivity
-c ping -c 3 192.168.116.1 Specifies the number of transmissions
hostname hostname View hostname
shutdown -r shutdown -r First off, and then restart
shutdown -h shutdown -h Does not restart after shutdown

Linux system commonly used shortcut commands and symbols

command Examples meaning
ctrl+c Stop process
ctrl+l Clear screen
ctrl+r Search-history
ctrl+q drop out
tab Autocomplete
> ech0 “hello world” > a.txt The output of the previous command, and writes back the file, the text will be emptied, and then write
>> ech0 “hello world” >> a.txt The output of the previous command, and writes back the file, does not clear the text, the text is appended to the last
| cat a.txt | grep ‘hello world’ Pipe command, the output of a previous command as input, and computes. Example: in-line printing with a.txt hello world string
* Wildcard means all

vim editor

Modify the text

symbol meaning
i Is inserted before the cursor
| The current line is inserted at the cursor
a Inserted after the cursor
A Is inserted at the end of the current line of the cursor
O Current cursor next line insert a new row
O The cursor is on a line current row insert a new row
:wq Save and Exit

Positioning command

symbol meaning
:set nu 显示行号
:set nomu 取消行号
gg 跳到首行
G 跳到末行
:n 跳到第n行

替换和取消命令

符号 含义
u undo,取消上一步操作
ctrl+r redo,返回到undo之前
r 替换光标所在处的字符
R 从光标所在处开始替换,按ESC键结束

删除命令

符号 含义
x 删除光标所在处字符
nx 删除光标所在处后的n个字符
dd 删除光标所在行,ndd删除n行
dG 删除光标所在行到末尾行的所有内容
D 删除光标所在处当行尾的内容
:5,7 d 删除指定范围的行

常用快捷键

符号 含义
shift+zz 保存并退出
v 进入字符可视化模式
V 进入行可视化模式
ctrl+v 进入块可视化模式
发布了51 篇原创文章 · 获赞 74 · 访问量 24万+

Guess you like

Origin blog.csdn.net/weixin_44766179/article/details/103851756