Linux command
vgrep 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Search pattern
vgrep "[pattern]"
Search in directory
vgrep "[pattern]" [path]
Open results interactively
vgrep -s "[pattern]"
Show specific result
vgrep --show [index]
No git ignore
vgrep --no-git "[pattern]"
说明
vgrep is a pager for grep results that assigns an index number to each match, allowing you to quickly open specific results in your editor by number. It respects .gitignore rules by default and provides both batch and interactive modes. In interactive mode (-s), results can be browsed and opened directly. The --show flag opens a previously indexed result without re-running the search, making it efficient for navigating through matches in a codebase.
参数
- -s
- Interactive mode.
- --show _INDEX_
- Show result by index.
- --no-git
- Don't use gitignore.
- -n
- Line numbers.
- -i
- Case insensitive.
FAQ
What is the vgrep command used for?
vgrep is a pager for grep results that assigns an index number to each match, allowing you to quickly open specific results in your editor by number. It respects .gitignore rules by default and provides both batch and interactive modes. In interactive mode (-s), results can be browsed and opened directly. The --show flag opens a previously indexed result without re-running the search, making it efficient for navigating through matches in a codebase.
How do I run a basic vgrep example?
Run `vgrep "[pattern]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -s do in vgrep?
Interactive mode.