Linux command
cd 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Change
cd [/path/to/directory]
Go
cd
Go
cd -
Go
cd ..
Go
cd ../..
说明
cd (change directory) is a shell built-in command that changes the current working directory. It updates the shell's current directory and the PWD environment variable. The command is fundamental for navigating the filesystem in shell sessions.
参数
- -
- Change to previous directory (OLDPWD)
- -L
- Follow symbolic links (default)
- -P
- Use physical directory structure (don't follow symlinks)
- -e
- With -P, exit with error if the current directory cannot be determined
- -@
- Present extended attributes as a directory (on supported systems)
FAQ
What is the cd command used for?
cd (change directory) is a shell built-in command that changes the current working directory. It updates the shell's current directory and the PWD environment variable. The command is fundamental for navigating the filesystem in shell sessions.
How do I run a basic cd example?
Run `cd [/path/to/directory]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does - do in cd?
Change to previous directory (OLDPWD)