当前位置:网站首页>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
边栏推荐
- 电源电路设计原来是这么回事
- [XJTU computer network security and management] Lecture 2 password technology
- 双亲委派模型【理解】
- Implementation of distributed scenario business operation log (based on redis lightweight)
- 想用Mac学习sql,主要给自己个充足理由买Mac听听意见
- 16、 Anomaly detection
- 数仓建表111111
- 都是做全屋智能的,Aqara和HomeKit到底有什么不同?
- Synchronized lock and its expansion
- 010_ StringRedisTemplate
猜你喜欢
010_ StringRedisTemplate
都是做全屋智能的,Aqara和HomeKit到底有什么不同?
Jupyter for local and remote access to ECS
魔王冷饭||#078 魔王答上海、南京行情;沟通指导;得国和打杀筛选;赚钱的目的;改变别人看法
day18--栈队列
The usage and difference of * and & in C language and the meaning of keywords static and volatile
Preliminary understanding of stack and queue
JVM运行时数据区(一)
每日一题(2022-04-21)——山羊拉丁文
Download the genuine origin Pro 2022 tutorial and how to activate it
随机推荐
16、 Anomaly detection
How to recognize products from the perspective of Dialectics
PTA: Romantic reflection [binary tree reconstruction] [depth first traversal]
Water diversion into chengluo Valley p1514
PTA: praise the crazy devil
Real math problems in 1958 college entrance examination
Develop a chrome plug-in from 0 (2)
Want to experience homekit smart home? Why don't you take a look at this smart ecosystem
在MySQL Workbench中执行外部的SQL脚本,报错
tp6阿里云短信 window 报 cURL error 60: SSL certificate problem: unable to get local issuer certificate
类初始化和实例初始化面试题
This is how the power circuit is designed
期中汇总(概论+应用层+运输层)
006_ redis_ Sortedset type
WordPress calls the specified page content. 2 get_ children()
Flink stream processing engine system learning (II)
013_ Analysis of SMS verification code login process based on session
程序设计天梯赛 L1-49 天梯赛分配座位(模拟),布响丸辣
小程序 canvas 画布半圆环
Using go language to build web server