Skip to content
Snippets Groups Projects
bash-3-navigating.md 7.33 KiB

Navigating

Back to the directory structure... this time we will learn to navigate between directories and the difference between absolute and relative paths.

??? quote "First click and follow the instructions below only if you start the course at this stage! Otherwise skip this step!" {% include-markdown "pages/bash/bash-0-setup.md" %}

Where are we?

Below is represented the sub-part of the directory structure we will work on (keep this picture aside, it will help!):

!!! warning Home is for Linux, it will be called Users on MacOSX

!!! question "Could you tell where our terminal is located currently?"

??? example "Click to show the solution" To check where we are located we must use the pwd command.

!!! tip By default the termnial open in your home. The complete path is /home/username.

!!! question "In unix world, it exists a special character which is a shortcut for your home. Which character is that?"

??? example "Click to show the solution" Yes the ~ charcater is also your home!

Move into a child directory (Move down)

Check what files and directorys are presents in the current directory using the ls command. Check if you can see the {{extra.working_directory}} directory. If you see it you can move in it using the cd command. This command means Change Directory.

cd {{extra.working_directory}}

!!! question "How can you be sure you are in the {{extra.working_directory}} now?"

??? example "Click to show the solution" You can look at your prompt or check with the pwd command.

File or directory?

Do you remember the ls command to list the content of a directory? Good! Did you remember how you differentiate a file from a directory? Run the ls command if you are unsure.

??? example "Click to show the solution" Well actually it is not possible like that.