|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
A directory is a file, but instead of storing data as ordinary files do, it points to other files, including other directories. A folder is another name for a directory. While the terms are used interchangeably, directory is the term of choice on Solaris (UNIX), Linux, and AFS, and folder is an MS Windows term, represented as an icon that looks like a paper file folder. The AFS file management software on Eos/Unity is a tree-like hierarchy of directories storing all software, user files, and other file collections. Each user and every piece of software is somewhere represented as directories on the tree. Locker is another name for a directory and is a term that originated in the MIT Athena Project. A locker generally has a clear purpose or use (user locker, software locker, course locker, etc.) and is a collection of a main directory and all the files and subdirectories under it. While it appears as a directory, a locker usually has its own space allocation, or quota, because it is a separate AFS volume. The directory name is a mount point for the volume, which can be picked up and moved or its quota changed as needed. All directories/lockers originate in the root directory, represented as a forward slash ( / ) on UNIX and a backslash ( \ ) on MS-DOS. A subdirectory is a child directory to the parent directory just above it in the hierarchy. Except for the topmost root directory, all directories have one parent and can be nested to any depth. Slashes join the names of directories in a pathname (see User Space and Quota for a graphical representation of the path to a user's home directory). A full or absolute pathname of a file is the complete path to it, starting in the top-level root directory, /. A relative pathname begins in the working or current directory and goes down. These pathnames function as addresses or directions to files. The UNIX command that shows the current directory you are in is pwd, path of working directory. By default, it is your home directory, /afs/unity/users/a-z/loginid/, e.g., /afs/unity/users/j/jqpublic/. Before typing commands, check the path (pwd) to make sure you are issuing commands in the directory you intend. You can always find out where you are in the file tree with pwd. There are special commands for creating and manipulating directories on Solaris and Linux. Windows folders are generally mouse and menu manipulated. The two ways of working with directories/folders are discussed below so that you can move easily between platforms. You are accessing the same AFS file space, whether you are getting to it through folder icons or UNIX pathnames. List Files in a Directory (ls) The ls command lists the names of all the files in a directory. It is a command you use frequently. If you are in your home directory, ls will list all of your files and subdirectories. If you want to see what files are in a subdirectory, either change into that subdirectory with the cd command and type ls to see a list of its contents. Or, type ls followed by the absolute or relative pathname to the directory. You can also use the UNIX special symbols for directory-listing shortcuts. The command ls .. lists the files in the directory one level up (the parent directory), and the ls ~ command lists the files in your home directory, no matter where you are on the system. To list a subdirectory in your home directory, ls ~/subdirectory. You can also append option characters to give you more information about the files you list. ls -alF will show you a long listing (-l) of all files (-a), including hidden files and directories (-F), and the details of file creation (see more options with man ls). On Windows, you double-click to open a folder and see its files. However, there are different ways to list the contents of a folder via the View menu. You can view files as large or small icons, or see the Details of their creation (time and date) and a full description (same as ls -alF above). You can also use the Arrange Icons option to order files by Name, Type, Size, or Date. Options provide other ways to manage and manipulate folders.
Make Directory (mkdir) The mkdir command creates a directory. Type mkdir followed by a space and the name you want to give the directory. For example, if you are in your home directory and want to make a subdirectory called homework, type: mkdir homework UNIX creates a subdirectory named homework and places it one level below the working directory (~/homework, or, e.g., /afs/eos/users/m/mcdaniel/homework) On the Windows platform, this directory will appear as the homework folder on your K: drive (home directory). If you create the homework folder on Windows instead of Solaris/Linux, you would select My Computer, open the K: drive, and select File -> New -> Folder (see below). A folder icon would be added to the already existing files and folders on your K: drive, and you would name it "homework." When you go to a Solaris or Linux computer and ls your home directory (~), homework will appear as a subdirectory.
Change Directory (cd) The cd command changes or moves you into another directory. When you "cd" to a directory, you change your current working directory to the one you specify. For example, to change to the homework subdirectory in your home directory, type: cd homework The subdirectory homework is now your current working directory, and the files you create will reside in this subdirectory. To change back to your home directory (the parent directory), which is one level up, simply type cd followed by a space and two periods, i.e., cd .. On Windows, changing directories is a simple matter of double-clicking folders to open them and display their contents. Add and Attach Directory (add, attach) The add and attach commands simplify directory access, especially when accessing directories that are not the user's own. Technically, these commands allow users to attach a remote file system to a directory hierarchy on their workstations and then map the path to it to a shorter name space. They create a link from the longer AFS pathname to the shorter one and also obtain AFS tokens that allow access to the files in that locker. As a result, instead of typing the long pathname to change into the directory you want (e.g., cd /afs/eos/users/m/mcdaniel), you attach or add the locker you want and then change directories into it using the short pathname, /ncsu (e.g., attach mcdaniel, cd /ncsu/mcdaniel). Add and attach do much the same thing. In fact, add calls the attach command but adds the bin directory to your path for that locker. As a rule, you attach user and course lockers because you are not likely to want to execute any files in those directories. For example, to attach the locker e115, where information about the E115 course is kept, you type attach e115, and then change into that directory with the command cd /ncsu/e115 rather than cd /afs/eos.ncsu.edu/courses/e/e115/. However, because you DO want to run all necessary programs in a software locker, you add software, e.g., add nexs or add framemaker. However, the act of attaching/adding a locker does not necessarily mean that you can use the files in it. The e115 locker permits you to read and copy its files; however, you cannot change or delete them. Other lockers you cannot access at all. Permissions to use a locker or directory must be set by its owner or administrator (see AFS Permissions). So, what really happens when you add a locker, e.g., add gnu?
On Windows, there is no add and attach equivalent, except to create "shortcuts." For example, if you have a folder or software located deep in the file tree and want to access it quickly without having to open folder after folder, simply right-click it and select Create Shortcut. A shortcut icon will be placed on your Windows desktop, and double-clicking it will take you to the folder or execute the program directly. Remove Directory (rmdir) The rmdir command removes or deletes a directory. UNIX will not remove a directory that you are currently working in or a directory that contains subdirectories or files. You must empty a directory of all of its files and subdirectories before you can remove it (see Files and Commands). For example, if you want to remove the subdirectory homework from your home directory, first remove all files and subdirectories in the homework directory. Then, type rmdir homework. If you get a message "rmdir:directoryname: Object is remote," the system is telling you that the directory still has files in it. Use ls -a or ls -al to view all the files. Sometimes, software will write configuration dotfiles to your directories that ls will not show. Remove them in the same way you remove an ordinary file (rm .file). On Windows, to delete a folder, simply drag its icon to the Recycle Bin on your desktop. The folder does not have to be empty to delete it, as it does on Solaris/Linux. You will be prompted to make sure you want to delete the folder and all of its contents. In order to completely clear your disk space, empty your Recycle Bin periodically.
|
Related Resources
Summary of UNIX Directory Commands
Windows Folder Manipulation Windows places functions for folder manipulation on the File menu, e.g., File -> New Folder to create a folder. You can also right-click a folder icon for a menu of commands. To remove a folder, drag it to the Recycle Bin.
SPECIFYING DIRECTORIES
add and attach add software attach userid "Add" software but "attach" users. add calls attach but also executes commands in the .environment file and puts all locker executables (/bin) in your directory path so they can run.
Definitions Athena Project
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Information
Technology and Engineering Computer Services (ITECS) |
|||
|
|
This support page is for students,
faculty, and |
||