Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

chdir

Changes the process’s current working directory.

Changes the working directory to the specified path. If called with no argument or an empty string, changes to the directory specified by the HOME environment variable (or / if HOME is not set).

Returns 1 on success, undef on failure.

Synopsis

chdir("/tmp") or die "Cannot chdir: $!";
chdir($dir);
chdir();         # changes to $HOME
chdir("");       # also changes to $HOME

See Also

mkdir, rmdir, Cwd, getcwd