Skip to content

Commit

Permalink
Update 02-filedir.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hbeale authored Jan 8, 2025
1 parent 43f3709 commit b4c8e95
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions _episodes/02-filedir.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ $ pwd
{: .language-bash}

~~~
/public/home/nelle
/home/nelle
~~~
{: .output}

Here,
the computer's response is `/public/home/nelle`,
the computer's response is `/home/nelle`,
which is Nelle's **home directory**:

> ## Home Directory Variation
Expand Down Expand Up @@ -128,10 +128,10 @@ Typically, when you open a new command prompt you will be in
your home directory to start.

Now let's learn the command that will let us see the contents of our
own filesystem. We can see what's in an example directory by running `ls /public/home/hcbeale/example`:
own filesystem. We can see what's in an example directory by running `ls /home/hcbeale/example` (replacing hcbeale with your username):

~~~
$ ls /public/home/hcbeale/example
$ ls /home/hcbeale/example
~~~
{: .language-bash}

Expand Down Expand Up @@ -159,7 +159,7 @@ the shell might also use colors to indicate whether each entry is a file or
directory.

~~~
$ ls -F /public/home/hcbeale/example
$ ls -F /home/hcbeale/example
~~~
{: .language-bash}

Expand Down Expand Up @@ -206,11 +206,11 @@ between `ls` and `-F` the shell will look for a command called `ls-F`, which
doesn't exist. Also, capitalization can be important. For example, `ls -s` will display the size of files and directories alongside the names, while `ls -S` will sort the files and directories by size, as shown below:

~~~
$ ls -s /public/home/hcbeale/example/data-shell/data
$ ls -s /home/hcbeale/example/data-shell/data
total 116
4 amino-acids.txt 4 animals.txt 4 morse.txt 12 planets.txt 76 sunspot.txt
4 animal-counts 4 elements 4 pdb 4 salmon.txt
$ ls -S /public/home/hcbeale/example/data-shell/data
$ ls -S /home/hcbeale/example/data-shell/data
sunspot.txt animal-counts pdb amino-acids.txt salmon.txt
planets.txt elements morse.txt animals.txt
~~~
Expand Down Expand Up @@ -382,14 +382,14 @@ To **quit** the `man` pages, press <kbd>Q</kbd>.
### Exploring Other Directories
As we've seen above, not only can we use `ls` on the current working directory, but we can use it to list the contents of a different directory. Let's take a
look at our `/public/home/hcbeale/example/` directory by running `ls -F /public/home/hcbeale/example/`,
look at our `/home/hcbeale/example/` directory by running `ls -F /home/hcbeale/example/`,
i.e.,
the command `ls` with the `-F` **option** and the **argument** `Desktop`.
The argument `/public/home/hcbeale/example/` tells `ls` that
The argument `/home/hcbeale/example/` tells `ls` that
we want a listing of something other than our current working directory:
~~~
$ ls -F /public/home/hcbeale/example/
$ ls -F /home/hcbeale/example/
~~~
{: .language-bash}
Expand All @@ -398,10 +398,10 @@ data-shell/
~~~
{: .output}
Note that if a directory named `/public/home/hcbeale/example/` does not exist in your current working directory
Note that if a directory named `/home/hcbeale/example/` does not exist in your current working directory
this command will return an error.
Your output should be a list of all the files and sub-directories in the /public/home/hcbeale/example/ directory, including the `data-shell` directory.
Your output should be a list of all the files and sub-directories in the /home/hcbeale/example/ directory, including the `data-shell` directory.
As you may now see, using a bash shell is strongly dependent on the idea that
your files are organized in a hierarchical file system.
Expand All @@ -410,14 +410,14 @@ it's possible to put hundreds of files in our home directory,
just as it's possible to pile hundreds of printed papers on our desk,
but it's a self-defeating strategy.
Now that we know the `data-shell` directory is located in our /public/home/hcbeale/example/ directory, we
Now that we know the `data-shell` directory is located in our /home/hcbeale/example/ directory, we
can do two things.
First, we can look at its contents, using the same strategy as before, passing
a directory name to `ls`:
~~~
$ ls -F /public/home/hcbeale/example/data-shell
$ ls -F /home/hcbeale/example/data-shell
~~~
{: .language-bash}
Expand All @@ -443,17 +443,17 @@ Let's say we want to move to the `data` directory we saw above. We can
use the following series of commands to get there:
~~~
$ cd /public/home/hcbeale/example/
$ cd /home/hcbeale/example/
$ cd data-shell
$ cd data
~~~
{: .language-bash}
These commands will move us from our home directory into the /public/home/hcbeale/example/ directory, then into
These commands will move us from our home directory into the /home/hcbeale/example/ directory, then into
the `data-shell` directory, then into the `data` directory. You will notice that `cd` doesn't print anything. This is normal. Many shell commands will not output anything to the screen when successfully executed. But if we run `pwd` after it, we can see that we are now
in `/public/home/hcbeale/example/data-shell/data`.
in `/home/hcbeale/example/data-shell/data`.
If we run `ls -F` without arguments now,
it lists the contents of `/public/home/hcbeale/example/data-shell/data`,
it lists the contents of `/home/hcbeale/example/data-shell/data`,
because that's where we now are:
~~~
Expand All @@ -462,7 +462,7 @@ $ pwd
{: .language-bash}
~~~
/public/home/hcbeale/example/data-shell/data
/home/hcbeale/example/data-shell/data
~~~
{: .output}
Expand Down Expand Up @@ -511,15 +511,15 @@ $ cd ..
or more succinctly,
the **parent** of the current directory.
Sure enough,
if we run `pwd` after running `cd ..`, we're back in `/public/home/hcbeale/example/data-shell`:
if we run `pwd` after running `cd ..`, we're back in `/home/hcbeale/example/data-shell`:
~~~
$ pwd
~~~
{: .language-bash}
~~~
/public/home/hcbeale/example/data-shell
/home/hcbeale/example/data-shell
~~~
{: .output}
Expand All @@ -539,7 +539,7 @@ $ ls -F -a
`-a` stands for 'show all';
it forces `ls` to show us file and directory names that begin with `.`,
such as `..` (which, if we're in `/public/home/hcbeale/example/`, refers to the `/public/home/hcbeale` directory)
such as `..` (which, if we're in `/home/hcbeale/example/`, refers to the `/home/hcbeale` directory)
As you can see,
it also displays another special directory that's just called `.`,
which means 'the current working directory'.
Expand Down Expand Up @@ -604,7 +604,7 @@ three commands, but we can actually string together the list of directories
to move to `data` in one step:
~~~
$ cd /public/home/hcbeale/example/data-shell/data
$ cd /home/hcbeale/example/data-shell/data
~~~
{: .language-bash}
Expand All @@ -615,7 +615,7 @@ uses a **relative path**. When you use a relative path with a command
like `ls` or `cd`, it tries to find that location from where we are,
rather than from the root of the file system.
But when you specified `/public/home/hcbeale/example/data-shell/data`,
But when you specified `/home/hcbeale/example/data-shell/data`,
you are using an **absolute path** to a directory by
including its entire path from the root directory, which is indicated by a
leading slash. The leading `/` tells the computer to follow the path from
Expand All @@ -633,12 +633,12 @@ $ pwd
{: .language-bash}
~~~
/public/home/hcbeale/example/data-shell/data
/home/hcbeale/example/data-shell/data
~~~
{: .output}
~~~
$ cd /public/home/hcbeale/example/data-shell
$ cd /home/hcbeale/example/data-shell
~~~
{: .language-bash}
Expand Down

0 comments on commit b4c8e95

Please sign in to comment.