Linux command
z 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Jump to most frecent directory matching pattern
z [pattern]
Jump to directory matching multiple patterns
z [foo] [bar]
List matching directories ranked by frecency
z -l [pattern]
Jump to highest ranked match only
z -r [pattern]
Jump to most recently accessed match
z -t [pattern]
Remove current directory from database
z -x
说明
z tracks your most used directories and allows you to jump to them with minimal keystrokes. It uses "frecency" - a combination of frequency and recency - to rank directories. As you navigate with cd, z learns which directories you visit most. Typing z foo jumps to the most frecent directory containing "foo" in its path. Multiple arguments are matched in order: z foo bar matches paths containing "foo" followed by "bar". The database is stored in ~/.z by default and is updated automatically when changing directories (via a shell hook).
参数
- -c
- Restrict matches to subdirectories of current directory
- -h
- Show help
- -l
- List matches instead of jumping
- -r
- Match by rank only (most accessed)
- -t
- Match by recency only (most recent)
- -x
- Remove current directory from datafile
FAQ
What is the z command used for?
z tracks your most used directories and allows you to jump to them with minimal keystrokes. It uses "frecency" - a combination of frequency and recency - to rank directories. As you navigate with cd, z learns which directories you visit most. Typing z foo jumps to the most frecent directory containing "foo" in its path. Multiple arguments are matched in order: z foo bar matches paths containing "foo" followed by "bar". The database is stored in ~/.z by default and is updated automatically when changing directories (via a shell hook).
How do I run a basic z example?
Run `z [pattern]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c do in z?
Restrict matches to subdirectories of current directory