当前位置:网站首页>Rhcsa Road
Rhcsa Road
2022-07-01 16:34:00 【Omniscient magical conch】
The fourth day
File search 4 Ways of planting
whereis The query scope searches for files through the path of system environment variables $PATH, All documents
[[email protected] ~]# whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz
[[email protected] ~]# whereis pwd
pwd: /usr/bin/pwd /usr/share/man/man1/pwd.1.gz /usr/share/man/man1p/pwd.1p.gzwhich The query scope searches for files through the path of system environment variables $PATH, Looking for executable ( Find command file )
[[email protected] ~]# which locate
/usr/bin/locate
[[email protected] ~]# which whereis
/usr/bin/whereislocate Global search , But you need to import the system files into the database before searching updatedb; Fast search speed
[[email protected] ~]# locate whereis
/usr/bin/whereis
/usr/share/bash-completion/completions/whereis
/usr/share/man/man1/whereis.1.gz*find Global search for files .
Parameters | effect |
-name | Match name |
-perm 644 | Match permissions (mode For a perfect match ,-mode Just for inclusion ) |
-user | Match users |
-group | Match all groups |
-mtime -n +n | Match when the content was modified (-4 Means less than or equal to 4 File name within days ;+4, Greater than or equal to 5 Documents before name ;4 Forefinger 4~5 The documents of that day ) |
-atime -n +n | Match access time to file |
-ctime -n +n | Match when the file permission was modified |
-nouser | Match files without owner |
-nogroup | Match files without all groups |
-newer f1 !f2 | Matching ratio file f1 New than f2 Old documents |
-type b/d/c/p/l/f | Match file type ( The following alphanumeric parameters in turn represent block devices 、 Catalog 、 Character device 、 The Conduit 、 link file 、 text file ) |
-size | Match file size (+50KB To find more than 50KB The file of , and -50KB To find less than 50KB The file of ) |
prune | Ignore a directory |
-exec …… {}\; | This can be followed by commands for further processing of search results |
matters needing attention :
find Find the directory of the file -path Directory to exclude -prune -o -name What to query
1)-prune It has to be with -path,-o Use it together
2)-prune -o The order is not Can exchange
3)-name Etc. must be placed in -prune -o You can use it later
eg: find . -path ./tmp -prune -o -name "*.txt"
1. Search by filename
[[email protected] ~]# find Search path [ Options ] Search content
Options :
-name: Search by filename
-iname: Search by filename , Case insensitive file names
-inum: according to inode Search on [[email protected] ~]# find Search path [ Options ] Search content
Options :
-size [+|-] size : Search for files of the specified size there “+” Search for files larger than the specified size , “-” Search for a text smaller than the specified size Pieces of [[email protected] ~]# find Search path [ Options ] Search content
Options :
-atime [+|-] Time : Search by file access time
-mtime [+|-] Time : Search by file data modification time
-ctime [+|-] Time : Search according to file status modification time File compression and decompression
tar Filing order
Options | function |
| c | establish .tar In the form of Bao Wenjian |
| x | Release .tar In the form of Bao Wenjian |
| t | View the list of files in the package |
| v | Indicates that detailed prompt information is displayed when the command is executed |
f Baowen Piece name | Used to specify the package file name . When and -c When used with options , Created tar The package file uses the file name specified by this option ; When and -x When used with options , Release the... Specified by this option tar Package file |
| p | Preserve the permissions of files and directories when packaging |
| z | call gzip Program , With gzip Compress or decompress the file in the format . |
| j | call bzip2 Program , With bzip2 Compress or decompress the file in the format . |
| J | Use xz Compress (.tar.xz).xz The compression ratio is usually higher than bzip2 Higher . |
C Catalog route name | When releasing a package, specify the location of the target to be released . |
alias Define command aliases
Command cache
1. Build command cache
Execute the command to automatically create in the cache
hash -p /usr/bin/touch touch
hash -p /usr/bin/touch chuangjian
2. Delete cache
hash -d chuangjian
hash -r Empty all caches
exit terminal
Caching features : Command cache ---alias-- Name order document
[[email protected] ~]# hash
hits command
3 /usr/bin/vim
1 /usr/bin/cat
1 /usr/sbin/pidof
2 /usr/bin/su
[[email protected] ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[[email protected] ~]# which touch
/usr/bin/touch
[[email protected] ~]# touch a
[[email protected] ~]# hash
hits command
3 /usr/bin/vim
1 /usr/bin/cat
1 /usr/bin/touch
1 /usr/sbin/pidof
2 /usr/bin/su
[[email protected] ~]# touch /usr/bin/touch ---= Priority through cache matching
[[email protected] ~]# hash
hits command
3 /usr/bin/vim
1 /usr/bin/cat
2 /usr/bin/touch
1 /usr/sbin/pidof
2 /usr/bin/su
[[email protected] ~]# mv /usr/bin/touch /usr/local/bin
[[email protected] ~]# touch b
bash: /usr/bin/touch: No such file or directory
[[email protected] ~]# hash -d touch
[[email protected] ~]# hash
hits command
3 /usr/bin/vim
1 /usr/bin/cat
1 /usr/sbin/pidof
3 /usr/bin/mv
2 /usr/bin/su
[[email protected] ~]# touch b ---- There is no cache and the command file under the alias execution environment variable path
[[email protected] ~]# hash -p /usr/bin/tac chakan -- Alias
history
边栏推荐
- Tutorial on principles and applications of database system (006) -- compiling and installing MySQL 5.7 (Linux Environment)
- Do280 management application deployment - pod scheduling control
- Go 语言怎么优化重复的 if err != nil 样板代码?
- Research on multi model architecture of ads computing power chip
- StoneDB 为国产数据库添砖加瓦,基于 MySQL 的一体化实时 HTAP 数据库正式开源!
- FPN网络详解
- [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
- 普通二本,去过阿里外包,到现在年薪40W+的高级测试工程师,我的两年转行心酸经历...
- 使用腾讯云搭建图床服务
- Uncover the "intelligence tax" of mousse: spend 4billion on marketing, and only 7 invention patents
猜你喜欢

StoneDB 为国产数据库添砖加瓦,基于 MySQL 的一体化实时 HTAP 数据库正式开源!

Tutorial on principles and applications of database system (004) -- MySQL installation and configuration: resetting MySQL login password (Windows Environment)

【Hot100】20. Valid parentheses

Stonedb is building blocks for domestic databases, and the integrated real-time HTAP database based on MySQL is officially open source!

从大湾区“1小时生活圈”看我国智慧交通建设

Building blocks for domestic databases, stonedb integrated real-time HTAP database is officially open source!

怎么用MySQL语言进行行列装置?

Share the daily work and welfare of DJI (Shenzhen headquarters) in Dajiang

Zhou Shaojian, rare

VMware 虛擬機啟動時出現故障:VMware Workstation 與 Hyper-v 不兼容...
随机推荐
Im instant messaging develops a message delivery scheme for 10000 people
Motion capture system for apple picking robot
UML旅游管理系统「建议收藏」
Ring iron pronunciation, dynamic and noiseless, strong and brilliant, magic wave hifiair Bluetooth headset evaluation
韩国AI团队抄袭震动学界!1个导师带51个学生,还是抄袭惯犯
【Hot100】19. 删除链表的倒数第 N 个结点
Golang爬虫框架初探
The sharp drop in electricity consumption in Guangdong shows that the substitution of high-tech industries for high-energy consumption industries has achieved preliminary results
高端程序员上班摸鱼指南
[observation] where is the consulting going in the digital age? Thoughts and actions of softcom consulting
用手机在同花顺上开户靠谱吗?这样有没有什么安全隐患
实现数字永生还有多久?元宇宙全息真人分身#8i
Graduation season | Huawei experts teach the interview secret: how to get a high paying offer from a large factory?
Comprehensively view the value of enterprise digital transformation
复杂度相关OJ题(LeetCode、C语言、复杂度、消失的数字、旋转数组)
数据库系统原理与应用教程(004)—— MySQL 安装与配置:重置 MySQL 登录密码(windows 环境)
程序员职业生涯真的很短吗?
數據庫系統原理與應用教程(006)—— 編譯安裝 MySQL5.7(Linux 環境)
Virtual serial port simulator and serial port debugging assistant tutorial "suggestions collection"
[JetsonNano] [教程] [入门系列] [三] 搭建TensorFlow环境