Linux command
chdir 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Change to a specific directory
chdir [path/to/directory]
Change to home directory
chdir ~
Change to parent directory
chdir ..
Change to previous directory
chdir -
说明
chdir changes the current working directory of the shell to the specified path. It is functionally equivalent to cd and available as a builtin in zsh, csh, and tcsh. When called without arguments, it changes to the user's home directory. The CDPATH variable is searched if the specified directory is not found relative to the current directory.
FAQ
What is the chdir command used for?
chdir changes the current working directory of the shell to the specified path. It is functionally equivalent to cd and available as a builtin in zsh, csh, and tcsh. When called without arguments, it changes to the user's home directory. The CDPATH variable is searched if the specified directory is not found relative to the current directory.
How do I run a basic chdir example?
Run `chdir [path/to/directory]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
Where can I find more chdir examples?
This page includes 4 examples for chdir, plus related commands for nearby Linux tasks.