Originally Posted by munyung
what i wanna know is how does linux know all the programs at the command line?
Simply put it doesn't? It's the shell that finds out what commands it has, there are some commands what will be directly run by the shell itself or commands it finds by the environmental variables (ie PATH for Bash), you can do "echo $PATH" to find the currently assigned paths for the shell session, as not all users have the same paths (root has considerably different defaults paths to a normal user).
As far as the OS goes, it's the layer that supplies the middle ground between the hardware and the software... so "Linux" as in the Kernel does not know what's being run, or what it's doing, it just runs it... I guess that's a simplistic way to put it. The shell is what knows where commands are.