Linux Labs

First steps / Stage 5 of 15

Navigation and paths

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 8 · on a machine · 4 min

A path from a colleague

What you will learn

  • Find out the current directory and move around the file system tree.
  • Choose an absolute or a relative path for a specific action.
  • Find a file by name and record its path without changing the originals.

A colleague writes: "The site config is in config/site.conf, check which port it uses." Open the file by that path and see what happens.

Start on the card creates the practice directory ~/path-lab and takes you there. A config is a file with a program's settings, and cat prints a file's contents to the screen.

Exercise · look

Check the config at your colleague's path

You are in ~/path-lab. Run the three commands one by one and compare what the two identical cat commands print.

First, predict

Your colleague is sure the file is there. What will the first cat config/site.conf print?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in
Check yourself 1 question

Why did the same cat config/site.conf fail to find the file at first and find it after cd project?

  • The Start button created the file, before the first cat. cd creates no files.

  • cd does not change permissions. Without read access cat would print Permission denied, and it printed No such file or directory.

  • cat remembers nothing between runs. Go back with cd ~/path-lab and repeat the first cat — the file is "missing" again.

cd project decided it: the path config/site.conf is counted from the current directory, and cd changed it.

Ubuntu 24.04
Loading…