### 4.2.1 Working directories

Xcas has a working directory where it stores files that it creates; typically this is the user’s home directory. The pwd command will tell you what the current working directory is, and and the cd command lets you change it.

- pwd takes no arguments.
- pwd() returns the name of the current working directory.
- cd command takes dirname, the name of a directory (a string).
- cd(dirname) changes the working directory to dirname.

#### Examples

pwd()

The output might be something like:

“/home/username” |  |  |  |  |  |  |  |  |  |

If you enter:

cd("foo")

or (on a Unix system):

cd("/home/username/foo")

then the working directory will change to the directory foo, if it exists. Afterwards, any files that you save from Xcas will be in that directory.

To load or read a file, it will need to be in the working directory. Note that if you have the same file name in different directories, then loading the file name will load the file in the current directory.