Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Files and directories in your Home directory are part of the overall file system hierarchy – a tree of directories and their files/sub-directories.

In the file system tree, directories are the branches and files are the leaves.

To see the partial file system hierarchy of your Home directory, you can use the tree command. (Note that tree is not always available on Linux systems; it is an add-on tool that must be installed separately).

...

An absolute pathname lists all components of the full file system hierarchy that describes a file.

Absolute paths always start with  / (the forward slash), which is the root of the file system hierarchy. For example /stor/work/CBRS_unix/unix/haiku.txt is an absolute path.

...

Each of the 3-character sets describes if read ( r ) write ( w) and execute ( x or s ) actions are allowed , or not allowed ( - ).

  • read ( r ) access means file contents can be read, and copied
  • write ( w ) access means a file's contents can be changed, and directory contents can be modified (files added or deleted)
  • execute ( x or s )
    • for files, execute ( x ) means it is a program that can be called/executed
      • e.g. /usr/bin/ls, the file that performs the ls command
    • for directories, execute ( x ) means directory operations may be performed/executed
      • the directorycan be listed and changed into

...

  • touch to create a new, empty file or update the last modification date on an existing one
  • mkdir to create a new directory
  • cp to copy opy files (locally, within the current host computer)
  • mv to move a file from one name to another (so rename the file)
  • rm to remove (permanently delete!) files and directories

Let's practice:

...

  • Both cp and rm have a -r (recursive) option that is used when operating on directories.
  • rm has -f (force) option that does not report an error if the file or directory doesn't exist.
  • mkdir has a -p (parent) option that does not report an error if a component of a directory path, doesn't exist.
  • It is a good idea to specify directory names with a trailing slash ( / ) to indicate that they are directories
  • The "./" syntax means "relative to the current directory". It's optional here, but explicit.

See the Create, rename, linkto, delete files and Copying files and directories sections of the Some Linux commands page for more information.