===================================== Directories: current, HOME, and /home ===================================== -IAN! idallen@ncf.ca Some people become confused about: - "your HOME directory" - the directory given to you by the system administrator and into which you are placed when you first log in - this is the directory you go to when you type "cd" with no arguments - you own this directory, and therefore you can change its permissions - the name of your home directory is available in the shell keyword variable named "$HOME" (HOME is UPPER CASE) - the name of your home directory is also available in some shells as a leading tilde on a pathname, e.g. ~/assignments, ~/letters, etc. - on many Unix systems, your home directory is located under the system directory named /home e.g. /home/abcd0001, /home/zyxw0002, etc.; but, this is not always true (e.g. not true on ACADUNIX) - /home - this is a pathname (probably and usually a directory, not a file) under the root directory, named "home" - this is NOT your HOME directory; it is (usually) a directory named /home - (/home might be a file name, not a directory; but, this is rare) - some other names (directories) under root are /etc, /bin, and /usr - this is a system directory; you do not own it and you cannot change it - "current directory" - this is the directory that your shell (or any Unix process) is currently in - all relative pathnames in this process are relative to this current directory - the name of this directory is always "." (dot) - the current directory of a shell can be changed by using the "cd" command - every process has its own current directory; changing current directory in one process does not change it for other processes - the current directory is passed on to child processes when they are first started (e.g. from your shell process to shell scripts that you invoke) - changing directories inside a shell script will not affect the parent process that called the shell script (different processes) - since you can use the "cd" command to change the current directory of the shell, you may or may not have permissions to list, read, or modify the filenames in the "current directory"; it depends where your current directory is! Problem: "Put the date into a file out.txt in the current directory." Solution: date >out.txt Problem: "Put the date into a file out.txt in your HOME directory." Solution: date >"$HOME"/out.txt Problem: "List the names (including hidden names) in the /home directory." Solution: ls -a /home