mrgoblin logo

mrgoblin

Linux giggles #1: Paths

Thu Sep 17 13:16:03 2026 UTC

Hi! You are reading Linux giggles. Let's talk about paths.

Path is a string specifying how to find some file or directory in the system. Paths can be relative and absolute. Absolute path is a path which starts with "/", relative paths are ones not starting with it, they are counting each time from your current working directory.

For example, if your user is jack and you are in your home and there is a recipes directory in it, your current working dir (absolute path) is /home/jack, recipes catalog's absolute path is /home/jack/recipes, relative - recipes.

If you go in recipes, your new working directory is now /home/jack/recipes. But you realize that new Carbonara's recept from your favorite site is in Downloads/ which is in your home! Can you get it by a relative path?

Of course you can! In Unix-like systems (which Linux is) there are always "." and ".." in every directory. The "." means the directory itself, ".." means its parent catalog. For recipes, parent is your home. So what is the relative path to Carbonara recipe (let's call it carbonara.txt) from recipes? If you answered ../Downloads/carbonara.txt, you are absolutely right!

Questions:

  1. What is a relative path to /home/bob from /home/alice/programs?
  2. You are in /usr/local/etc/nginx. What is an absolute path for ../postfix/main.cf file?

Please leave a comment. See you!


☞ From Dronix (unverified) Sat Sep 19 23:35:08 2026 UTC pencil

Home

> ...you are in your home and there is a recipes directory in it, your current working dir (absolute path) is /home/jack

Only if so specified in /etc/passwd. But okay, maybe this information is too hard for newbies at this stage.

BTW in the past home dirs in Unix were in `/usr' (USer Resources), but later due to small hard drive size on PDP-11 dmr and ken placed here copy of `bin' and `lib' from `/'. And much later `/usr' meaning was changed to Unix System Resources and $HOME was changed to `/home' or `/usa'.