Windows path equivalent in Linux
Shows or modifies the list of directories the shell searches when you type a command.
path
echo $PATH / export PATH
echo $PATH / export PATH
echo $PATH / export PATH
Overview
What this command does
On Windows, "path" is used to view or modify the command search path. On Linux, the closest practical mapping shown here is "echo $PATH / export PATH". Shows or modifies the list of directories the shell searches when you type a command. This reference is grouped under Terminal & Shell Scripting → Terminal.
Windows → Linux context
What changes when you use this on Linux?
Equivalent task, different tool
Windows path maps to echo $PATH / export PATH for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.
Portable across the compared distros
The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.
For the broader concept behind this mapping, read Linux command-line basics.
Practical tasks
Common use cases
View or modify the command search path
Shows or modifies the list of directories the shell searches when you type a command.
echo $PATH
Show current PATH
export PATH=$PATH:/new/dir
Add directory to PATH (this session)
which command
Check if command is in PATH
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
echo $PATH
export PATH=$PATH:~/bin
echo 'export PATH=$PATH:~/bin' >> ~/.bashrc
source ~/.bashrc
Walkthrough
Examples with explanations
# Windows: path
echo $PATH
# /usr/local/sbin:/usr/local/bin:/usr/bin:/bin
# Add a directory:
export PATH=$PATH:~/bin
# Make permanent (add to ~/.bashrc):
echo 'export PATH=$PATH:~/bin' >> ~/.bashrc
source ~/.bashrc
Reference
Common options and variations
| Command or option | Use |
|---|---|
echo $PATH | Show current PATH |
export PATH=$PATH:/new/dir | Add directory to PATH (this session) |
which command | Check if command is in PATH |
hash -r | Clear command location cache after PATH change |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
Debian/Ubuntu, Fedora and Arch all use "echo $PATH / export PATH" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | echo $PATH / export PATH |
Same command on this distribution. |
| Fedora | same command | echo $PATH / export PATH |
Same command on this distribution. |
| Arch | same command | echo $PATH / export PATH |
Same command on this distribution. |
Keep learning