LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Six Basic Linux Questions from a Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/six-basic-linux-questions-from-a-newbie-440762/)

butters88 05-01-2006 11:47 PM

Six Basic Linux Questions from a Newbie
 
Hey everyone, I'm really new to Linux and I just had a few really basic general questions to ask. I'm sorry if these questions are answered somewhere else but I couldn't find them. If you could point me to a good site for these sorts of questions then I'd appreciate that too.

1) What is a regular file on a Linux system? What sorts of regular files can exist and what values can the bytes within each have?

2) On Windows, most of the time when you install an application all its relevant files go in the same directory (ie. under Program Files\whatever), how is this different in Linux?

3) In addition to the normal permission bits of a node (rwxrwxrwx) what is the 10th bit for and how is it special? What uses does the special bit have?

4) What does having write access allow you to do compared with write access on individual files? Does it give you write permissions on all files within? Or just the permissions to create new files?

5) What is an inode? What does it do? Are all the blocks which comprise an inode necessarily in the same physical location?

6) Is it possible to hardlink directories in Linux? Why/why not?

Thanks in advance, I know these are really stupid/simple questions, and I appreciate any answers you can give.

pixellany 05-02-2006 12:45 AM

Looks like homework to me.....

What distribution are you using? Do you have it up and running? Any issues?

nflenz 05-02-2006 12:57 AM

1) On Linux, everyhting is a file. Seriously even devices are files.

2) The executables are kept in /bin, /usr/bin, /local/bin, /usr/local/bin, /sbin, /usr/sbin
and probably more. I can't think of any right now. That might seem like over kill, but it is actually very well organized. I don't want to go into detail, but most of them will be stored in /usr/bin or /usr/local/bin. There will rarely (if ever) be a need for you to locate an executable.

3) The first bit specifies the file type.'-' is ordinary, 'd' is directory, 'l' is link.

4) When set for a directory, this permission grants the ability to modify its tree. This includes creating files, changing their permissions, and deleting files.

5) http://en.wikipedia.org/wiki/Inode

6) Yes... because it's convenient.

Simon Bridge 05-02-2006 01:01 AM

Quote:

Originally Posted by butters88
Hey everyone, I'm really new to Linux and I just had a few really basic general questions to ask. I'm sorry if these questions are answered somewhere else but I couldn't find them. If you could point me to a good site for these sorts of questions then I'd appreciate that too.

http://www.linuxvirgins.com/

Quote:

1) What is a regular file on a Linux system? What sorts of regular files can exist and what values can the bytes within each have?
A regular file is any which has no special role in the operating system. So it isn't, for eg, a directory, a link, or a block special device. Text files are regular files. The bytes inside each file can have any value from 0 to 256.

Quote:

2) On Windows, most of the time when you install an application all its relevant files go in the same directory (ie. under Program Files\whatever), how is this different in Linux?
In linux, it is usual for only the files directly concerned with only the program in question are in the same place. There are many shared programs and libraries, used by many applications, which will not be in the same directory at all. Shared stuff often ends up in /usr/share. System executables will end up in /sbin and user executables are often in /usr/bin ... but not always. This modular approach means you seldom get multiple instances of a sub-program installed simultaniously.

Quote:

3) In addition to the normal permission bits of a node (rwxrwxrwx) what is the 10th bit for and how is it special? What uses does the special bit have?
The tenth bit is at the beginning and specifies the file type. - is a regular file, d is a directory etc. See the chmod man page for details.

Quote:

4) What does having write access allow you to do compared with write access on individual files? Does it give you write permissions on all files within? Or just the permissions to create new files?
You mean, write access to what? A file system mounted rw will confer read/write access to all files therein. (see the chmod man page)

Quote:

5) What is an inode? What does it do? Are all the blocks which comprise an inode necessarily in the same physical location?
http://www.google.co.nz/search?hl=en...ition&ct=title
http://dict.die.net/inode/

Quote:

6) Is it possible to hardlink directories in Linux? Why/why not?
Yes. See the ln manpage for details.

Quote:

Thanks in advance, I know these are really stupid/simple questions, and I appreciate any answers you can give.
Most of what you want to know is on the web already. Google is your freind. But at least you are trying to understand.

If you have a question about what something is or means, type "definition <thing>" in the google searchbar. The definition will give you more search terms to the exact info you need.

questions about something associated with a command can usually be investigated through the linux man pages. Open a terminal and type "man <thing>" or "info <think>" to learn more.

Welcome to the community.

bosewicht 05-02-2006 01:54 AM

Sounds like homework to me

Simon Bridge 05-02-2006 02:26 AM

Ah... you mean we're being suckered!
Well we'll just traceroute the sucker and ... and ... tell on him! Waaah!

(You're only young once, but you can be immature for your whole life.)

Wim Sturkenboom 05-02-2006 03:58 AM

Quote:

Originally Posted by Simon Bridge
The bytes inside each file can have any value from 0 to 256.

:confused: 0 to 255 maybe :)

ioerror 05-02-2006 04:06 AM

Hmm, this does sound kinda like homework, but anyway...

Quote:

4) What does having write access allow you to do compared with write access on individual files? Does it give you write permissions on all files within? Or just the permissions to create new files?
I assume you mean write access to a directory? This gives you permission to "modify" the directory, i.e. create/delete files in it. But you cannot modify the files themselves unless you have write permission to those files. So if root creates a file in your home directory with 600 permissions, you can delete the file, but you can't edit it.

Quote:

Quote:
6) Is it possible to hardlink directories in Linux? Why/why not?
No, you cannot hard link directories. This would allow the creation of loops, which would screw up any program which accessed the filesystem (ls, fsck etc). The directory tree must be one-way, top to bottom. For example, if you had a directory /var/hardlink, which was hardlinked back to /var, then ls -R /var would get stuck in an infinite loop.

Simon Bridge 05-02-2006 04:39 AM

Quote:

Originally Posted by Wim Sturkenboom
:confused: 0 to 255 maybe :)

Yeah - I know of another mistake in my post ... can you spot it?

billymayday 05-02-2006 04:56 AM

You didn't mention what manpage to look at for starters (hardlink question)

ioerror 05-02-2006 05:12 AM

Quote:

You didn't mention what manpage to look at for starters (hardlink question)
I told you already, you can't hard link directories.

ioerror 05-02-2006 05:17 AM

From the man page for ln:

Quote:

GNU OPTIONS
-d, -F, --directory
Allow the super-user to make hard links to directories.
But this is irrelevant.

Quote:

# su
...
# ln . foo
ln: `.': hard link not allowed for directory
Above error message is printed by ln.
Quote:

# ln -d . foo
ln: creating hard link `foo' to `.': Operation not permitted
Error message printed by the kernel, ln tries to make the link but the kernel won't allow it.

Quote:

# strace ln -d . foo
...
lstat64(".", {st_mode=S_IFDIR|0755, st_size=48, ...}) = 0
lstat64("foo", 0xbfffe870) = -1 ENOENT (No such file or directory)
lstat64("foo", 0xbfffe870) = -1 ENOENT (No such file or directory)
link(".", "foo") = -1 EPERM (Operation not permitted)
...

billymayday 05-02-2006 05:43 AM

I was just responding to Simon's post ioerror

ioerror 05-02-2006 05:55 AM

Quote:

I was just responding to Simon's post ioerror
OK, just checking, half the time people seem to ignore me :confused:. ;)

Anyway, my above post shows that you cannot create hard links to directories. I believe that it was possible with ye olde unix (V6,V7 etc), but since it causes huge problems, it is now disallowed by the kernel (well, Linux at least, I assume all modern kernels are the same but I'm not sure).

butters88 05-02-2006 06:18 AM

Well I'm studying Linux at university and I've been using Fedora Core 4 on the lab computers. I haven't been able to set it up at home yet (so I don't know about compiling my own kernels or anything like that yet). Anyways I've just been learning the commands and I'm not very familiar with the workings of the OS, that's why I had several questions and thought this would be the best place to ask.

In regards to question 4, I meant does having write permissions on a directory give you write permissions on all files within as well as giving you permissions to create new files in the directory??


All times are GMT -5. The time now is 06:19 AM.