← 返回命令列表

Linux command

scd 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Change to a directory

scd [pattern]

Add directories

scd -a [path/to/directory]

Recursively add directories

scd -ar [path/to/directory]

Create a directory alias

scd --alias=[name]

Remove a directory alias

scd --unalias=[name]

Show verbose directory rankings

scd -v [pattern]

说明

scd is a Z shell script for changing to any directory with a few keystrokes. It keeps a history of visited directories, which serves as an index of known paths. The directory index is updated after every cd command and can also be filled manually with scd -a. To switch to a directory, scd needs just a few fragments of the desired path to match against the index. A selection menu is displayed when there are several matches, with preference given to recently visited paths. Permanent directory aliases can be created for instant access. scd is available as an oh-my-zsh plugin and also works with bash through shell integration.

参数

-a, --add
Add specified directories to the directory index.
-r, --recursive
Apply --add or --unindex recursively.
--alias=_NAME_
Create alias for the current or specified directory, stored in ~/.scdalias.zsh.
--unalias=_NAME_
Remove an alias definition.
--unindex
Remove specified directories from the index.
-v, --verbose
Display directory rank in the selection menu.
-h, --help
Show help message.

FAQ

What is the scd command used for?

scd is a Z shell script for changing to any directory with a few keystrokes. It keeps a history of visited directories, which serves as an index of known paths. The directory index is updated after every cd command and can also be filled manually with scd -a. To switch to a directory, scd needs just a few fragments of the desired path to match against the index. A selection menu is displayed when there are several matches, with preference given to recently visited paths. Permanent directory aliases can be created for instant access. scd is available as an oh-my-zsh plugin and also works with bash through shell integration.

How do I run a basic scd example?

Run `scd [pattern]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a, --add do in scd?

Add specified directories to the directory index.