当前位置:网站首页>Rhcsa day 4 operation
Rhcsa day 4 operation
2022-04-23 02:36:00 【Enron tears】
1、 Find command usage
Use whereis lookup locate command
[root@localhost ~]# whereis locate locate: /usr/bin/locate /usr/share/man/man1/locate.1.gz
Use which Command find whereis command
[root@localhost ~]# which whereis /usr/bin/whereis
Use locate Command find rm command
[root@localhost ~]# locate rm
2、find Command to use :
Use find Command to find all ordinary files in the current path
[root@localhost test2]# find . -type f ./new_test1.txt ./text.txt ./test111symb.txt ./text111.txt
Use find Command to find... In the current path file1.txt,file2.txt,file3.txt
[root@localhost ~]# find . -name file* find: paths must precede expression: file5 Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
Use find The command to find the file owner is root The ordinary documents of
[root@localhost ~]# find . -user root -type f ./.bash_logout ./.bash_profile ./.bashrc ./.cshrc ./.tcshrc ./.cache/dconf/user ./.cache/event-sound-cache.tdb.bcb77bbd33b940cf88ba92dcc3c5795c.x86_64-redhat-linux-gnu
Use find The modification time under the command is 1 Ordinary documents within days
[root@localhost ~]# find . -mtime -1 -type f ./.cache/tracker/meta.db ./.cache/tracker/meta.db-wal ./.cache/tracker/meta.db-shm ./.cache/tracker/locale-for-miner-apps.txt ./.cache/gnome-software/shell-extensions/gnome.json ./.cache/gnome-software/shell-extensions/extensions-web.xmlb ./.cache/gnome-software/odrs/ratings.json ./.config/ibus/bus/bcb77bbd33b940cf88ba92dcc3c5795c-unix-0 ./.config/dconf/user
3、cut Command to use
Given the file cut_data.txt And the content is :
No Name Score 1 zhang 20 2 li 80 3 wang 90 4 sun 60
Use the default delimiter to cut the contents of the file , And output the first field after cutting
[root@localhost ~]# cut -f1 cut_data.txt No 1 2 3 4
Use the default delimiter to cut the contents of the file , And output the first field and the third field after cutting
[root@localhost ~]# cut -f1,3 cut_data.txt No Score 1 20 2 80 3 90 4 60
Cut by byte : Output the first byte to the second byte of the cut 10 Bytes of content
[root@localhost ~]# cut -b 1-10 cut_data.txt No Name Sc 1 zhang 20 2 li 80 3 wang 90 4 sun 60
Cut by character : Output the first character and the second character after cutting 5 Characters to content
[root@localhost ~]# cut -c 1-5 cut_data.txt No Na 1 zha 2 li 3 wan 4 sun
Cut according to the specified delimiter : The contents are as follows , Output the contents of the first and third fields
No|Name|Score
1|zhang|20
2|li|80
3|wang|90
4|sun|60
[root@localhost ~]# cut -d "|" -f1,3 cut_data2.txt No|Score 1|20 2|80 3|90 4|60
4、uniq Command to use
New file uniq_data.txt, The content of the document is
Welcome to linux
Windows
Windows
Mac
Mac
Linux
Use uniq The command outputs the result after de duplication
[root@localhost ~]# uniq uniq_data.txt Welcome to linux Windows Mac Linux
Use uniq The command outputs only duplicate lines
[root@localhost ~]# uniq -D uniq_data.txt Windows Windows Mac Mac
Use uniq The command outputs non repeating lines
[root@localhost ~]# uniq -u uniq_data.txt Welcome to linux Linux
Use uniq The command counts the number of repetitions
[root@localhost ~]# uniq -c uniq_data.txt 1 Welcome to linux 2 Windows 2 Mac 1 Linux
5、sort command
Given file content num.txt,args.txt
num.txt:
1
3
5
2
4
args.txt:
test
args1
args2
args4
args4
args3
Yes num.txt Sort , And output the results to sorted_num.txt in
[root@localhost ~]# sort num.txt > sorted_num.txt [root@localhost ~]# cat sorted_num.txt 1 2 3 4 5
Yes args.tbxt Sort , And output the results to sorted_args.txt in
[root@localhost ~]# sort args.txt > sorted_args.txt [root@localhost ~]# cat sorted_args.txt args1 args2 args3 args4 args4 test
Yes num.txt and args.txt Sort , And output the results to sorted_merge.txt in
[root@localhost ~]# sort num.txt args.txt > sorted_merge.txt [root@localhost ~]# cat sorted_merge.txt 1 2 3 4 5 args1 args2 args3 args4 args4 test
Yes args.txt After sorting, de re output
[root@localhost ~]# sort args.txt | uniq args1 args2 args3 args4 test
Merge sorted_args.txt and sorted_num.txt And output
[root@localhost ~]# sort -m sorted_num.txt sorted_args.txt 1 2 3 4 5 args1 args2 args3 args4 args4 test
Given the file info_txt: Press the second column as key Sort
No Name Score 1 zhang 20 2 li 80 3 wang 90 4 sun 60
[root@localhost ~]# sort info_txt -k2 2 li 80 No Name Score 4 sun 60 3 wang 90 1 zhang 20
6、tr Command to use
take 26 After a lowercase letter 13 Replace the first letter with a capital letter
[root@localhost ~]# cat tr_data.txt | tr 'n-z' 'N-Z' abcdefghijklmNOPQRSTUVWSYZ
take hello 123 world 456 Replace the numbers in with empty characters ( Prompt to use wildcards )
[root@localhost ~]# cat tr_data2.txt | tr '1-6' '\0' hello world
take hello 123 world 456 Replace the letters and spaces in , Just keep the numbers ( Use wildcard characters when using a body )
[root@localhost ~]# cat tr_data2.txt | tr 'a-z' '\0' 123 456
7、wc Command to use
Given the file :word_count.txt, It's filled with 10 Row content
Count by byte
Count by word
Count by
[root@localhost ~]# vim word_count.txt # Statistics by byte [root@localhost ~]# wc -c word_count.txt 50 word_count.txt # Count by word [root@localhost ~]# wc -w word_count.txt 10 word_count.txt # Count by line [root@localhost ~]# wc -l word_count.txt 10 word_count.txt
版权声明
本文为[Enron tears]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220815166542.html
边栏推荐
猜你喜欢

JVM类加载器

MySQL JDBC programming

009_ Redis_ Getting started with redistemplate

Talk about biology live broadcast: Dr. Wang Ziyuan, a lake view biology, exploring hepatitis B with gene therapy

Flink stream processing engine system learning (II)

Fast and robust multi person 3D pose estimation from multiple views

Want to experience homekit smart home? Why don't you take a look at this smart ecosystem
![[XJTU计算机网络安全与管理]第二讲 密码技术](/img/b0/263e8dcbfeb2ce9f504a9c8eb76b07.png)
[XJTU计算机网络安全与管理]第二讲 密码技术

They are all intelligent in the whole house. What's the difference between aqara and homekit?

012_ Access denied for user ‘root‘@‘localhost‘ (using password: YES)
随机推荐
C语言中*与&的用法与区别 以及关键字static和volatile 的含义
Cuisine leetcode
[chrome extender] content_ Cross domain problem of script
Want to experience homekit smart home? Why don't you take a look at this smart ecosystem
Hack the box optimum
Latin goat (20204-2022) - daily question 1
JVM类加载器
005_ redis_ Set set
想用Mac学习sql,主要给自己个充足理由买Mac听听意见
小程序 读取文件
Develop a chrome plug-in from 0 (2)
leetcode 烹飪料理
智能辅助功能丰富,思皓X6安全配置曝光:将于4月23日预售
Lighting LED of IAR embedded development stm32f103c8t6
hack the box optimum靶机
[XJTU计算机网络安全与管理]第二讲 密码技术
Flink stream processing engine system learning (I)
Leetcode cooking
How many steps are there from open source enthusiasts to Apache directors?
Talk about current limiting