Previous topic |
Next topic |
Contact z/OS |
Creating a directory
z/OS UNIX System Services User's Guide
Using the shell: To create a new directory, enter:
For example, if Alice Smith is working in her home directory, smitha, and she wants to create a new directory, projecta, under her working directory, she would enter:
The default mode (read-write-execute permissions) for a directory created with mkdir is:
The new directory, projecta, is one level below her working directory. Figure 1 shows this relationship. If you do not specify an absolute path name for the directory to be created, the shell creates the new directory as a subdirectory of whatever your working directory is at the time you enter the command.
Figure 1. Creating a new directory
If you want to create a new directory that is not under your working directory, specify an absolute path name. Both directory names and file names can be up to 255 characters long. You may want to adopt some naming convention that allows you to distinguish between directory names and file names.
Your business may have adopted naming conventions for directories. For example, a typical convention is for each user to be assigned a directory based uniquely on the TSO/E user ID to make the name unique. Only that user would have write access to the directory. For information on how to change access permissions for a directory or file so that other users can read or write to it, see Handling security for your files.
Using TSO/E: To create a new directory, enter:
where directory_name specifies the path name of the directory to be created. The path name can be a full path name or a relative path name. Specify the name, which can be up to 1023 characters long, in single quotation marks. Specify MODE, the directory permission bits, in 3 octal characters; they can be separated by commas or blanks. The default mode (read-write-execute permission) is:
The octal representation of these permissions is 755. (When MKDIR is used to create a directory, the default permission bits are different from when mkdir is used.) Here execute permission means permission to search the directory.
Example: To specify a directory with a full path name and mode 700, enter:
It is best to use a full path name with the MKDIR command. When a relative path name is specified, MKDIR defines the directory in the user's home directory, regardless of the working directory. If user Alice Smith is in her home directory smitha and wants to create a directory with a relative path name and the default mode, she can enter:
The directory umods is one level below her home directory, smitha. Its full path name is /u/smitha/umods.
Copyright IBM Corporation 1990, 2014