Next: Input/Output, Previous: Environment, Up: Running

### 4.5 Your Program's Working Directory

Each time you start your program with `run`, it inherits its working directory from the current working directory of gdb. The gdb working directory is initially whatever it inherited from its parent process (typically the shell), but you can specify a new working directory in gdb with the `cd` command.

The gdb working directory also serves as a default for the commands that specify files for gdb to operate on. See Commands to Specify Files.

`cd` directory
  Set the gdb working directory to directory.

`pwd`
  Print the gdb working directory.

It is generally impossible to find the current working directory of the process being debugged (since a program can change its directory during its run). If you work on a system where gdb is configured with the `/proc` support, you can use the `info proc` command (see SVR4 Process Information) to find out the current working directory of the debuggee.