当前位置:网站首页>Detailed explanation of Ag search tool parameters
Detailed explanation of Ag search tool parameters
2022-07-25 21:17:00 【Tao Ge is still fly】
ag Detailed explanation of search tool parameters
Ag Is similar to ack, grep Tools for , It is used to search for the corresponding keywords in the file .
Officials have listed several reasons for choosing it :
- It is better than ack faster ( and grep Not on an order of magnitude )
- It will ignore .gitignore and .hgignore The matching file in
- If there are files you want to ignore , You need to add them to
.ignoreIn file - It has shorter command names :-)
install
ubuntu Direct installation :
sudo apt install silversearcher-ag
Basic use
ag The basic use of is very direct : Follow the command with what you want to search character string that will do , It will search all text files in the current directory , And return the result .
ag Module
Output :

You can see , The output will be clearly highlighted , and , It's really , Very fast .
.ignore The file name specified in the file will be skipped , No search . Just write in the file name you want to ignore :
# .ignore
model.py
trainer.py
Detailed format and command options
Here are some ag Common parameter options and their meanings :
| Options | function |
|---|---|
-s / -i / -S | Case sensitive / Insensitivity / Intelligent case determination ( Default ), That is, case sensitivity is turned on when there is uppercase , Otherwise it's not sensitive |
-c | count, Output several matching strings in each file |
-A / -B / -C [NUM] | after / before / context, Show matching to string [ after / front / Before and after ] NUM That's ok , Default 2 That's ok |
-a | Search all files , Include .ignore Ignored files , Don't include hidden files |
-D | Output ridiculous amounts of debugging info. Not useful unless you´re actually debugging. ( This sentence is the original manual , laugh ) |
-f | Track soft links , The default is not to track |
-g [PATTERN] | Output match PATTERN The name of the file |
-G [PATTERN] | Only search for file name matches PATTERN File contents of |
-l / -L | Only output can / The contents cannot match the file name of the successful file , Do not output line content |
-m [NUM] | Only before output NUM The content of the second successful match , Skip the rest , The default is 0, That is, all outputs |
-r / -n | yes / No, enter the directory for recursive search , Recursive search will be performed by default |
-o | Only the part of the line that matches successfully |
-p [PATH] | Provide the specified .ignore Path to file , Default to current directory |
-Q | Will not PATTERN Parse according to regular expressions |
-u | Search all files , Including binary files , But I still ignore .ignore Wait for the documents |
-U | Ignore VCS ignore file ( Include .gitignore, .hgignore), But I will still consider .ignore, The content of the first two will be searched , however .ignore The content in will still be ignored |
-w | Match only the whole word |
-V | Output version information |
-v | Match all lines that do not contain the specified string |
z | Search the contents of the compressed file |
Other options :
| Options | function |
|---|---|
--ackmate | By AckMate Output results in parsed format |
--hidden | Search for hidden files , But it will not search for ignored files , I.e -a contrary |
--depth [NUM] | Search directory depth ,-1 For unlimited , The default is 25 |
--ignore PATTERN | Ignore name matching to PATTERN Contents of files or directories , I.e -G contrary |
--[no]break | Whether there are blank lines between different files of search results , Default blank line |
--[no]color | Whether there is color highlight , The default is |
--column | Output column number |
This is basically all , There are also some parameters that are not very commonly used , All option parameters can man ag Check it out. .
边栏推荐
- Hello, I'd like to ask questions about C and database operation.
- MySQL inserts three tables with different values. The association condition is the primary foreign key. How about the syntax of the insertion statement?
- What's special about Huawei's innovative solutions to consolidate the foundation of ERP for small and medium-sized enterprises?
- Wokerman custom write log file
- The international summit osdi included Taobao system papers for the first time, and end cloud collaborative intelligence was recommended by the keynote speech of the conference
- Too many passwords, don't know how to record? Why don't you write a password box applet yourself
- ag 搜索工具参数详解
- SSH private key realizes login to remote target server
- Basic knowledge of Marine Geology
- [depth] the new LAAS agreement elephant: the key to revitalizing the development of the defi track
猜你喜欢

接口测试工具 restlet client

黑盒(功能)测试基本方法

Achieve accurate positioning based on Tencent map, and realize the attendance punch function of wechat applet

ag 搜索工具参数详解
![[fiddlertx plug-in] use Fiddler to capture the package Tencent classroom video download (unable to capture the package solution)](/img/de/7a288ee8e6001235d4869c10503932.png)
[fiddlertx plug-in] use Fiddler to capture the package Tencent classroom video download (unable to capture the package solution)
![[depth] the new LAAS agreement elephant: the key to revitalizing the development of the defi track](/img/ef/33f93225171e2c3e14b7d090c68196.png)
[depth] the new LAAS agreement elephant: the key to revitalizing the development of the defi track

Record the transfer of domain names from Alibaba cloud service providers to Huawei cloud

Miscellaneous notes -- a hodgepodge

Leetcode-6125: equal row and column pairs

How to solve the problem of high concurrency and large traffic with PHP
随机推荐
Differences between seaslog and monolog log systems, installation steps of seaslog [easy to understand]
Pychart automatically enters the test mode when running the program
Niuke-top101-bm37
Basic method of black box (function) test
黑盒(功能)测试基本方法
Programmer's Guide to health quenching 5: introduction to sports Basics
How to store pictures in the database "suggested collection"
7.23
Basic knowledge of Marine Geology
Kali modify the update source (it is not safe to update with this source)
Database SQL statement exercise "suggestions collection"
Vivo official website app full model UI adaptation scheme
Sum of two numbers and three numbers
Autojs learning - file depth search
Focus on data | Haitai Fangyuan directly hits the construction idea of data security governance in the securities industry
Leetcode-6126: designing a food scoring system
Leetcode-155: minimum stack
数据库sql语句练习题「建议收藏」
NPM module removal_ [solved] after NPM uninstalls the module, the module is not removed from package.json [easy to understand]
基于腾讯地图实现精准定位,实现微信小程序考勤打卡功能