Editing the Unix Tree

Make sure to run all of the copy commands below, as we'll be using files from the Ostrom server later in the course.

  • mkdir

    • This command name stands for "make a directory".

    • It creates a new folder (or directory). If no path is specified, the new directory is created in the current directory.

# start in your home directory
cd ~

# create a directory named "unixclass"
# with a subdirectory named "testdir"
mkdir unixclass
mkdir unixclass/testdir

# change current directory directly to "testdir"
cd unixclass/testdir 

# go to the parent directory (i.e. unixclass)
# and print the working directory
cd ..
pwd
  • touch

    • This command creates an empty file with the given name.

  • cp and mv

    • These commands stand for "copy" and "move," respectively.

    • They copy / move files and directories to the specified location.

    • Wildcards symbols such as "*" or "?" are commonly used to copy multiple files with a single command.

      • The symbol "*" stands for any number of alphanumeric characters.

      • The symbol "?" stands for a single alphanumeric character.

  • rmdir and rm

    • rmdir only removes empty directories, rm removes both directories and files.

    • rm needs -r flag to remove directories.

Last updated

Was this helpful?