PATH
The
When you enter a command in the terminal, the system searches through these directories in the order they are listed in the
The
PATH environment variable on Linux (or macOS) is a system variable that specifies a set of directories where executable programs are located.When you enter a command in the terminal, the system searches through these directories in the order they are listed in the
PATH to find the executable file for the command. This allows you to run programs and scripts without needing to specify their full file paths.To display the directories in the PATH environment variable on a macOS, each on a new line, you can use the following command in the terminal:
echo $PATH | tr ':' '\n'
This command uses tr to translate the colon : separators into newline characters \n, effectively breaking the PATH into distinct lines for each directory.
🔍. Similar posts
How to Easily Find All Folder Under a Linux Directory Matching Certain Criteria
10 Dec 2024
A Linux Script to Delete All the .git Folders Hidden in Your Repo Folders
18 Nov 2024
How to Write in a File Using CAT linux command
17 Oct 2024