Linux Commands / IT Support Guides
Navigate Linux paths with pwd and ls
Use pwd to check which folder your terminal is in, then use ls to see what is there.
Environment and inputs: Linux · Bash-compatible shell; package and service names vary by distribution
Understand the problem
A relative path such as report.txt starts from your current directory. An absolute path such as /tmp/report.txt starts from the root of the filesystem.
Run the command
Run the two commands in the terminal that reported the problem. They take no arguments and only display information.
pwd
ls -lah
Read the output
The first line, such as /home/kim, is the current directory. In the listing, -l shows details, -a includes names beginning with a dot, and -h shows sizes with units such as K and M.
Choose the next step
If you are in the wrong directory, use cd with the intended directory or use an absolute file path. Run pwd again to confirm where you are.
Before making changes
If a shortcut path may point somewhere unexpected, run pwd -P to show the physical location. Confirm the path before editing or deleting anything.