-5

How can I open a directory via PUTTY that contains -?

For example the name of dir is:

some-thing-dir

cd /some-thing-dir not working.

1

3 Answers 3

1

Well, it should be working.... what error message do you get? Nevertheless you can try to escape the dash:

cd /some\-thing\-dir
7
  • for /home$ cd /movie\-economics\-lawyer\-science I get -bash: cd: /movie-economics-lawyer-science: No such file or directory May 14, 2013 at 10:59
  • ls -ld /movie-economics-lawyer-science, please
    – dawud
    May 14, 2013 at 11:00
  • The directory is inside your home directory? then you should not use the first slash because that means it is an absolute path. you can use "cd /home/movie/some-dir" or: "cd /home/movie; cd some-dir" May 14, 2013 at 11:01
  • ls -ld gives drwxr-x--- 10 movie-economics-lawyer-science movie-economics-lawyer-science 4096 May 14 10:49 /home/movie-economics-lawyer-science May 14, 2013 at 11:04
  • cd /home/movie-economics-lawyer-science May 14, 2013 at 11:04
1

You should try e.g. cd ./home\-movie\-economics or perhaps cd 'home-movie-economics'

3
  • what's the point in escaping the dashes in the first example and not escaping them in the second one? ;) May 14, 2013 at 11:04
  • @PascalSchmiel, the apostrophes quote.
    – vonbrand
    May 14, 2013 at 11:05
  • ahh, don't get it, sorry :) May 14, 2013 at 11:06
0

Just quote it.

cd /'some-thing-dir'

Not the answer you're looking for? Browse other questions tagged .