Files and folders

The realpath command

Gives the absolute, real path of a file, resolving links and dots.

Syntax

realpath <ruta>

Copy-ready examples

$ realpath /etc/passwdReal path

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • It fails if any part of the path does not exist.

Related commands

FAQ

How is it different from pwd?

pwd shows where you are; realpath resolves the path of a file you give it.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course