当前位置:网站首页>Rhcsa Road
Rhcsa Road
2022-07-01 16:34:00 【Omniscient magical conch】
On the third day
Look at the catalog file : ls
View the contents of the text file
cat Output the contents of the file to the terminal , View file contents ( positive sequence )
-n View the contents of the file and display the label
tac Output the contents of the file to the terminal , View file contents ( Show in reverse order )
more Generally, large files can be displayed in pages through the terminal window , Finally, all contents are output to the terminal to view and display
less Open reading , Pagination display , Exit needs to pass q
? keyword perhaps / keyword
n Match keywords up
N Match keywords down
head View the first ten lines of information in the file
-n Specify the number of lines to display
-n 3
tail View the last ten lines of the file
-n 3
-f follow Append the contents of the display file ctrl+c
tail -f /var/log/messages
Text editing
1.nano
2.vi / vim *** Text editor
The last line of the terminal
Display a new file or file name with a few lines and characters or no information ( Execute convenient commands )
--insert--- ( Edit file contents )
Command mode :
dd Deletes the line where the cursor is located
d+enter Delete the line where the cursor is located and the next line of the cursor
dG Delete the line where the cursor is located and all lines at the end of the document
dgg Delete the line where the cursor is located and all lines at the beginning of the document
d^ Delete the cursor to the beginning of the line , Does not contain cursor characters
d$ Delete cursor to end of line , Contains the character of the cursor
x Delete cursor character
G Jump to the end of the document
gg Jump to the beginning of the document
4G Jump to line four
^ Head of line
$ At the end of the line
yy Copy
4yy Copy a total of four lines starting from the cursor
cc shear
4cc Cut a total of four lines starting from the cursor
p Paste ( Paste on the next line of the cursor )
u Undo to the left ( Return to the last editing status )
ctrl+r redo ( Undo right , Return to the state of recent editing )
Insertion mode :
a Insert content after cursor
A The end of the line where the cursor is located
i Insert content in front of the cursor
I The beginning of the line where the cursor is located
o Enter insertion mode , Add content on the next line of the cursor
O Enter insertion mode , Add content on the line above the cursor
s Delete cursor character , Enter insertion mode
S Deletes the line where the cursor is located , Enter insertion mode
Last row mode :
:q sign out
:q! Forced exit
:w preservation
:wq Save and exit == ZZ Command mode
:wq! Forced save exit
:10 Jump to line 10
:1,10 co 5 Copy 1-10 Go to the first place 5 After line
:g/#/d lookup # And delete
:r FILENMAE Read the contents of the specified file to the next line of the cursor
:%s % Match symbol , Indicates that all rows are matched s Replace the command / Characters to replace / The replaced character / Replace the keywords that are matched for the first time in each line g Replace all matching keywords %s /0/1/g
:set nu According to the line Numbers
:set nonu Cancel the line Numbers
/ keyword Quickly match the content of the line where the keyword is located
:noh Unhighlight
vim -o /etc/passwd /etc/shadow Multiple files horizontally split the display content
-O /etc/passwd /etc/shadow Left and right split screen display of file content
ctrl+w+w
vim + /etc/passwd Open the file and enter the end of the document

3.">" or “>>” Realize file editing
echo Print command
#echo this is test ( Standard I / O commands )
this is test $ Reference variables
#name=zhangsan
#echo $name
zhangsan
${}
#echo ${name}
zhangsan$? A command on the exit code is displayed 0 success 1-255 Error status
[[email protected] ~]# echo ${name}
zhangsan
[[email protected] ~]# echo $?
0
[[email protected] ~]# haha
bash: haha: command not found...
Failed to search for file: Cannot update read-only repo
[[email protected] ~]# echo $?
127| Pipe, ( Take the standard output of the previous command as the standard input of the following command )--- Nameless pipe
Displays the tenth line of a file
#head /etc/passwd | tail -1
eg: Show /etc/passwd file 20-25 The content of the line **p Identified pipeline file ( name pipes )
Turn on two terminals
1 terminal :
#mkfifo /p1
#echo 123 > /p1
2 terminal :
#cat /p1
123The three quotation marks are different
' Single quotation marks ' Strong citation , Do not recognize the special meaning of special characters in quotation marks echo '$PS1'
" Double quotes " Weak reference , Identify characters with special meaning , echo “$PS1” --- If it is a variable, there is a difference between single reference and double reference
\ The quotation marks Command substitutions == $()
[[email protected] /]# echo " All files in the root directory \`ls`"">" Output redirector ( Write the output result of the previous command to the specified file output )
The redirection character will overwrite the original file
echo helloworld > FILE take helloworld The output result is written to the specified file through the output redirection character , When the file does not exist, it will be created “>>” Append redirector
Appending a redirection character will not overwrite the original file
echo this is test >> FILENAME < Enter the redirector
cat < /etc/passwd
head < /etc/passwd4. File editing << Termination Terminator
[[email protected] /]# cat << EOF View content , Match the terminator to end the input
> this is test -- The standard input
> EOF -- Match to terminator , End standard input
this is test -- Output the contents of the previous standard input to the standard output
---------------------------
[[email protected] /]# cat << EOF > file2
> this is 1
> this is 2
> this is 3
> EOF
[[email protected] /]# cat file2
this is 1
this is 2
this is 3File descriptor :0 Document standard input character 1 standard ( correct ) Output descriptor 2 Error output descriptor
cat 0< /etc/passwd
cat fff 1> file == cat fff > file
cat fff 2> file
cat fff &> file == cat fff 1> file 2> file == cat fff 1> file 2>&1
cat fff 1> file 2> /dev/nullCommands related to file content processing ---( That's ok )
grep Text filter display command
Command format : grep [-options...] keyword file name ...
#grep root /etc/passwd take /etc/passwd In file root Keyword line print display
-v Reverse filtration , Print and display lines without keywords
-o Show only the matching keywords
-c Displays the number of rows matching the keyword
-i Ignore case
-n Filter and display line numbers
-w Filter by word
-A 2 Display keywords and the next two lines of information
-B 2 Display keywords and the last two lines of information
-C 3 Display keywords and three lines of information
Filter specified files /etc/passwd There will be... In the file nologin The line of the keyword is written to login file , And write in the order of the original file .
[[email protected] /]# grep nologin /etc/passwd > login
Only the key information of one matching file is displayed
[[email protected] /]# grep -v ^# /etc/login.defs | grep -v ^$
Judge /usr/bin Whether there is passwd Executable file
[[email protected] /]# ll /usr/bin | grep -w passwd
-rwsr-xr-x. 1 root root 34512 Aug 12 2018 passwd^ What does it start with ^q ^#
$ What does it end with a$
^$ Blank line
[] Define the value range , Any single character in this range [1-9] grep ^[0-9] FILENAME The beginning is 0-9 The line of any number shows
[^] ^ Take the opposite ^[^0-9] ^[!0-9]
cut Text content cutting command
-d Specify the delimiter of the file content
-f Specify the intercepted field
#cut -d : -f 1 /etc/passwd
[[email protected] /]# date |cut -d " " -f 6
2022-c Specify character interception cut -c 1-3 /etc/passwd
wc Text statistics command That's ok Word book Number of bytes file name
-l Just count the lines
-w Just count the number of words
-c Count the number of bytes
-m Count characters
How many users are there in the current system
[[email protected] /]# echo There are users in the current system \wc -l /etc/passwd | cut -d " " -f 1 individual > file There are users in the current system 44 individual
sort Text sorting Sort by character by default
-n Display in ascending order of numerical value
-r Show in reverse order
-t Specify the separator
-k Specified field
-u unique duplicate removal ==sort a.txt | uniq
[[email protected] /]# sort -t : -k 3 -n /etc/passwd
take /etc/passwd The contents of the document are passed through : Split sorts the third field and displays the contents of each line in ascending order uniq To repeat the order ( Repeat rows adjacent to each other )
-c Displays the number of times each line is repeated
-d Show only recurring lines
-D Show all rows that appear repeatedly
tr Character substitution
echo abcde | tr -t a 1
-c Inverse selection
echo abcde | tr -c abc 0 Take care of abc Replace characters other than with 0 character
abc00
-s Replace consecutive repeated characters with a single character
echo aaaaabcd | tr -s a 1 Will be a continuous number of a Replace the character with a 1 character
-d Delete selected characters
echo abcdef | tr -d abc边栏推荐
- Germany if was crowned with many awards. How strong is this pair of headphones? In depth evaluation of yinpo GTW 270 hybrid
- OJ questions related to complexity (leetcode, C language, complexity, vanishing numbers, rotating array)
- C#/VB. Net merge PDF document
- Comment utiliser le langage MySQL pour les appareils de ligne et de ligne?
- 数据库系统原理与应用教程(005)—— yum 离线安装 MySQL5.7(Linux 环境)
- 红队第10篇:coldfusion反序列化过waf改exp拿靶标的艰难过程
- Authentication processing in interface testing framework
- 从大湾区“1小时生活圈”看我国智慧交通建设
- Use Tencent cloud to build a map bed service
- Do280 management application deployment - pod scheduling control
猜你喜欢

Tutorial on the principle and application of database system (003) -- MySQL installation and configuration: manually configure MySQL (Windows Environment)

数据库系统原理与应用教程(002)—— MySQL 安装与配置:MySQL 软件的卸载(windows 环境)

【Hot100】17. Letter combination of telephone number

高端程序员上班摸鱼指南

Pico, do you want to save or bring consumer VR?
![[每日一氵]Latex 的通讯作者怎么搞](/img/0f/d19b27dc42124c89993dee1bada838.png)
[每日一氵]Latex 的通讯作者怎么搞

Five years after graduation, I became a test development engineer with an annual salary of 30w+

数据库系统原理与应用教程(004)—— MySQL 安装与配置:重置 MySQL 登录密码(windows 环境)

Share the daily work and welfare of DJI (Shenzhen headquarters) in Dajiang

瑞典公布决定排除华为5G设备,但是华为已成功找到新出路
随机推荐
How to write good code - Defensive Programming Guide
Motion capture system for apple picking robot
数据库系统原理与应用教程(002)—— MySQL 安装与配置:MySQL 软件的卸载(windows 环境)
Solution to the problem that the keypad light does not light up when starting up
I'm a senior test engineer who has been outsourced by Alibaba and now has an annual salary of 40w+. My two-year career changing experience is sad
嗨 FUN 一夏,与 StarRocks 一起玩转 SQL Planner!
Can't global transactions be used when shardingjdbc is used in seate?
Authentication processing in interface testing framework
China's intelligent transportation construction from the perspective of "one hour life circle" in Dawan District
Vscode find and replace the data of all files in a folder
Do280 management application deployment - pod scheduling control
【Hot100】19. 删除链表的倒数第 N 个结点
【Hot100】17. 电话号码的字母组合
[jetsonnano] [tutorial] [introductory series] [III] build tensorflow environment
Research on multi model architecture of ads computing power chip
实现数字永生还有多久?元宇宙全息真人分身#8i
Mlperf training v2.0 list released, with the same GPU configuration, the performance of Baidu PaddlePaddle ranks first in the world
IM即時通訊開發實現心跳保活遇到的問題
Which MySQL functions are currently supported by tablestore in table storage?
How does win11 set user permissions? Win11 method of setting user permissions