LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

chdir

Change the current working directory

TLDR

Change to a specific directory
$ chdir [path/to/directory]
copy
Change to home directory
$ chdir ~
copy
Change to parent directory
$ chdir ..
copy
Change to previous directory
$ chdir -
copy

SYNOPSIS

chdir [directory]

DESCRIPTION

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.

CAVEATS

chdir is not available in bash (use cd instead). For portable scripts, always use cd. The command is a shell builtin and does not exist as a standalone executable.

HISTORY

chdir is the original name of the directory-changing system call in Unix, dating back to the First Edition in 1971. The cd command was introduced as a shorter alias. Shells like csh (1978) and later zsh retained chdir as a builtin alongside cd.

SEE ALSO

cd(1), pushd(1), popd(1), pwd(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid