Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To navigate files and folders in Terminal, use pwd to see your current directory, ls to list its contents, and cd to change directories. These Bash-style commands work in macOS, Linux, and WSL; Windows PowerShell uses Get-Location, Get-ChildItem, and Set-Location instead.

The commands in this article use Bash-style syntax first, then show the PowerShell equivalents. The correct command depends on the shell running inside your terminal window—not only on the terminal application itself.

Key takeaways

  • pwd prints the current working directory, ls lists its contents, and cd changes the directory in Bash and Zsh.
  • . means the current directory, .. means the parent directory, ~ commonly means your home directory, and / means the Unix filesystem root.
  • Unix-like shells hide dot-prefixed entries from ordinary ls output; use ls -la to include them.
  • Paths containing spaces must be quoted or escaped, such as cd "Project Files".
  • PowerShell provides Get-Location, Get-ChildItem, and Set-Location, with pwd, ls, dir, and cd available as aliases.

What are Terminal, a shell, and a directory?

A terminal emulator is the application window that displays command-line input and output. Examples include Terminal on macOS, GNOME Terminal on Linux, and Windows Terminal. A shell is the command interpreter running inside that window, such as Bash, Zsh, Fish, PowerShell, or Command Prompt.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Commands depend primarily on the shell. Windows Terminal can host PowerShell, a WSL Linux distribution, Command Prompt, Git Bash, and other command-line applications, as described in Microsoft’s Windows development-environment documentation. This article uses Bash-style commands for macOS, Linux, and WSL. Use the dedicated PowerShell section if PowerShell is running in your terminal.

A directory is the command-line term usually used for a folder. Directories contain files and other directories. A path identifies where an item is located.

In a Unix-like shell, the path separator is a forward slash (/):

/Users/alex/Documents/projects

PowerShell normally uses Windows paths with drive letters and backslashes:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
C:UsersAlexDocumentsprojects

A file extension does not determine whether something is a file or a folder. The filesystem stores an object at a path, and commands such as cd or ls determine how that object can be used.

How do you find your current directory with pwd?

In Bash, Zsh, and most other Unix-like shells, run:

pwd

pwd means “print working directory.” A typical result is:

/Users/alex

The current working directory is the location used for relative paths. For example, if pwd shows /Users/alex, then cd Documents means “enter the Documents directory inside /Users/alex.”

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not rely on the prompt to tell you where you are. Prompt designs vary, and some prompts do not display the full path. Run pwd whenever you are unsure. GNU documents logical and physical forms of pwd in its pwd reference:

pwd -L   # show the logical path, where supported
pwd -P # show the physical path, resolving symbolic links, where supported

Plain pwd is the best beginner command. The difference between -L and -P matters mainly when symbolic links are involved. Behavior can vary between Bash, Zsh, POSIX sh, and installed GNU utilities.

How do you list files and folders with ls?

To list the contents of the current directory, run:

ls

To inspect another directory without entering it, provide its path:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ls Documents
ls /var/log

Common options include:

Command Purpose
ls -l Show long-format details such as permissions, owner, size, and timestamps.
ls -a Include hidden entries, including names beginning with a dot.
ls -la Combine long format and hidden entries.
ls -lh Use human-readable size units where supported.
ls -ld folder Show the directory entry itself rather than listing the directory’s contents.

Unix-like systems conventionally treat names beginning with . as hidden. Ordinary ls output omits those names. GNU’s ls documentation describes this default behavior. Hidden does not mean unimportant or safe to delete; configuration files and application data are often hidden.

ls -lah is a commonly available combination, but GNU/Linux, macOS BSD utilities, BusyBox, and other ls implementations do not support exactly the same options or output. If an option fails on another computer, check man ls or ls --help where supported.

How do you change folders with cd?

Use cd followed by a directory path:

cd Documents

The shell interprets Documents relative to the current directory. A reliable beginner workflow is:

pwd
ls
cd Documents
pwd

To enter several levels at once, provide the complete relative path:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cd Documents/projects/website

To go directly to a known absolute path, begin at the filesystem root:

cd /Users/alex/Documents

To return to your home directory, use either form:

cd
cd ~

In Bash, cd without a directory uses the HOME environment variable, while an unquoted tilde at the beginning of a word expands to the home directory. Bash documents cd, HOME, and related behavior in its shell-builtin reference and tilde-expansion reference.

Rank #2
Synerlogic Mac OS Shortcuts Sticker for Air/Pro | Keyboard Stickers for macOS | Laminated Vinyl MacBook Cheatsheet | MacBook Shortcuts 2026 (Clear/White)
  • 💻 ❌ Not for MacBook Neo or 11", 12" macbooks (see our "universal" version - it is smaller). Fit is perfect for any MacBooks Air and Pro, iMacs, and Mac Minis—regardless of CPU type or macOS version.
  • 💻 Master Mac Shortcuts Instantly – Learn and use essential Mac commands without searching online. This sticker keeps the most important keyboard shortcuts visible on your device, making it easy to boost your skills and speed up everyday tasks. ⚠️ Note: The “⇧” symbol stands for the Shift key.
  • 💻 Perfect for Beginners and Power Users – Whether you're new to Mac or a seasoned user, this tool helps you work faster, learn smarter, and avoid frustration. Ideal for students, professionals, creatives, and seniors alike.
  • 💻 New adhesive – stronger hold. It may leave a light residue when removed, but this wipes off easily with a soft cloth and warm, soapy water. Fewer air bubbles – for the smoothest finish, don’t peel off the entire backing at once. Instead, fold back a small section, line it up, and press gradually as you peel more. The “peel-and-stick-all-at-once” method does NOT work for stickers like ours.
  • 💻 Made in the USA – Trusted Quality – Designed, printed, and packaged in the USA. Backed by responsive customer support and a satisfaction guarantee.

To move up one level:

cd ..

To move up two levels:

cd ../..

To return to the previous directory, run:

cd -

cd - uses the shell’s previous-directory state and commonly prints the destination while changing to it. Exact output formatting can differ between shells.

What is the difference between an absolute and relative path?

An absolute path starts from the filesystem root or a Windows drive and does not depend on your current directory. A relative path starts from the current working directory and changes meaning when your current location changes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Suppose the directory tree is:

/Users/alex
└── Documents
└── projects

From /Users/alex, these commands reach the same destination:

# Relative path
cd Documents/projects

# Absolute path
cd /Users/alex/Documents/projects

From /Users/alex/Documents/projects, this command returns to /Users/alex:

cd ../..

Relative paths are convenient for nearby folders. Absolute paths are clearer when a command must work regardless of the current location.

What do ., .., ~, and / mean?

These symbols describe common locations in Unix-like shells:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Symbol Meaning Example
. The current directory. ls .
.. The parent directory, one level above the current directory. cd ..
~ Your home directory in shells that support tilde expansion. cd ~/Downloads
/ The Unix filesystem root. cd /tmp

For example:

ls .
ls ..
cd ./Documents
cd ~/Downloads
cd /tmp

PowerShell supports . and .. for the current and parent locations. PowerShell also supports ~ in many path contexts, but $HOME is the clearer PowerShell-native way to describe the home directory. A Windows root is associated with a drive, such as C:.

How do you navigate paths containing spaces?

Quote a path containing spaces so the shell treats the path as one argument:

cd "Project Files"
cd "Alex's Files"

In Bash, you can also escape each space with a backslash:

cd Project Files

The practical rule is: if a path contains spaces or shell metacharacters, quote it. Bash quoting prevents spaces and special characters from being interpreted as separators or operators; the Bash quoting documentation explains the different quoting forms.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Bash single quotes prevent nearly all expansion, while double quotes still allow certain variable and command-related expansion in applicable contexts. PowerShell has similar broad quoting purposes but different parsing rules, so use a quoted Windows path such as:

Set-Location "C:UsersAlexProject Files"

For unusual filenames, including names beginning with a hyphen, many Unix commands accept -- to mark the end of options:

cd -- "-archive"

The -- convention is common but is not a universal guarantee for every command or shell builtin. Filenames can also contain tabs, newlines, Unicode characters, and shell metacharacters. Windows additionally has reserved characters and different case-sensitivity behavior, so do not assume a filename behaves identically on every operating system.

How do Tab completion and command history help?

Press Tab to complete a command or path. For example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cd ~/Doc<Tab>

If only one matching directory exists, the shell may complete the name. If several matches exist, the shell may complete their common prefix or display the choices. Pressing Tab twice displays multiple matches in some shells.

Use the Up Arrow to recall earlier commands. In many readline-based shells, Ctrl+A moves to the beginning of the command line and Ctrl+E moves to the end. Ctrl+L, or the command clear, commonly clears the visible screen. These are common interactive features, not guarantees for every shell or terminal application. The Bash Reference Manual documents interactive editing, history, aliases, and completion.

Can you practice Terminal navigation safely?

Yes. Create a practice tree inside your home directory instead of experimenting in a system directory:

Rank #3
Afterplug 2026 Mac OS Shortcuts Sticker for MacBook Neo, Air & Pro (1-Pack)
  • SHORTCUTS AT A GLANCE: 52 essential macOS shortcuts sit on your palm rest, in your sightline. Stop Googling "how to screenshot on Mac" — glance down, find it, keep working.
  • ESSENTIALS ONLY: We curated only the shortcuts you'll actually use, grouped by task — Basics, Navigation, Finder, Screenshots, System. Clean layout, easy to scan, easy to remember.
  • ZERO RESIDUE, ZERO DAMAGE: Premium vinyl with residue-free adhesive lifts off clean when you're ready — no glue marks, no discoloration, no damage to your MacBook.
  • BUILT FOR DAILY LIFE: Water repellent matte vinyl shrugs off coffee spills, sweat, and smudges. Fade-resistant print stays sharp for years. Ultra-thin 0.10mm — you won't feel it under your wrists.
  • FITS YOUR MACBOOK: For 13"/15" MacBook Air, 14"/16" MacBook Pro, and 2026 13" MacBook Neo. Choose Clear Black for light MacBooks (Silver, Starlight, Sky Blue, Blush, Citrus), Clear White for dark MacBooks (Midnight, Space Black, Indigo), or Opaque Black and Pink for any model.
mkdir -p ~/terminal-practice/documents/projects
cd ~/terminal-practice
pwd
ls

A typical result from pwd is:

/Users/alex/terminal-practice

The exact username and home-directory path vary. Continue practicing movement:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cd documents
pwd
cd projects
pwd
cd ..
cd ../..

The first cd documents enters the documents directory. The next cd projects enters its child directory. cd .. goes back to documents, and cd ../.. returns to terminal-practice. The GNU Coreutils manual documents mkdir and related filesystem utilities.

What are the Windows PowerShell equivalents?

PowerShell uses different cmdlets for navigation, although familiar aliases are available:

Goal Bash, Zsh, macOS, Linux, or WSL PowerShell
Show current location pwd Get-Location or pwd
List contents ls Get-ChildItem, ls, or dir
Include hidden or system items ls -a Get-ChildItem -Force
Enter a folder cd folder Set-Location folder or cd folder
Go up one level cd .. Set-Location .. or cd ..
Go home cd ~ or cd Set-Location $HOME
Go to a root cd / Set-Location C: or another drive root
List folders only find . -type d -maxdepth 1 or ls -d */ Get-ChildItem -Directory
Find by name find . -name "name" Get-ChildItem -Recurse -Filter name

Important: PowerShell aliases are not interchangeable implementations of Unix commands. In PowerShell, ls, dir, cd, and pwd are aliases for PowerShell cmdlets. PowerShell commands return objects and can navigate providers other than the filesystem, including the Registry provider. Microsoft explains PowerShell’s filesystem provider and aliases in its filesystem provider documentation.

PowerShell-specific listing examples include:

Get-ChildItem -Path Documents
Get-ChildItem -Force
Get-ChildItem -Directory
Get-ChildItem -File
Get-ChildItem -Name

To navigate Windows paths and drives:

Set-Location C:UsersAlexDocuments
Set-Location D:

PowerShell retains a location for each PowerShell drive, unlike the single-root model normally encountered in Unix-like shells. Microsoft documents this behavior in its PowerShell locations reference.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do you find a folder when you do not know its path?

On Unix-like systems, use find from a likely starting directory:

find . -name "report.pdf"
find ~ -name "report.pdf"
find . -type d -name "project*"
find . -type f -name "*.txt"

Use -iname for a case-insensitive name search in GNU find:

find . -iname "*.jpg"

The first argument, such as . or ~, controls where the search starts. The GNU Findutils manual documents name matching and notes that some predicates are GNU-specific. Starting from a likely parent folder is faster and produces fewer permission errors than searching from / or an entire mounted drive. Narrow results with -type f or -type d.

In PowerShell, use recursive Get-ChildItem searches:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Get-ChildItem -Path . -Recurse -Filter report.pdf
Get-ChildItem -Path . -Recurse -Directory -Filter project*

Avoid turning a navigation search into a deletion command. There is no need to combine find with destructive commands such as rm while learning paths.

How do you open the current Terminal folder in a graphical file manager?

Use the platform-specific bridge command for the current directory:

Platform Command What it does
macOS open . Opens the current directory in Finder.
Linux desktop xdg-open . Asks the desktop environment to open the current directory.
Windows PowerShell explorer . Opens the current location in File Explorer.

These commands are platform-specific, not portable Terminal navigation commands. The dot means “the current directory” in the examples.

How do you fix “No such file or directory”?

The error usually means the path is misspelled, relative to the wrong current directory, missing quotes around spaces, on another drive or mounted volume, or pointing through an unavailable symbolic link.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In Bash-style shells, diagnose the location and spelling:

pwd
ls
ls -la

Then use Tab completion or search:

find . -type d -name "folder-name"

In PowerShell, use:

Get-Location
Get-ChildItem -Force
Get-ChildItem -Recurse -Directory -Filter folder-name

Check capitalization as well. Some filesystems distinguish uppercase and lowercase names, while others do not. Also make sure you are using the syntax for the shell actually running in the terminal window.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How do you fix “Permission denied”?

“Permission denied” means the current user or process cannot perform the requested operation; the message does not necessarily mean the path is wrong. On Unix-like systems, a directory needs execute or traverse permission to access items inside it.

Inspect the directory entry and permissions:

ls -ld /path/to/folder

The path may be readable only by another user, restricted by an administrator, unavailable because a volume is not mounted, or blocked by a parent directory’s permissions. sudo may provide elevated privileges for a specific administrative task, but it does not correct a typo, missing mount, ownership problem, or shell syntax error. Do not respond by broadly applying chmod -R 777; diagnose the owner and required access first, and use the narrowest permission change or administrative command necessary.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why are hidden files missing from the listing?

Unix-like ls hides names beginning with a dot unless you request all entries:

ls -la

PowerShell uses a different hidden/system-item model, so use:

Get-ChildItem -Force

Hidden entries can contain application settings, credentials, caches, or system data. Seeing a hidden item does not make the item safe to rename or delete.

Why does cd sometimes appear not to work in a script?

cd changes the current directory of the shell process in which cd runs. A script launched in a separate child shell can change its own working directory and then exit without changing the parent interactive shell.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Bash implements cd as a shell builtin because an external program could not directly change the working directory of the calling shell. The Bash Reference Manual documents shell builtins and the shell’s interactive behavior. Run pwd after a script or command sequence to confirm the location of the current interactive shell.

What should you do when symbolic links produce surprising paths?

A symbolic link is a filesystem path that points to another location. Logical navigation preserves the link-based path, while physical navigation resolves the link; the difference becomes noticeable when you use .. after entering a linked directory.

Bash provides:

cd -L path   # use logical path behavior
cd -P path # resolve symbolic links physically

Bash documents both modes in its cd builtin documentation. If a link points to an unavailable target, commands may report that the directory does not exist even though the link itself is visible in a listing.

When is a directory stack better than cd -?

Use a directory stack when you repeatedly switch among two or more locations. Bash and Zsh provide pushd and popd:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
pushd ~/project
pushd ~/Downloads
popd
popd

PowerShell provides corresponding location-stack commands:

Push-Location "$HOMEproject"
Push-Location "$HOMEDownloads"
Pop-Location
Pop-Location

cd - is convenient for switching between two locations. A stack is more useful when you need to return through several previously saved locations in order.

What is the quickest Terminal navigation reference?

Goal Bash/Zsh/macOS/Linux/WSL PowerShell
Show where you are pwd Get-Location or pwd
List the current folder ls Get-ChildItem, ls, or dir
Show hidden items ls -a or ls -la Get-ChildItem -Force
Enter a child folder cd folder Set-Location folder or cd folder
Go up one level cd .. Set-Location .. or cd ..
Go home cd or cd ~ Set-Location $HOME
Go to the Unix root cd / Use a drive root such as Set-Location C:
Return to the previous location cd - Use Push-Location and Pop-Location, or repeat the previous path
List folders only find . -type d -maxdepth 1 Get-ChildItem -Directory
Find an item by name find . -name "name" Get-ChildItem -Recurse -Filter name

Start with the three-command cycle pwd, ls, and cd. When a command fails, return to that cycle: print the current location, list what actually exists there, and then enter a path using accurate spelling and quotes where needed.

Frequently Asked Questions

What is the basic command for navigating folders in Terminal?

The basic Bash-style navigation commands are pwd to show the current directory, ls to list its contents, and cd folder-name to enter a folder. Use cd .. to go up and cd ~ to return home.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I navigate to a folder with spaces in Terminal?

Quote the complete path, such as cd "Project Files", or escape the space as cd Project Files in Bash. In PowerShell, use a quoted path such as Set-Location "C:UsersAlexProject Files".

What is the PowerShell equivalent of cd, ls, and pwd?

PowerShell uses Set-Location to change folders, Get-ChildItem to list contents, and Get-Location to show the current location. PowerShell also provides cd, ls, dir, and pwd as aliases.

How do I find a folder if I do not know its location?

In Bash or another Unix-like shell, search from a likely parent directory with find . -type d -name "folder-name". In PowerShell, use Get-ChildItem -Path . -Recurse -Directory -Filter folder-name; searching a whole drive or the Unix root can be slow and produce permission errors.

The Bottom Line

Terminal navigation becomes predictable once you track the current working directory. In Bash or Zsh, use pwd to locate yourself, ls to inspect the directory, and cd to move. Use absolute paths when the destination must be unambiguous, relative paths for nearby folders, quotes for spaces, and find when the path is unknown.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.