Special unix directories (~)

2

My university has a system set up where each class has its own directory for the professors to publish and receive files. These directories reside under a directory in /home which happens to be a mounted disk and are accessible anywhere in the system by referencing ~csXXX where csXXX is a sub-directory within that home directory.

How are they doing this and how can I do it on my own systems?

Chris

Posted 2010-09-10T21:41:05.367

Reputation: 23

Answers

5

There's nothing special about what they're doing, it's just standard shell behavior. (I'm not sure that all shells do this, but at least most of the common ones do, e.g. bash) ~ expands to the home directory of the current user, and ~username expands to the home directory of the named user. So it appears that all they've done is set up one user account for each class.

When I was an undergrad the CS department used the same system. I'm sure it's fairly common.

David Z

Posted 2010-09-10T21:41:05.367

Reputation: 5 688

That's sensible, and does appear to be the case. I hadn't known about the username expansion before, thanks. – Chris – 2010-09-10T23:23:37.767

1

~ is usually an alias for a user's home directory. In this case, perhaps users of a class share a home directory?

You can see this by typing echo ~ and it should spit out a full path and you can see a user's home directory with finger.

MDMarra

Posted 2010-09-10T21:41:05.367

Reputation: 19 580