{"id":25,"date":"2022-03-04T15:11:13","date_gmt":"2022-03-04T20:11:13","guid":{"rendered":"https:\/\/pressbooks.library.ryerson.ca\/opsyshiraki\/chapter\/hierarchicalfilesystem\/"},"modified":"2025-04-27T14:02:58","modified_gmt":"2025-04-27T18:02:58","slug":"hierarchicalfilesystem","status":"publish","type":"chapter","link":"https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/chapter\/hierarchicalfilesystem\/","title":{"raw":"The Hierarchical File System","rendered":"The Hierarchical File System"},"content":{"raw":"<h2 id=\"h.7k54okhymdw0\" class=\"c12 c29\"><span class=\"c9\">Pre-amble<\/span><\/h2>\r\n<p class=\"c18\"><span class=\"c1\">Unix is primarily a command line oriented operating system. \u00a0Most commands are an action which is performed on an object, typically a file or directory. \u00a0In order to be productive in a Unix environment, one must be intimately familiar with the concept of the hierarchical file system. \u00a0Mastering this concept is fundamental to successful work in a Unix environment and is the key takeaway of this section.<\/span><\/p>\r\n\r\n<h1 id=\"h.c9tx9mli4ian\" class=\"c29\"><span class=\"c15\">Hierarchical File System<\/span><\/h1>\r\n<p class=\"c2\"><span class=\"c1\">The Unix file system is that of an inverted tree. \u00a0Imagine a tree with leaves and branches but turned upside down with the root or main trunk at the top. \u00a0The main trunk branches off to smaller branches and eventually leaves. \u00a0By analogy, the root directory typically contains several directories (folders) which in turn contain other directories (subdirectories) and\/or files. \u00a0Just as a tree branch can have smaller branches or leaves, a leaf cannot have other branches or leaves. \u00a0Similarly, the difference between a directory and a file is that a directory can contain other directories or files, but a file cannot contain other directories or files -- a file is a terminal node.<\/span><\/p>\r\n<p class=\"c2\"><span class=\"c1\">The figure below shows the typical layout of a Unix file system. \u00a0While systems vary greatly in size, most will have at least these directories. \u00a0The convention in this diagram uses an ellipse to depict a directory and a rectangle to depict a file.<\/span><\/p>\r\n\r\n\r\n[caption id=\"attachment_24\" align=\"alignnone\" width=\"537\"]<img src=\"http:\/\/pressbooks.library.ryerson.ca\/opsyshiraki\/wp-content\/uploads\/sites\/330\/2022\/03\/hierarchical_file_sys-1-300x210.png\" alt=\" Ellipse containing \/ at top, 4 ellipses connected with lines beneath top ellipse containing words etc, bin, dev, users. Rectangles beneath ellipses represent files.\" width=\"537\" height=\"376\" class=\"wp-image-24\" title=\"Hierarchical File - Title\" \/> Typical hierarchical file structure of a Unix system[\/caption]\r\n\r\n&nbsp;\r\n<p class=\"c2\"><span class=\"c1\">Explanation of common subdirectories:<\/span><\/p>\r\n\r\n<table class=\"grid\" style=\"border-collapse: collapse;width: 100%\" border=\"0\">\r\n<thead>\r\n<tr>\r\n<th style=\"width: 22.3701%\" scope=\"col\">\r\n<h3>Directory<\/h3>\r\n<\/th>\r\n<th style=\"width: 77.6299%\" scope=\"col\">\r\n<h3>Remarks<\/h3>\r\n<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<th style=\"width: 22.3701%\" scope=\"row\">etc<\/th>\r\n<td style=\"width: 77.6299%\">contains operation and administrative files<\/td>\r\n<\/tr>\r\n<tr>\r\n<th style=\"width: 22.3701%\" scope=\"row\">bin<\/th>\r\n<td style=\"width: 77.6299%\">contains executable commands<\/td>\r\n<\/tr>\r\n<tr>\r\n<th style=\"width: 22.3701%\" scope=\"row\">dev<\/th>\r\n<td style=\"width: 77.6299%\"><span class=\"c1\">contains the devices connected to the system (printers, terminals, etc...); these devices still appear as files<\/span><\/td>\r\n<\/tr>\r\n<tr>\r\n<th style=\"width: 22.3701%\" scope=\"row\">users*<\/th>\r\n<td style=\"width: 77.6299%\">contains user files and directories. *The directory name is not standard and varies between systems. \u00a0Other common variations are things like \"home\". \u00a0Some larger systems will even have more than one top-level user directories such as \"faculty\", \"staff\", \"classof31\", etc.<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<h2 id=\"h.1w47277fkjat\" class=\"c29\"><span class=\"c9\">How to Specify a File or Directory in Unix<\/span><\/h2>\r\n<p class=\"c2 no-indent\"><span class=\"c1\">As most Unix commands act on files or directories, it is <\/span>necessary to be able to specify such an entity.<\/p>\r\nThere are two methods to specify a file or directory, absolute and relative:\r\n<h3 class=\"c2 c12\" id=\"h.wlex4i7yj2gn\"><span class=\"c11\">Absolute<\/span><\/h3>\r\n<p class=\"c2\"><span class=\"c1\">To specify a file or directory using the absolute method, start with the root directory (\/) and write each directory that is encountered on the path to the directory or file being specified. \u00a0Separate each directory with a \"\/\" forward slash character.<\/span><\/p>\r\n\r\n<div class=\"textbox textbox--examples\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">Examples<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">Specify the etc directory in the above system.<\/div>\r\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><span class=\"c3 c5\">\/etc<\/span><\/pre>\r\n<div class=\"textbox__content\">Specify the file named passwd in the above system.<\/div>\r\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><span class=\"c3 c5\">\/etc\/passwd<\/span><\/pre>\r\n<div class=\"textbox__content\">Specify the file named ls in the above system.<\/div>\r\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><span class=\"c3 c5\">\/bin\/ls<\/span><\/pre>\r\n<div class=\"textbox__content\">Specify the file named mydata in the above system.<\/div>\r\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><span class=\"c3 c5\">\/users\/raj\/work\/mydata<\/span><\/pre>\r\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><\/pre>\r\n<\/div>\r\n&nbsp;\r\n<div class=\"textbox textbox--key-takeaways\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">Key Takeaways<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">The absolute specification <span class=\"c17\">always <\/span><span class=\"c1\">starts with a \"\/\" (forward slash).<\/span><\/div>\r\n<\/div>\r\n&nbsp;\r\n<h3 class=\"c2 c12\" id=\"h.ckuga4i1jzvp\"><span class=\"c11\">Relative<\/span><\/h3>\r\n<p class=\"c2\"><span class=\"c1\">When working on Unix, the user will always \"be'' at some logical position within the hierarchy. \u00a0This position is termed the \"current working directory\" or simply the \"current directory\". The specification of a relative path is relative to this current directory position. \u00a0Note that it is possible to change one's current directory while working; this will be discussed in a later chapter.<\/span><\/p>\r\n<p class=\"c2\"><span class=\"c1\">To specify a file or directory using the relative method, start with the current directory and write each directory that is encountered on the path to the directory or file being specified. \u00a0Separate each directory with a \"\/\" forward slash character.<\/span><\/p>\r\n\r\n<div class=\"textbox textbox--examples\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">Examples<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">\r\n<div class=\"textbox__content\">\r\n<p class=\"c2\"><span class=\"c1\">Specify the file mydata with\u00a0<\/span><span class=\"c1\">current directory: \/users\/raj\/<\/span><\/p>\r\n\r\n<\/div>\r\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><span class=\"c3 c5\"><span class=\"c5 c3\">work\/mydata\r\n<\/span><\/span><\/pre>\r\n<div class=\"textbox__content\">\r\n<p class=\"c2\"><span class=\"c1\">Specify the file mydata with\u00a0<\/span><span class=\"c1\">current directory: \/users\/raj\/work\/<\/span><\/p>\r\n\r\n<\/div>\r\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><span class=\"c3 c5\"><span class=\"c5 c3\">mydata<\/span><\/span><\/pre>\r\n<div class=\"textbox__content\">\r\n<p class=\"c2\"><span class=\"c1\">Specify the file report with <\/span><span class=\"c1\">current directory: \/users\/raj\/work<\/span><\/p>\r\n\r\n<\/div>\r\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><span class=\"c3 c5\"><span class=\"c5 c3\">..\/report<\/span><\/span><\/pre>\r\n<p class=\"textbox__content indent no-indent\"><span class=\"c3 c5\"><span class=\"c5 c3\"> <span class=\"c1\">As the file <strong>report<\/strong> is not contained in the current directory, it is necessary to go up one level first (to raj) to be able to reach the file <strong>report<\/strong>. \u00a0Here the double dots mean \"parent directory\" or one level up.<\/span><\/span><\/span><\/p>\r\n\r\n<\/div>\r\n<\/div>\r\n&nbsp;\r\n<div class=\"textbox textbox--key-takeaways\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">Key Takeaways<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">The relative specification <span class=\"c17\">never <\/span><span class=\"c1\">starts with a \"\/\" (forward slash).<\/span><\/div>\r\n<\/div>\r\n<p class=\"c2 c16\"><span class=\"c1\">\u00a0<\/span><\/p>\r\n<p class=\"c2\"><span class=\"c1\">When should one use absolute vs. relative specifications? \u00a0In many cases both are acceptable. \u00a0One may notice that a relative specification usually requires less typing.\u00a0 Who likes more typing? An absolute path is preferred when the user or programmer values portability allowing the specification to be used from any position on the system by any user.<\/span><\/p>\r\n\r\n<h3 class=\"c2 c12\" id=\"h.trgvb3y0wgo\"><span class=\"c11\">Points to Consider<\/span><\/h3>\r\n<ul class=\"c19 lst-kix_558yn0im65zn-0 start\">\r\n \t<li class=\"c2 c22 c20 li-bullet-0\"><span class=\"c1\">Names for files and directories are case-sensitive. \u00a0Thus report, Report, and REPORT are all distinct.<\/span><\/li>\r\n \t<li class=\"c2 c22 c20 li-bullet-0\"><span class=\"c1\">Names may include any letters, digits, and some special characters (period, comma, underscore, etc.) but not \/, &lt;, &gt;, &amp;, :, |. <\/span><\/li>\r\n \t<li class=\"c2 c22 c20 li-bullet-0\"><span class=\"c1\">Names may be up to 255 characters in length.<\/span><\/li>\r\n \t<li class=\"c2 c22 c20 li-bullet-0\"><span class=\"c1\">There is no requirement for file extensions (few characters after a period). \u00a0All of the following are valid names:<\/span><\/li>\r\n<\/ul>\r\n<ul>\r\n \t<li style=\"list-style-type: none\">\r\n<ul class=\"c19 lst-kix_558yn0im65zn-1 start\">\r\n \t<li class=\"c2 c21 li-bullet-0\">\r\n<pre><span class=\"c1\">report<\/span><\/pre>\r\n<\/li>\r\n \t<li class=\"c2 c21 li-bullet-0\">\r\n<pre><span class=\"c1\">letter_to_bob.text<\/span><\/pre>\r\n<\/li>\r\n \t<li class=\"c2 c21 li-bullet-0\">\r\n<pre><span class=\"c1\">forecast.July,Version1<\/span><\/pre>\r\n<\/li>\r\n \t<li class=\"c2 c21 li-bullet-0\">\r\n<pre><span class=\"c1\">notes.doc<\/span><\/pre>\r\n<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n<ul class=\"c19 lst-kix_558yn0im65zn-0\">\r\n \t<li class=\"c2 c22 c20 li-bullet-0\"><span class=\"c1\">Names must be unique within a directory (no duplicates allowed).\u00a0 This is automatically enforced by the operating system.\u00a0 In the raj directory, it would not be possible to create another file or directory called work. \u00a0Consider the analogy of human families: \u00a0Two siblings would not share the same name, but a cousin, uncle, or grandparent could share the same name without conflict.<\/span><\/li>\r\n<\/ul>\r\n<span>[h5p id=\"1\"]<\/span>\r\n<h2 id=\"h.lropx7ndtkj\" class=\"c12 c39\"><span class=\"c9\">Home Directory<\/span><\/h2>\r\n<p class=\"c2\"><span class=\"c1\">The home directory is a private area for the user files and directories. Each user will have a directory name matching the login name assigned by the system administrator. <\/span><\/p>\r\n<p class=\"c2\"><span class=\"c1\">While it is correct and possible to specify a home directory using the absolute and relative methods aforementioned, there exists an abbreviation consisting of a ~ (tilde) followed by the user\u2019s login name. \u00a0Advantage: This avoids having to know the name of the user file area which is non-standard: \u00a0some installations call it users, others call it home, still others have their own conventions. \u00a0<\/span><\/p>\r\n\r\n<div class=\"textbox textbox--examples\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">Examples<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">\r\n<p class=\"c2\">Eg. Raj's home directory would be<\/p>\r\n\r\n<pre class=\"c2\" style=\"padding-left: 40px\"><span class=\"c5 c3\">~raj<\/span><\/pre>\r\n<p class=\"c2\">Eg. A file in his directory would be<\/p>\r\n\r\n<pre class=\"c2\" style=\"padding-left: 40px\"><span class=\"c5 c3\">~raj\/report<\/span><\/pre>\r\n<\/div>\r\n<\/div>\r\n&nbsp;\r\n\r\n&nbsp;","rendered":"<h2 id=\"h.7k54okhymdw0\" class=\"c12 c29\"><span class=\"c9\">Pre-amble<\/span><\/h2>\n<p class=\"c18\"><span class=\"c1\">Unix is primarily a command line oriented operating system. \u00a0Most commands are an action which is performed on an object, typically a file or directory. \u00a0In order to be productive in a Unix environment, one must be intimately familiar with the concept of the hierarchical file system. \u00a0Mastering this concept is fundamental to successful work in a Unix environment and is the key takeaway of this section.<\/span><\/p>\n<h1 id=\"h.c9tx9mli4ian\" class=\"c29\"><span class=\"c15\">Hierarchical File System<\/span><\/h1>\n<p class=\"c2\"><span class=\"c1\">The Unix file system is that of an inverted tree. \u00a0Imagine a tree with leaves and branches but turned upside down with the root or main trunk at the top. \u00a0The main trunk branches off to smaller branches and eventually leaves. \u00a0By analogy, the root directory typically contains several directories (folders) which in turn contain other directories (subdirectories) and\/or files. \u00a0Just as a tree branch can have smaller branches or leaves, a leaf cannot have other branches or leaves. \u00a0Similarly, the difference between a directory and a file is that a directory can contain other directories or files, but a file cannot contain other directories or files &#8212; a file is a terminal node.<\/span><\/p>\n<p class=\"c2\"><span class=\"c1\">The figure below shows the typical layout of a Unix file system. \u00a0While systems vary greatly in size, most will have at least these directories. \u00a0The convention in this diagram uses an ellipse to depict a directory and a rectangle to depict a file.<\/span><\/p>\n<figure id=\"attachment_24\" aria-describedby=\"caption-attachment-24\" style=\"width: 537px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.ryerson.ca\/opsyshiraki\/wp-content\/uploads\/sites\/330\/2022\/03\/hierarchical_file_sys-1-300x210.png\" alt=\"Ellipse containing \/ at top, 4 ellipses connected with lines beneath top ellipse containing words etc, bin, dev, users. Rectangles beneath ellipses represent files.\" width=\"537\" height=\"376\" class=\"wp-image-24\" title=\"Hierarchical File - Title\" srcset=\"https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-content\/uploads\/sites\/330\/2022\/03\/hierarchical_file_sys-1-300x210.png 300w, https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-content\/uploads\/sites\/330\/2022\/03\/hierarchical_file_sys-1-65x46.png 65w, https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-content\/uploads\/sites\/330\/2022\/03\/hierarchical_file_sys-1-225x158.png 225w, https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-content\/uploads\/sites\/330\/2022\/03\/hierarchical_file_sys-1-350x245.png 350w, https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-content\/uploads\/sites\/330\/2022\/03\/hierarchical_file_sys-1.png 663w\" sizes=\"auto, (max-width: 537px) 100vw, 537px\" \/><figcaption id=\"caption-attachment-24\" class=\"wp-caption-text\">Typical hierarchical file structure of a Unix system<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p class=\"c2\"><span class=\"c1\">Explanation of common subdirectories:<\/span><\/p>\n<table class=\"grid\" style=\"border-collapse: collapse;width: 100%\">\n<thead>\n<tr>\n<th style=\"width: 22.3701%\" scope=\"col\">\n<h3>Directory<\/h3>\n<\/th>\n<th style=\"width: 77.6299%\" scope=\"col\">\n<h3>Remarks<\/h3>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th style=\"width: 22.3701%\" scope=\"row\">etc<\/th>\n<td style=\"width: 77.6299%\">contains operation and administrative files<\/td>\n<\/tr>\n<tr>\n<th style=\"width: 22.3701%\" scope=\"row\">bin<\/th>\n<td style=\"width: 77.6299%\">contains executable commands<\/td>\n<\/tr>\n<tr>\n<th style=\"width: 22.3701%\" scope=\"row\">dev<\/th>\n<td style=\"width: 77.6299%\"><span class=\"c1\">contains the devices connected to the system (printers, terminals, etc&#8230;); these devices still appear as files<\/span><\/td>\n<\/tr>\n<tr>\n<th style=\"width: 22.3701%\" scope=\"row\">users*<\/th>\n<td style=\"width: 77.6299%\">contains user files and directories. *The directory name is not standard and varies between systems. \u00a0Other common variations are things like &#8220;home&#8221;. \u00a0Some larger systems will even have more than one top-level user directories such as &#8220;faculty&#8221;, &#8220;staff&#8221;, &#8220;classof31&#8221;, etc.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"h.1w47277fkjat\" class=\"c29\"><span class=\"c9\">How to Specify a File or Directory in Unix<\/span><\/h2>\n<p class=\"c2 no-indent\"><span class=\"c1\">As most Unix commands act on files or directories, it is <\/span>necessary to be able to specify such an entity.<\/p>\n<p>There are two methods to specify a file or directory, absolute and relative:<\/p>\n<h3 class=\"c2 c12\" id=\"h.wlex4i7yj2gn\"><span class=\"c11\">Absolute<\/span><\/h3>\n<p class=\"c2\"><span class=\"c1\">To specify a file or directory using the absolute method, start with the root directory (\/) and write each directory that is encountered on the path to the directory or file being specified. \u00a0Separate each directory with a &#8220;\/&#8221; forward slash character.<\/span><\/p>\n<div class=\"textbox textbox--examples\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">Examples<\/p>\n<\/header>\n<div class=\"textbox__content\">Specify the etc directory in the above system.<\/div>\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><span class=\"c3 c5\">\/etc<\/span><\/pre>\n<div class=\"textbox__content\">Specify the file named passwd in the above system.<\/div>\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><span class=\"c3 c5\">\/etc\/passwd<\/span><\/pre>\n<div class=\"textbox__content\">Specify the file named ls in the above system.<\/div>\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><span class=\"c3 c5\">\/bin\/ls<\/span><\/pre>\n<div class=\"textbox__content\">Specify the file named mydata in the above system.<\/div>\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><span class=\"c3 c5\">\/users\/raj\/work\/mydata<\/span><\/pre>\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<div class=\"textbox textbox--key-takeaways\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">Key Takeaways<\/p>\n<\/header>\n<div class=\"textbox__content\">The absolute specification <span class=\"c17\">always <\/span><span class=\"c1\">starts with a &#8220;\/&#8221; (forward slash).<\/span><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<h3 class=\"c2 c12\" id=\"h.ckuga4i1jzvp\"><span class=\"c11\">Relative<\/span><\/h3>\n<p class=\"c2\"><span class=\"c1\">When working on Unix, the user will always &#8220;be&#8221; at some logical position within the hierarchy. \u00a0This position is termed the &#8220;current working directory&#8221; or simply the &#8220;current directory&#8221;. The specification of a relative path is relative to this current directory position. \u00a0Note that it is possible to change one&#8217;s current directory while working; this will be discussed in a later chapter.<\/span><\/p>\n<p class=\"c2\"><span class=\"c1\">To specify a file or directory using the relative method, start with the current directory and write each directory that is encountered on the path to the directory or file being specified. \u00a0Separate each directory with a &#8220;\/&#8221; forward slash character.<\/span><\/p>\n<div class=\"textbox textbox--examples\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">Examples<\/p>\n<\/header>\n<div class=\"textbox__content\">\n<div class=\"textbox__content\">\n<p class=\"c2\"><span class=\"c1\">Specify the file mydata with\u00a0<\/span><span class=\"c1\">current directory: \/users\/raj\/<\/span><\/p>\n<\/div>\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><span class=\"c3 c5\"><span class=\"c5 c3\">work\/mydata\r\n<\/span><\/span><\/pre>\n<div class=\"textbox__content\">\n<p class=\"c2\"><span class=\"c1\">Specify the file mydata with\u00a0<\/span><span class=\"c1\">current directory: \/users\/raj\/work\/<\/span><\/p>\n<\/div>\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><span class=\"c3 c5\"><span class=\"c5 c3\">mydata<\/span><\/span><\/pre>\n<div class=\"textbox__content\">\n<p class=\"c2\"><span class=\"c1\">Specify the file report with <\/span><span class=\"c1\">current directory: \/users\/raj\/work<\/span><\/p>\n<\/div>\n<pre class=\"textbox__content indent\" style=\"padding-left: 40px\"><span class=\"c3 c5\"><span class=\"c5 c3\">..\/report<\/span><\/span><\/pre>\n<p class=\"textbox__content indent no-indent\"><span class=\"c3 c5\"><span class=\"c5 c3\"> <span class=\"c1\">As the file <strong>report<\/strong> is not contained in the current directory, it is necessary to go up one level first (to raj) to be able to reach the file <strong>report<\/strong>. \u00a0Here the double dots mean &#8220;parent directory&#8221; or one level up.<\/span><\/span><\/span><\/p>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<div class=\"textbox textbox--key-takeaways\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">Key Takeaways<\/p>\n<\/header>\n<div class=\"textbox__content\">The relative specification <span class=\"c17\">never <\/span><span class=\"c1\">starts with a &#8220;\/&#8221; (forward slash).<\/span><\/div>\n<\/div>\n<p class=\"c2 c16\"><span class=\"c1\">\u00a0<\/span><\/p>\n<p class=\"c2\"><span class=\"c1\">When should one use absolute vs. relative specifications? \u00a0In many cases both are acceptable. \u00a0One may notice that a relative specification usually requires less typing.\u00a0 Who likes more typing? An absolute path is preferred when the user or programmer values portability allowing the specification to be used from any position on the system by any user.<\/span><\/p>\n<h3 class=\"c2 c12\" id=\"h.trgvb3y0wgo\"><span class=\"c11\">Points to Consider<\/span><\/h3>\n<ul class=\"c19 lst-kix_558yn0im65zn-0 start\">\n<li class=\"c2 c22 c20 li-bullet-0\"><span class=\"c1\">Names for files and directories are case-sensitive. \u00a0Thus report, Report, and REPORT are all distinct.<\/span><\/li>\n<li class=\"c2 c22 c20 li-bullet-0\"><span class=\"c1\">Names may include any letters, digits, and some special characters (period, comma, underscore, etc.) but not \/, &lt;, &gt;, &amp;, :, |. <\/span><\/li>\n<li class=\"c2 c22 c20 li-bullet-0\"><span class=\"c1\">Names may be up to 255 characters in length.<\/span><\/li>\n<li class=\"c2 c22 c20 li-bullet-0\"><span class=\"c1\">There is no requirement for file extensions (few characters after a period). \u00a0All of the following are valid names:<\/span><\/li>\n<\/ul>\n<ul>\n<li style=\"list-style-type: none\">\n<ul class=\"c19 lst-kix_558yn0im65zn-1 start\">\n<li class=\"c2 c21 li-bullet-0\">\n<pre><span class=\"c1\">report<\/span><\/pre>\n<\/li>\n<li class=\"c2 c21 li-bullet-0\">\n<pre><span class=\"c1\">letter_to_bob.text<\/span><\/pre>\n<\/li>\n<li class=\"c2 c21 li-bullet-0\">\n<pre><span class=\"c1\">forecast.July,Version1<\/span><\/pre>\n<\/li>\n<li class=\"c2 c21 li-bullet-0\">\n<pre><span class=\"c1\">notes.doc<\/span><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul class=\"c19 lst-kix_558yn0im65zn-0\">\n<li class=\"c2 c22 c20 li-bullet-0\"><span class=\"c1\">Names must be unique within a directory (no duplicates allowed).\u00a0 This is automatically enforced by the operating system.\u00a0 In the raj directory, it would not be possible to create another file or directory called work. \u00a0Consider the analogy of human families: \u00a0Two siblings would not share the same name, but a cousin, uncle, or grandparent could share the same name without conflict.<\/span><\/li>\n<\/ul>\n<p><span><\/p>\n<div id=\"h5p-1\">\n<div class=\"h5p-iframe-wrapper\"><iframe id=\"h5p-iframe-1\" class=\"h5p-iframe\" data-content-id=\"1\" style=\"height:1px\" src=\"about:blank\" frameBorder=\"0\" scrolling=\"no\" title=\"Absolute Path Naming\"><\/iframe><\/div>\n<\/div>\n<p><\/span><\/p>\n<h2 id=\"h.lropx7ndtkj\" class=\"c12 c39\"><span class=\"c9\">Home Directory<\/span><\/h2>\n<p class=\"c2\"><span class=\"c1\">The home directory is a private area for the user files and directories. Each user will have a directory name matching the login name assigned by the system administrator. <\/span><\/p>\n<p class=\"c2\"><span class=\"c1\">While it is correct and possible to specify a home directory using the absolute and relative methods aforementioned, there exists an abbreviation consisting of a ~ (tilde) followed by the user\u2019s login name. \u00a0Advantage: This avoids having to know the name of the user file area which is non-standard: \u00a0some installations call it users, others call it home, still others have their own conventions. \u00a0<\/span><\/p>\n<div class=\"textbox textbox--examples\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">Examples<\/p>\n<\/header>\n<div class=\"textbox__content\">\n<p class=\"c2\">Eg. Raj&#8217;s home directory would be<\/p>\n<pre class=\"c2\" style=\"padding-left: 40px\"><span class=\"c5 c3\">~raj<\/span><\/pre>\n<p class=\"c2\">Eg. A file in his directory would be<\/p>\n<pre class=\"c2\" style=\"padding-left: 40px\"><span class=\"c5 c3\">~raj\/report<\/span><\/pre>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"author":2,"menu_order":1,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-25","chapter","type-chapter","status-publish","hentry"],"part":23,"_links":{"self":[{"href":"https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-json\/pressbooks\/v2\/chapters\/25","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-json\/wp\/v2\/users\/2"}],"version-history":[{"count":3,"href":"https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-json\/pressbooks\/v2\/chapters\/25\/revisions"}],"predecessor-version":[{"id":90,"href":"https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-json\/pressbooks\/v2\/chapters\/25\/revisions\/90"}],"part":[{"href":"https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-json\/pressbooks\/v2\/parts\/23"}],"metadata":[{"href":"https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-json\/pressbooks\/v2\/chapters\/25\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-json\/wp\/v2\/media?parent=25"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-json\/pressbooks\/v2\/chapter-type?post=25"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-json\/wp\/v2\/contributor?post=25"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/pressbooks.library.torontomu.ca\/opsyshiraki\/wp-json\/wp\/v2\/license?post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}