Linux Labs

First steps / Stage 5 of 15

Navigation and paths

Not running Starting usually ~20 s
Leave the lesson

Step 6 of 8 · on a machine · 4 min

Record a path in a file

In the next lab you hand in the answer as a file holding the path you found.

The echo command prints the words that follow it. The > sign sends a command's output to a file instead of the screen — this is redirection. cat shows what was written:

bash
echo /etc/nginx/nginx.conf > ~/answer.txt
cat ~/answer.txt

The answer file holds only the path: no prompt, no spaces, no comments.

Warning

> overwrites the whole file if it already exists. Send output only to the answer file: this is how a found config gets wiped out.

In the exercise the path is needed from another directory — the one the service starts in.

Exercise · do it

The path as the service sees it

A service starts in ~/path-lab/app/bin and reads ~/path-lab/app/config/site.conf. Write to ~/path-lab/route.txt the relative path that opens site.conf from bin.

Sign in and start The machine is available after signing in

Goals · 0 of 2

  • Create the file route.txt not done yet
  • Write in it the relative path from bin to site.conf not done yet

Step goals

0 of 2
  • Create the file route.txt — not done yet
  • Write in it the relative path from bin to site.conf — not done yet
Ubuntu 24.04

Step goals

0 of 2
  • Create the file route.txt — not done yet
  • Write in it the relative path from bin to site.conf — not done yet
Loading…