Skip to Content

2 Easy ways to fix cd: string not in pwd

The cd command is used to change the current working directory. 

When using the cd command with arguments, you can use either absolute paths or relative paths as arguments for the command.

Absolute paths begin at the root of the directory tree, while relative paths refer to a location relative to your current directory.

To navigate to your home directory, you can use the command “cd ~” or “cd” without any arguments. This will take you directly to your home directory.

Alternatively, if you want to return to the previous working directory you were in, you can use the command “cd -“. This will switch you back to the last directory you were in before moving to the current directory.

Error about cd: string not in pwd

The “cd: string not in pwd” error occurs when you are trying to use the cd command with an argument that does not exist.

In order to fix this, make sure that the path you entered is correct and exists.

It might be caused by the space or special characters in the file name.

For example:

% cd /Users/howtouselinux/Library/Application Support 

cd: string not in pwd: /Users/howtouselinux/Library/Application

How to fix cd: string not in pwd?

There are two ways to fix it. The first way is to use a backslash to escape the space or special characters in the path.

The backslash is an escape character used to indicate that the next character has a special meaning.

It can be used to escape spaces, tabs and other special characters in strings. For example, if you want to put a space after a word when writing it then you need to use the backslash (\).

This should be written as:

cd /Users/howtouselinux/Library/Application\ Support 

The other way is to use quotation marks around the argument paths. This will tell Bash that you want it to treat everything between the quotes as a single argument, regardless of any spaces or special characters.

cd “/Users/howtouselinux/Library/Application Support” 

Once done, your command should work as expected and you won’t get the error again.

Note that it is important to be aware of the difference between absolute and relative paths when using the cd command.

Always double-check your arguments before running a command, as this will help you avoid any unnecessary errors.

Tips to use cd command

  • Make sure the directory you’re trying to access exists
  • Use an absolute path, instead of a relative one, when attempting to cd into a specific directory
  • Check the spelling and capitalization of the target directory name
  • Verify that you have the necessary permissions to enter the directory
  • Make sure you have the correct directory structure referenced in your command line arguments.


By following these steps, you should be able to fix the “cd: string not in pwd” error in Bash. If you have any questions or need any further assistance, don’t hesitate to contact us. We’re here to help!


Monday 16th of October 2023

Thanks for your great guidance.