Archived

This topic is now archived and is closed to further replies.

pars

A Question about Linux Konsole (shell)

Recommended Posts

I have installed exactly the same version of linux (Mandrake 9.1) that we use in college at home. When I want to execute a compiled C++ program at college I just type the name of the executable file (eg. Test ). But to run the same executable file at home, I have to include "./" infront of the filename (that is ./Test ). Can you tell me why I have to do this and how to correct it. Many Thanks

Share this post


Link to post
Share on other sites
Unlike Windows, DOS, or OS/2, Unix does not implicitly include the current directory in the path. This is seen as a security issue, because, otherwise, a executable foo in the current directory would be run instead of one you expect to be run called foo that''s explicitly in the path. Therefore, you must specify either the full or relative path (which would be the ./ bit). If you really want to know how to do it, there are Unix FAQs out there that will tell you.

Share this post


Link to post
Share on other sites
quote:
Original post by C-Junkie
ever notice the everything unix forum?

Probably should be there, shouldn''t it? Makes more sense than it being in General Programming. Even though it''s already been answered, I''ll move it...

Share this post


Link to post
Share on other sites
quote:
Original post by pars
Can you tell me why I have to do this and how to correct it.



This is standard behaviour - you would technically be breaking something that is already correct (in Unix terms).

Share this post


Link to post
Share on other sites
Including it in the path is a very bad security practice, since people can put various executables, like "ls" in various directories, so if you type "ls" you will execute that program, instead of the real ls, which is somewhere in /usr/bin or wherever it is.
While this is fine if it is a single user machine, on a multi user machine, where you don''t trust the others, it is a very bad idea to do that.

Height Map Editor | Eternal Lands | Fast User Directory

Share this post


Link to post
Share on other sites