当前位置:网站首页>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
边栏推荐
- 013_ Analysis of SMS verification code login process based on session
- Flink stream processing engine system learning (III)
- A domestic image segmentation project is heavy and open source!
- arduino esp8266 网络升级 OTA
- How big the program development of single chip microcomputer project can be, it represents your level of knocking code
- [suggestion collection] hematemesis sorting out golang interview dry goods 21 questions - hanging interviewer-1
- They are all intelligent in the whole house. What's the difference between aqara and homekit?
- PTA: praise the crazy devil
- After idea is successfully connected to H2 database, there are no sub files
- MySQL JDBC programming
猜你喜欢

基于Torchserve部署SBERT模型<语义相似度任务>

Daily question (April 22, 2022) - rotation function

都是做全屋智能的,Aqara和HomeKit到底有什么不同?

JVM运行时数据区(一)

Flink stream processing engine system learning (I)

能做多大的单片机项目程序开发,就代表了你的敲代码的水平

How to recognize products from the perspective of Dialectics

【unity3D】直播间滚动式弹幕效果
Rich intelligent auxiliary functions and exposure of Sihao X6 security configuration: it will be pre sold on April 23

Global, exclusive, local Routing Guard
随机推荐
智能辅助功能丰富,思皓X6安全配置曝光:将于4月23日预售
Target narak
Tp6 Alibaba cloud SMS window reports curl error 60: SSL certificate problem: unable to get local issuer certificate
【无标题】
本地远程访问云服务器的jupyter
C standard library - < time h>
[nk]牛客月赛48 D
tp6阿里云短信 window 报 cURL error 60: SSL certificate problem: unable to get local issuer certificate
Solve the problem that the registered Google email Gmail mobile number cannot be used for verification
Web learning record (medium)
Using go language to build web server
解决 注册谷歌邮箱 gmail 手机号无法用于验证
PTA: praise the crazy devil
小程序 canvas 画布半圆环
16、 Anomaly detection
Renesas electronic MCU RT thread development and Design Competition
Arduino esp8266 network upgrade OTA
Applet reads files
009_ Redis_ Getting started with redistemplate
Daily question (April 22, 2022) - rotation function