Sorry, you need to enable JavaScript to visit this website.

Digital UNIX File Management

Files and directories can be created, listed, viewed, removed, and copied. You can also move through the directories in your account and on the system. To learn more about pathnames for managing files and navigating through directory trees, refer to Digital UNIX paths.


Why should I use Digital UNIX file management?

To interact with Digital UNIX, you need to use commands. Some commands manage files. Others give you information about the multi-user computer system you are using, about other users on that system, or can launch programs that perform other tasks.

How do I get help with Digital UNIX file management?

How do I use Digital UNIX file management?

  • Display the current working directory
    To list the pathname of the current working directory (see Digital UNIX paths) at any time, use the pwd ("print working directory") command.
    • Example: When you first log in, the pwd command prints your account's home directory. The pathname shown starts at the root directory (the first slash) and includes all directories down to your current working directory ("abc1234" in this case):
      • pwd
        /users/rit2/g0/abc1234
  • List files and directories
    Use the ls ("list") command to display the names of the files and directories in your current working directory:
    ls

    The ls -l ("list long") command displays more information along with the names of files and directories:
    ls -l

    Wildcards (or metacharacters), which stand for characters in file or directory names (see Digital UNIX concepts), are useful with the various versions of the ls command.
  • Make a file
    A file is generally created by a program or through the process of input/output redirection. Editors such as "vi" and "emacs" are programs that are commonly used to make files containing text. Input/output redirection, on the other hand, takes the output of a command and puts the resulting information into a file.
  • Remove a file
    The rm ("remove") command deletes an existing file (or set of files separated by spaces after the command). Typing rm -i ("remove interactive") lets you confirm that you want to remove each file before it is deleted.

    Caution: Be extremely careful when using wildcards, especially the asterisk (*), with the rm command. By adding an extra space between the "f" and the asterisk, for example, the command below would delete the file named "f" and then all files in the current working directory (because the asterisk stands forany number of characters)!
    % rm f *
  • Make a directory
    Type the mkdir command followed by a name to create a new directory.
  • Remove a directory
    Delete an existing, empty directory by entering rmdir followed by its name. You will not be able to delete a directory until you remove all of the files inside of it.

    Example: To delete a directory named "test," enter:
    rmdir test
  • Copy a file
    The cp ("copy") command will create a duplicate file with a new name in your current working directory or put a duplicate (with the same name or a new one) in another directory. Follow cp with the filename of the original and then the target filename for the duplicate. If there is already a file with the same name in the target area, it will be replaced by the copied file. The cp -i ("copy interactive") command will ask for confirmation that you want to continue if a file of the same name already exists in the target area.

    Example: To copy the file "index.html" from the current working directory into a subdirectory named "www" while naming the duplicate "file.html," type:
    cp index.html www/file.html
  • Move a file
    The mv ("move") command takes a file and puts it in a new location. If a file in the destination directory has the same name, that file will be replaced with the one being moved.

    Example: To move the file "counter.cgi" into the directory "cgi-bin":
    mv counter.cgi cgi-bin
  • Rename a file
    The mv command can also change the name of an existing file. You must supply the path to the existing file and a path to its destination (see Start: Digital UNIX paths). You can rename a file in place or while moving it.

    Example: To move the file "solution.txt" up one directory and into the "text" directory while changing its name to "thanks.txt":
    mv solution.txt ../text/thanks.txt
  • Move between directories
    Type cd ("change directory") by itself to return to your home directory. To move into a directory available from your current location, type cd followed by that directory's name.

    Enter cd followed by two periods (..) to move upward by one directory. You can move upward by multiple directories at one time by putting a slash character (/) between each double-period sequence. To reach the root directory, use a slash either by itself or before any other part of a pathname.

    Example: To move to your home directory, use cd $home.
    cd $home

    Example: To move up three directories and then down to a directory named "usr," type:
    cd ../../../usr

    Example: To move to the root directory and then down to a directory named "pub," enter:
    cd /pub