For a name without a slash, the shell applies its own resolution rules, including aliases, functions, and builtins, and searches directories for external executable files. Ordering and caching details vary by shell. command -v shows how the current shell resolves a name; it may report a builtin name rather than a file path.
command -v ls
printf '%s\n' "$PATH"
PATH is a colon-separated list of directories, searched in order for external commands. An earlier executable can hide another of the same name. A “command not found” message might mean a misspelled name, missing installation, an absent directory in PATH, or another resolution problem. Check the actual installed location, executable permissions and shell cache; do not assume one cause.
A shell variable gives a value a name in the current shell. In PATH="$PATH:...", $PATH expands the current value; double quotes keep the assignment together. Shell variables and quoting explain this in more detail. A shell variable belongs to the shell. Exporting it makes its value available to newly started child processes in their environment; children cannot change their parent’s environment. For a temporary, safe PATH demonstration, start in a new empty disposable directory whose absolute path contains no colon. Assume the existing PATH is nonempty and has no empty components:
mkdir course-tools
printf '%s\n' '#!/bin/sh' 'printf "Tools ready\n"' > course-tools/course-greeting
chmod u+x course-tools/course-greeting
export PATH="$PATH:$PWD/course-tools"
command -v course-greeting
Appending preserves priority for existing directories. The quoted assignment keeps paths containing spaces together; a colon in a directory name would instead split the PATH entry. Only if the lookup reports the newly created file, enter course-greeting: it prints Tools ready. If lookup shows another command, do not run it; an earlier name takes precedence. Only add trusted directories: a writable or untrusted directory can supply commands you did not intend to run. An empty PATH component can mean the current directory, which is unsafe in an untrusted location.
The change affects this shell and its future children, not other open shells or future sessions. A new shell discards this temporary change. Persistent settings depend on the shell and its startup mode; inspect and back up the relevant configuration before editing it. Never source an untrusted configuration file.