Navigation

Operators and Keywords

Function List:

C++ API

Command: cd dir
Command: cd
Built-in Function: old_dir = cd (dir)
Command: chdir

Change the current working directory to dir.

If dir is omitted, the current directory is changed to the user’s home directory ("~").

For example,

cd ~/octave

changes the current working directory to ~/octave. If the directory does not exist, an error message is printed and the working directory is not changed.

chdir is an alias for cd and can be used in all of the same calling formats.

Compatibility Note: When called with no arguments, MATLAB prints the present working directory rather than changing to the user’s home directory.

See also: pwd, mkdir, rmdir, dir, ls.

Package: octave