当前位置:网站首页>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边栏推荐
- 德国iF多项大奖加冕,这副耳机有多强?音珀GTW 270 Hybrid深度评测
- The picgo shortcut is amazing. This person thinks exactly the same as me
- 程序员职业生涯真的很短吗?
- [nodemon] app crashed - waiting for file changes before starting... resolvent
- PostgreSQL 存储结构浅析
- Which MySQL functions are currently supported by tablestore in table storage?
- IM即时通讯开发万人群聊消息投递方案
- Red team Chapter 10: ColdFusion the difficult process of deserializing WAF to exp to get the target
- laravel的模型删除后动作
- 数据库系统原理与应用教程(005)—— yum 离线安装 MySQL5.7(Linux 环境)
猜你喜欢

使用腾讯云搭建图床服务

SQLServer查询: a.id与b.id相同时,a.id对应的a.p在b.id对应的b.p里找不到的话,就显示出这个a.id和a.p
![[jetsonnano] [tutorial] [introductory series] [III] build tensorflow environment](/img/0e/52e37527bc717c7a55741725087bad.png)
[jetsonnano] [tutorial] [introductory series] [III] build tensorflow environment

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

2023 spring recruitment Internship - personal interview process and face-to-face experience sharing
![[nodemon] app crashed - waiting for file changes before starting... resolvent](/img/ee/9830afd86e092851a2a906cb994949.png)
[nodemon] app crashed - waiting for file changes before starting... resolvent

DO280管理应用部署--pod调度控制

In the past six months, it has been invested by five "giants", and this intelligent driving "dark horse" is sought after by capital

OJ questions related to complexity (leetcode, C language, complexity, vanishing numbers, rotating array)

Do280 management application deployment - pod scheduling control
随机推荐
Comprehensively view the value of enterprise digital transformation
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
Principes et applications du système de base de données (006) - - compilation et installation de MySQL 5.7 (environnement Linux)
怎麼用MySQL語言進行行列裝置?
毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?
瑞典公布决定排除华为5G设备,但是华为已成功找到新出路
苹果自研基带芯片再次失败,说明了华为海思的技术领先性
vim用户自动命令示例
Go 语言怎么使用对称加密?
芯片供应转向过剩,中国芯片日产增加至10亿,国外芯片将更难受
[SQL statement] Why do you select two Shanghai and query different counts here? I want it to become a Shanghai, and count only displays a sum
picgo快捷键 绝了这人和我的想法 一模一样
【Hot100】19. Delete the penultimate node of the linked list
Research on multi model architecture of ads computing power chip
數據庫系統原理與應用教程(006)—— 編譯安裝 MySQL5.7(Linux 環境)
广东用电量大跌,说明高新技术产业替代高能耗产业已取得初步成果
Vscode find and replace the data of all files in a folder
Is it reliable to open an account on flush with mobile phones? Is there any potential safety hazard
Principle of motion capture system
[observation] where is the consulting going in the digital age? Thoughts and actions of softcom consulting