当前位置:网站首页>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边栏推荐
- 【Hot100】20. Valid parentheses
- How to use MySQL language for row and column devices?
- Tutorial on the principle and application of database system (005) -- Yum offline installation of MySQL 5.7 (Linux Environment)
- [daily question] 1175 Prime permutation
- Zhou Shaojian, rare
- 【每日一题】1175. 质数排列
- Learn selenium to simulate mouse operation, and you can be lazy a little bit
- 苹果自研基带芯片再次失败,说明了华为海思的技术领先性
- 红队第10篇:coldfusion反序列化过waf改exp拿靶标的艰难过程
- Mlperf training v2.0 list released, with the same GPU configuration, the performance of Baidu PaddlePaddle ranks first in the world
猜你喜欢

EndeavourOS移动硬盘安装

Problems encountered in IM instant messaging development to maintain heartbeat

picgo快捷键 绝了这人和我的想法 一模一样

普通二本,去过阿里外包,到现在年薪40W+的高级测试工程师,我的两年转行心酸经历...

Pico, do you want to save or bring consumer VR?

Embedded development: five revision control best practices

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

广东用电量大跌,说明高新技术产业替代高能耗产业已取得初步成果

2022 Moonriver global hacker song winning project list

【SQL语句】请问这边为什么select出了两个上海,查询出了不同的count我想让他变成一个上海,count只显示一个总和
随机推荐
Stonedb is building blocks for domestic databases, and the integrated real-time HTAP database based on MySQL is officially open source!
Tutorial on principles and applications of database system (004) -- MySQL installation and configuration: resetting MySQL login password (Windows Environment)
[每日一氵]Latex 的通讯作者怎么搞
Research on multi model architecture of ads computing power chip
Origin2018安装与使用(整理中)
【Hot100】20. 有效的括号
[JetsonNano] [教程] [入门系列] [三] 搭建TensorFlow环境
Golang爬虫框架初探
UML旅游管理系统「建议收藏」
韩国AI团队抄袭震动学界!1个导师带51个学生,还是抄袭惯犯
你还在用收费的文档管理工具?我这有更牛逼的选择!完全免费
[daily news]what happened to the corresponding author of latex
Tutorial on the principle and application of database system (003) -- MySQL installation and configuration: manually configure MySQL (Windows Environment)
Uncover the "intelligence tax" of mousse: spend 4billion on marketing, and only 7 invention patents
How to use MySQL language for row and column devices?
Do280 management application deployment - pod scheduling control
Red team Chapter 8: blind guess the difficult utilization process of the package to upload vulnerabilities
芯片供应转向过剩,中国芯片日产增加至10亿,国外芯片将更难受
How long will it take to achieve digital immortality? Metacosmic holographic human avatar 8i
数据库系统原理与应用教程(003)—— MySQL 安装与配置:手工配置 MySQL(windows 环境)