Newby Coder header banner

Working directory

Working directory

Working directory of a process or program is a directory(or folder) of a system, which is dynamically associated with each process that runs on that directory (or is started in that directory or is linked to that directory when it is started)

It is sometimes called the current working directory (CWD), or just current directory

Example use-case

Consider that someone opens a File Explorer (Windows Explorer in Windows) and opens the Downloads folder

That is similar to opening a Terminal (or Command Prompt) and entering a command to change the current directory to Downloads

In Linux, Mac

cd ~/Downloads

In Windows,

cd C:\Users\SomeUser\Downloads

Now, the working directory for the Terminal or the File Explorer is the Downloads Folder

Furthermore, if the user opens an application or Program by double clicking the application or by entering a command in Terminal, then the working directory of that application becomes the Downloads Folder (unless it is a shortcut icon or symlink)

If that application is copied to some other Folder then its working directory changes to that Folder when executed or run

  • If the application is a shortcut or a symlink then the actual application resides in its installation directory, which is its working directory when it is run
  • The application can use the working directory (which is a path like C:\Program Files\Firefox) to access other files inside(or relative to) that directory while it is running


    A File Explorer (or a Terminal) is also an application, whose working directory is where it is installed at

    It uses some process of the operating system to set the working directory for an user when the user browses a folder or opens an application

    In a Terminal this is done with cd command