Running in Csh when using Tilde Notation performing a


at the command line, I receive a "Permission denied." error. This directory is owned by the user performing the command and has the permissions.

myhostname% ~/
/my/home/dir/: Permission denied.

Checking the permissions:

myhostname% whoami
myhostname% cd ..
myhostname% pwd
myhostname% ls -la 
total 40
drwxr-xr-x  7 myuser  mygroup 4096 Sep 16 10:49 .
drwxr-xr-x  3 root    root    4096 Sep 27 2010 ..
drwxr-xr-x 19 myuser  mygroup 4096 Jan 15 13:36 dir

I think I'm missing a setting somewhere in the .cshrc file but I'm not sure why or what is causing this. The reason I believe it's in that area is because when I exit back out into BASH I can perform the same operation (I guess this is sort of obvious since I'm switching profiles). Is there something glaringly obvious I'm missing?

myhostname% exit
-bash-3.2$ ~/
-bash: /home/me/: is a directory
  • Right! You aren't allowed to run your $HOME directory as a command, you know.
    – vonbrand
    Jan 21 '13 at 20:28
  • Thanks, this may help other unix beginners! Switching shells frequently can be stressful.
    – DogEatDog
    Jan 23 '13 at 17:51

Directory cannot be executed even it has the executable permission. The executable permission means with the right permission user could access the directory and its content, such as reading files in the directory (still requires read permission for listing file).

  • Yes, Thank you. I now see why and the difference.
    – DogEatDog
    Jan 15 '13 at 19:50

I think I found the answer:

~/ shouldn't run as command since it is a directory

~ = home directory

so I am are trying to run


as a command, or rather



myhostname% ~/
/my/home/dir/: Permission denied.
myhostname% ~
/my/home/dir: Permission denied.

Ultimately, I can still refer to files ~/myfile

  • 2
    In zsh, or in bash ≥4.0, you can type a bare directory name and the shell interprets it as cd to that directory. (Requires setopt autocd/shopt -s autocd) Jan 15 '13 at 23:43
  • @Gilles : while bash zsh identify it as directory and print the error message or cd to it why csh prints this message which is not that relevant?? Jan 16 '13 at 4:12
  • @harish.venkat “Permission denied” is the error returned by the kernel. Bash and zsh make an additional check and display a different message if the file is a directory, csh doesn't. Jan 16 '13 at 10:28
  • @Gilles that's what my doubt is csh doesn't reply command not found its returning permission denied why?? Jan 16 '13 at 13:19
  • That makes so much more sense now when switching shells. I hate to admit it was my lack of experience with Csh and it throwing me a curve ball that spawned this issue. Thank you guys.
    – DogEatDog
    Jan 17 '13 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.