The Full Linux Path to a Directory or File
The full path to a Linux directory or file is the series of directories, starting at the root, that are required to access a directory or file. It is also referred to as the "absolute" path and ends in a directory name, and the full path to a file ends in a file name.
For example, the full path to the log directory below the var directory, below the root is: / var / log.
The full path to the boot.log file in the path of / var / log is: /var/log/boot.log.
In some Linux documentation, and when using some programs, a / is shown at the end (far right) of a directory path to indicate that the last item is a directory name and not a file name.
When reading Linux documentation, there are instances when it is obvious that a name at the end of a full path is the name of a directory, and other times when it is not obvious. So some documentation shows a / (slash) at the end (far right) of a path to signify that this is the end of the path. This depends on the context of the directory in the discussion.
For example, the / at the end of the following path: / etc / ppp / indicates that ppp is a directory and not a file.
Linux ls Command Examples Showing the Full to a Directory or File
The ls command below lists the directories and files in the / (root) directory.
$ ls -l /
The command below shows the contents of the / var directory. The var directory is "below" or "off of" the root in the full path of / var (root var).
$ ls -l / var
The ls command below lists the contents of the log directory, below the path of / var. The full path below is / var / log (root var log). The slash at the left represents the root directory and the slash between var and log is just a separator between these directory names.
$ ls -l / var / log
The following ls command shows the full path to the file named boot.log, below the directory path of / var / log.
$ ls -l /var/log/boot.log
The Linux concepts, tasks and commands here apply to ALL Linux distributions, including Red Hat, Debian, Slackware, Ubuntu, Fedora, SUSE and openSUSE Linux.