38

if i need to go to my directory named as"exception handling" then i write (cd exception handling) but it gives error too many arguments

Veerabala J
  • 553
  • 1
  • 5
  • 14
  • 8
    Either put the file name in quotes or escape the spaces so that `bash` knows it's one string: `cd 'long file name'` or `cd long\ file\ name`. The problem is not unique to Ubuntu. If you were in a Windows command shell you'd have the same issue. – lurker Nov 17 '17 at 13:41
  • The problem is unique to bash 4.4; its implementation of "cd" is buggy. The manual page bash(1) specifies that " Any additional arguments following dir are ignored." The OP's command should go to directory "exception" and ignore "handling". Instead it throws an error. This is a bug. I tried bash 4.2, where "cd" works correctly. – Quigi Apr 07 '21 at 18:09

1 Answers1

105

Use quotes:

cd "new folder"

or escape the space:

cd new\ folder

(That being said, cd does not open a file but changes the working directory.)

Sora.
  • 1,395
  • 1
  • 11
  • 14