Running executables in Red Had
I am kind of new to Linux. I am running Red Hat 8.0.
To run a executable you type ./<file> Is there a way where you can run the executable by just typing the file name.
./a.out ----> a.out
yes there is a way to do this.
the './' in './<filename>' means to look in the current directory (.) and execute the file. when you run commands like 'ls' or 'man' the reason you dont have to specify their full path is because the computer knows where it is. there is a environment variable when your logged in called $PATH. the computer (shell) knows about this variable, and inside the variable is a list of paths to folders where the computer will look when you run commands. when you run a command like 'ls', the path to that is stored in this variable, and the shell checks the list of variables looking for the file/command (ls) and then knows how to execute it/where it is.
you can view your current path variable by typing 'echo $PATH', i believe, at the console. the list is colon delimited.. meaning its a long list and each entry is seperated by colons.
search yahoo or google for how to modify your path variable, if need be.
i read in a linux book i had last year for school that if you put your current path (.) in the $PATH variable it is a security risk.
if its just one filename/path you want to add then, read up about how to add it, and try it! but dont put '.' in the path variable.
If you just want to type the filename, then you need to have that directory in your PATH. To see your current path and add a new directory: (edited for brevity)
|All times are GMT -5. The time now is 04:38 PM.|