01-28-2008
8,
0
Join Date: Jan 2008
Last Activity: 12 August 2008, 9:30 AM EDT
Posts: 8
Thanks Given: 0
Thanked 0 Times in 0 Posts
Have I heard "newbie"?
Please, don't feel uncomfortable with this: from what I've read (posts and replies), almost everybody here can be considered as a newbie...
I guess that most of your preceeding experience with programming has taken place on a Windows platform (the EXE, file extension, ...).
Basically (as you might know), filesystems of distinct platforms might be very different.
Remember you're entering a different area with Linux; concerning your request,
I will say "the file extension 'concept' has been trashed for this platform!".
On Linux (or Unix), a file (or a directory) is restricted to a limited number of people (you, the members of your group and the others);
in addition, this is applied for the 3 following kinds of privilege:
. read,
. write,
. execute.
Let's take a example...
Suppose you are into a directory named '/private_data/test', within which
you have stored 3 files:
. readme.txt, (some documentation)
. test.c, (a C source file)
. test (the resulting binary)
me@my_machine> # Where am I?
me@my_machine> pwd
/
me@my_machine> # Go to the test directory
cd /private_data/test
me@my_machine> # What is the content of this directory?
me@my_machine> ls -l
total 14
-rw-r--r-- 1 me my_group 18933 Jan 27 20:16 readme.txt
-rw-r--r-- 1 me my_group 3393 Jan 20 12:00 test.c
-rwxr-xr-- 1 me my_group 24938 Jan 28 15:03 test
Meaning of the '-rwx...':
r (Read) privilege
w (Write) privilege
x (eXecute) privilege
-rwxr-xr-- 1 me my_group 24938 Jan 28 15:03 test
... # 'u': for you, the current User ('me')
... # 'g': for the Group you belong to ('my_group')
... # 'o': the Others
For the '-rwxr--r-- 1 me my_group 24938 Jan 28 15:03 test' item, this means:
. you own the 'test' file,
. you have RWX privileges on it,
. your group has RX privileges on it,
. the others have only R privilege on it,
You can for instance change the privilege of a specific file by using the 'chmod' command:
me@my_machine> chmod o-r test.c # or chmod 640 test.c
me@my_machine> ls -l
-rw-r--r-- 1 me my_group 18933 Jan 27 20:16 readme.txt
-rw-r----- 1 me my_group 3393 Jan 20 12:00 test.c
-rwxr-xr-- 1 me my_group 24938 Jan 28 15:03 test
me@my_machine> # The people outside of your group cannot read anymore the test.c file!
I guess you should know now how to make a file executable (the answer is 'chmod u+x my_file' of course).
Hope it helps,
C.