• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

I have tons of linux questions?

pitupepito2000

Golden Member
As I am reading a linux book, a lot of questions arose, and I figured I should post them here so the knowledgeable gurus could answer it, and other could benefit from the answes. So here I go:

1. What is the difference between line feed and return?
2. can there be more than one filesystem per partition?
3. what are the init, inittab, and rc files?
4. are tape drives everg going to come back?
5. do vitural consoles (alt-f1) only work with eht left alt key of the keyboard?
6. does ls treat files different than directories?
7. what is the .Xdefaults and what does it do?
8. why does linux create a new group everytime you create a new user?
9. what is the real technical definition for a simbolic link? In other words, how do they work?
10. what shell of the many that are available would be a good idea to get familiar with and why?
11. what does POSIX-compliant mean?
12. what is the difference between tcsh and csh?
13. how does proc work? I know what it is, but how do the internals and guts of it work?


Thanks for answering the questions,
pitupepito.
 
If somebody cared, the book that I was reading that made me think of allt these questions is "Running Linux" by O'reilly.

Answers that I have figured out so far:

2. yes it is possible, with something called disklabels. Disklabel is an advanced partition-table inside a partition. It would require to reformat the disk, but if you do that you may as well create the partitions that you want with the filesystems in them that you want.
 
Good questions! some of them are beyond the scope of a quick answer and probaly better off doing some serious reading (like proc). here are some quick answers

4. are tape drives everg going to come back?

not sure what you mean, but i use plenty of them...

8. why does linux create a new group everytime you create a new user?

those are personal groups and only a few distros do them. RH does, but gentoo doesnt. not sure why that is so, maybe some distros want to set a seperate initial group besides users? still dont know why they would want to do that tho.

9. what is the real technical definition for a simbolic link? In other words, how do they work?

# man ln
http://www.hmug.org/man/1/ln.html

10. what shell of the many that are available would be a good idea to get familiar with and why?

i use bash, i think thats the default of most distros. its flexible and has easy to use syntax.

11. what does POSIX-compliant mean?

posix is set of OS interface and operational standards (created by ISO and others). i think of it as a set of general guidelines on how a *nix OS should work.

dont think my answers were too helpful, im sure others on here can break it down for u better.
 
Originally posted by: pitupepito2000
As I am reading a linux book, a lot of questions arose, and I figured I should post them here so the knowledgeable gurus could answer it, and other could benefit from the answes. So here I go:

1. What is the difference between line feed and return?

Not sure what you mean. A line return is a \n symbol at the end of lines that the console/text editor/word proccessor interprets as a end of a line. I think DOS/Windows uses a \r\n and MacOS can use either. Sometimes you need to translate text files from one format to another.
2. can there be more than one filesystem per partition?

What do you mean? Like running Ext3 and XFS at the same time on the same partition?

Well then no you can't.
3. what are the init, inittab, and rc files?

They are parts of the start up scripts for Linux. Most Linux distros use what is called System-V init scripts.

Init is the first program that is started by the kernel. Each program has a parent-child relationship. Say you open a xterm, and you use that Xterm to open Mozilla. Well then Xterm would be the parent and Mozilla is the child.

init is the parent of ALL the proccesses. Those scripts tell init when and how to start what program in order to get your OS started. They are BASH scripts in Linux and you can see them and edit them to suit you, but most of the time it's easier to let the OS manage them. There is usually a rc.local or whatnot that you can stick in your own scripts and commands so that you don't have to go thru all the effort of following the startup script conventions.

To see the parent child relationships do a "ps -AH" (probably only works with the GNU's version of ps). You'll see that Init is "0" Which is the first number this signifies that it is the very first program to start.

4. are tape drives everg going to come back?

They never realy went anywere. I use tape drives everyday (cause I am a tape monkey). But it's hard when you can get 100gig harddrive for less then a hundred bucks.

So unless somebody does some serious technological breakthru (like create cheap optical tape or something) tapes are going to become more and more rare.

Price is not on their side. The main advantage of tapes is that they have ABSOLUTELY MASSIVE amounts of aviable surface area compared to size.

5. do vitural consoles (alt-f1) only work with eht left alt key of the keyboard?

Don't know. Something to do with the keymap.

6. does ls treat files different than directories?

Yes. To me ls is a bit brain-dead, but people ared use to it. If you do a general "ls" it will show directories the same way as files. Maybe a different color if you have them enabled.

If you do a "ls filename" it will show that filename, if you do "ls directory" it will show the contents of that directory.

To make it treat directories like files you do a "ls -d directory".

7. what is the .Xdefaults and what does it do?

Stores the defaults configs of different X apps. Kinda obsolete I guess.

8. why does linux create a new group everytime you create a new user?

Because that's the default behavior of your adduser script or gui program. All my users belong to the users group.

9. what is the real technical definition for a simbolic link? In other words, how do they work?

File themselves are nothing but a bunch of ones and zeros on the harddisk. Directories are files, too, but they are special because they contain information called metadata that is information about information. Like filenames, pointers, permissions, etc etc.

For instance if you have a hiccup like a power surge or blackout and one of the directories get corrupted or dissapeers, then all the filenames and information about the files that it contained will be gone. However the fsck may recover the actual file, but the filename and permission information will be gone.

The directories contain "Links" that point out to the OS the location and sizes of the actual file on the physical harddrive.

A hard link is that pointer and is use to allow the file to be abstractly represented when you navigate the directories.

A file can have many pointers, but only NEED one. A hard link creates a real tangable representation of that file to the filesystem. You delete the hard link, you delete the file. You can have several hard links, but they can only be on the same partition of that actual file.

For instance you can "move" files. The mv command will create a new hard link, check it, and then delete the original hard link and "move" it to another directory (without ever touching the original file or moving any bits around). But if your moving from partition to partition "mv" then has to copy the information from one partition to another and then create the hard link for the new copy of the file and then delete the old hardlink for the original file, thus "deleting" the original file. That's why mv's within a filesystem is super-fast, but from partition to partition it takes much more time.

A symbolic link is a a pretend hard link. It creates a simple file that redirects the attention of the OS to the actual file everytime you access it. You delete the symbolic link, the original file is unmolested.

10. what shell of the many that are available would be a good idea to get familiar with and why?

I like BASH.

11. what does POSIX-compliant mean?

It's a set of standards for operating systems. Mostly Unix stuff, the higher level 2 OSes are in Posix compliance then the easier it would be to port applications from one OS to the other.

There are different POSIX standards and they change over time and they cost money to look at. Linux is semi/mostly-Posix compliant.

12. what is the difference between tcsh and csh?

not to sure. I think they created one to replace the other due to liscencing/legal issues

13. how does proc work? I know what it is, but how do the internals and guts of it work?

it's information is populated by the kernel. I don't know the technicalities of it, but it's a "pretend" file system.

I unix everything is files, They aren't REAL files in /dev and /proc like that are stored in the home directory, but by creating this abstract version of files and directories it makes it easier for people to deal with it and programs to be made to handle it.

Basicly you don't need to understand how it works to use it, that's what /dev files and /proc information is about.

The information that is their is a bit hodge-podge. It just sort of evolved over time and whatever people thought was important they just found a place in the /proc directory to stick it.

Another new one for kernel 2.6 is sysfs found in the /sys directory. (you can make it and mount it if it doesn't exist by default and your using 2.6). It's a attempt to create a coherent way to show kernel information/controls as files. Also possible replacement for /dev file system.

Thanks for answering the questions,
pitupepito.

I try. But if your curious google and vivisimo is your friend. Plenty of times I am dead wrong about a lot of stuff.
 
2. can there be more than one filesystem per partition?

No, in the same manner that an image can't be a JPG and a GIF at the same time a partition has one filesystem and that's it.

4. are tape drives everg going to come back?

As drag said, they never left. All of our backups at my company, and all companies I know of, are done to tape. We have pretty much every kind of tape you can imagine from huge 8-track looking things that hold 100M to SDLTs that hold 100G or so native. My numbers may be off, I don't deal directly with the tapes very often.

5. do vitural consoles (alt-f1) only work with eht left alt key of the keyboard?

Seems so, I never really noticed.

8. why does linux create a new group everytime you create a new user?

Linux never creates any groups, the adduser/useradd scripts you run does that. And it's a policy most Linux distributions have adopted for security. RedHat calls it "user private groups" and is described here: http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/ref-guide/s1-users-groups-private-groups.html

9. what is the real technical definition for a simbolic link? In other words, how do they work?

Basically a symbolic link is just a shortcut to another file, it's sole contents in the filesystem is the filename that it points to.

10. what shell of the many that are available would be a good idea to get familiar with and why?

Bash is the default on every Linux system I've seen, most commercial unixes have atleast a standard bourne shell (not nearly as featurfull as bash), a korn shell and usually a C shell.

13. how does proc work? I know what it is, but how do the internals and guts of it work?

If you really want to know what drives /proc (and in 2.6 /sys) files you'll need to start reading the kernel source. Basically when you read a file in /proc or /sys the kernel executes a function and prints the value it returns and when you write to a file it executes a function that changes that value (not all are writable though) in the running kernel. Any changes made in /proc or /sys are volatile and aren't saved across a reboot unless you have a script or use sysctl to have them set on every bootup.
 
Originally posted by: pitupepito2000
1. What is the difference between line feed and return?
2. can there be more than one filesystem per partition?
And:
2. yes it is possible, with something called disklabels. Disklabel is an advanced partition-table inside a partition. It would require to reformat the disk, but if you do that you may as well create the partitions that you want with the filesystems in them that you want.

Basic definition of disklabel (taken from OpenBSD's disklabel(5)):Each disk or disk pack on a system may contain a disk label which provides detailed information about the geometry of the disk and the partitions into which the disk is divided.

But there can really only be one filesystem per partition. Slices make things interesting, but I don't think Linux uses them and FFS/UFS is generally the only worthwhile filesystem on BSD.

3. what are the init, inittab, and rc files?

init is the beginning. inittab helps give init defaults to work with. rc is the startup script for *BSD. /etc/rc?.d is generally where the startup scripts are kept for SysV (really in /etc/init.d, but this is just for convenience and really has no technical standing as far as I can tell).

4. are tape drives everg going to come back?

They are alive and kicking, just not in homes generally.

5. do vitural consoles (alt-f1) only work with eht left alt key of the keyboard?

Never tried it with the ones on the right. You can probably change this functionality with keymappings.

6. does ls treat files different than directories?

No, directories are files. Everything on Unix-like systems is a file.

7. what is the .Xdefaults and what does it do?

This is not obsolete. It is still alive and kicking. I have used it, and will use it again once I get time to play around with systrace more, but generally this is ignored by users.

8. why does linux create a new group everytime you create a new user?

Helps with permissions.

9. what is the real technical definition for a simbolic link? In other words, how do they work?

Know what a shortcut is in Windows? It's sorta like that.

10. what shell of the many that are available would be a good idea to get familiar with and why?

Bourne, Korn, or C. Why? Because they were standards before Linux came around. I don't think there is a Unix-like system out there without these shells, except for maybe Linux. And /bin/sh in Linux is not bourne compatible. bash if you have no other choice.

bash is fine for most people, don't get me wrong. I don't personally like it, but that has more to do with the fact I have been bitten by its incompatibilities before. If you learn bourne, you can port to bash without much issue, in fact it is compatible enough that most things work without issue.

11. what does POSIX-compliant mean?

It's a standard put in place by the US government. Almost(?) no systems adhere to it perfectly. Windows NT was POSIX compliant enough to pass the POSIX tests at the time, but couldn't do much else.

12. what is the difference between tcsh and csh?

They are different implimentations of the same shell. tcsh added some features not in csh. I believe you will generally find tcsh on free Unix-like systems. pdksh is generally the accepted open source replacement for the formerly unfree ksh (I haven't reviewed ksh's license though, so it may still be unfree...).

13. how does proc work? I know what it is, but how do the internals and guts of it work?

Too advanced for me. I don't like /proc, so I don't use it unless I have to (Open Office seems to require it).

Most of these answers could have been found by digging through a man page or two (on a system that cares about documentation). Please keep track of the answers, write them up as well as you can, and maybe we can make a mini-FAQ or something out of it 😉
 
Originally posted by: Nothinman
If you really want to know what drives /proc (and in 2.6 /sys) files you'll need to start reading the kernel source. Basically when you read a file in /proc or /sys the kernel executes a function and prints the value it returns and when you write to a file it executes a function that changes that value (not all are writable though) in the running kernel. Any changes made in /proc or /sys are volatile and aren't saved across a reboot unless you have a script or use sysctl to have them set on every bootup.

Sounds like a different implementation of sysctl. Any comments? Does that question sound like an a-holish news reporter?

EDIT: General sysctl information (in case anyone doesn't know):

NAME
sysctl - get or set kernel state

DESCRIPTION
The sysctl utility retrieves kernel state and allows processes with appropriate privilege to set kernel state. The state to be retrieved or set is described using a ``Management Information Base'' (MIB) style name, described as a dotted set of components.
 
\r is carriage return, \n is line feed. on unix, \n is used for line endings. on windows, \r\n is. on classic mac os, \r is. which of these the enter key puts into text completely depends on what software you're using. if you're using unix, it'll probably insert a \n, and so on.
 
No, directories are files. Everything on Unix-like systems is a file.

Even so ls does treat them specially, if you run 'ls -l file' it gives you the long listing of that file but if you run 'ls -l direcotry' it gives you a long listing of the contents of the directory.

Sounds like a different implementation of sysctl. Any comments? Does that question sound like an a-holish news reporter?

On Linux sysctl really just wrote to /proc/sys so sort-of. /sys is the beginning of the seperation of all the random files in /proc and process information, the end result should be that /proc is just process information and /sys holds the tunable sysctl stuff, but /proc will probably be a combo for a while longer for backwards compatibility atleast until 2.7 is opened.
 
Originally posted by: Nothinman
No, directories are files. Everything on Unix-like systems is a file.

Even so ls does treat them specially, if you run 'ls -l file' it gives you the long listing of that file but if you run 'ls -l direcotry' it gives you a long listing of the contents of the directory.

I think we may be splitting hairs. 😛

Sounds like a different implementation of sysctl. Any comments? Does that question sound like an a-holish news reporter?

On Linux sysctl really just wrote to /proc/sys so sort-of.

Different ways to do the same thing. Basically 😉

/sys is the beginning of the seperation of all the random files in /proc and process information, the end result should be that /proc is just process information and /sys holds the tunable sysctl stuff, but /proc will probably be a combo for a while longer for backwards compatibility atleast until 2.7 is opened.

That sounds more complicated to me.
 
I think we may be splitting hairs.

Probably, but in reality ls does treat them differently. For everything but directories it basically does stat(file) and gives you the results but on a directory it does opendir(directory) then does stat(file) on all the contained files and gives the results of the stat.

Different ways to do the same thing. Basically

Yes, the idea is to get the same userland interface but have the sysctl do magic in the background, on the bsds it probably use ioctl to set parameters but on Linux it just uses echo blah /proc/sys/blah.

That sounds more complicated to me.

Well a lot of people think all the extra crap in /proc shouldn't be there but they like the availabiliy of it, I mean do any of the BSDs have anything similar to /proc/cpuinfo or /proc/meminfo? And now /sys is being used by the hotplug stuff which drives udev so it's pretty much guaranteed to be here for a while.
 
Originally posted by: Nothinman
I think we may be splitting hairs.

Probably, but in reality ls does treat them differently. For everything but directories it basically does stat(file) and gives you the results but on a directory it does opendir(directory) then does stat(file) on all the contained files and gives the results of the stat.

Point taken.

Different ways to do the same thing. Basically

Yes, the idea is to get the same userland interface but have the sysctl do magic in the background, on the bsds it probably use ioctl to set parameters but on Linux it just uses echo blah /proc/sys/blah.

Word. I don't know how it works off hand.

That sounds more complicated to me.

Well a lot of people think all the extra crap in /proc shouldn't be there but they like the availabiliy of it, I mean do any of the BSDs have anything similar to /proc/cpuinfo or /proc/meminfo? And now /sys is being used by the hotplug stuff which drives udev so it's pretty much guaranteed to be here for a while.

Finding stuff in /proc can be a pain, but a lot of that probably has to do with the fact I don't know what I'm looking for. 😉

dmesg gives a lot of information about the hardware. In fact, I think OpenBSD's (I haven't looked through the dmesg for FreeBSD in a long time, and I didn't have NetBSD installed long enough to get a feel for it) dmesg is superior to Linux's. A friend of mine was having difficulties with his wireless card, I plugged it into my laptop, booted up, and we found out which chipset it was using one command later. I don't know if Linux's dmesg shows that information, but I don't remember ever seeing it.

Over all, I don't know what's in cpuinfo and meminfo though, so I can't say for sure. Maybe I'll check it out in the morning when I get home.
 
Finding stuff in /proc can be a pain, but a lot of that probably has to do with the fact I don't know what I'm looking for.

Well that's one of the things sysfs is supposed to clean up too.

dmesg gives a lot of information about the hardware.

Yes, but only until that buffer is overwritten.

I think OpenBSD's (I haven't looked through the dmesg for FreeBSD in a long time, and I didn't have NetBSD installed long enough to get a feel for it) dmesg is superior to Linux's.

It's all dependent on what the drivers print, dmesg just shows what's in the kernel log buffer.

A friend of mine was having difficulties with his wireless card, I plugged it into my laptop, booted up, and we found out which chipset it was using one command later. I don't know if Linux's dmesg shows that information, but I don't remember ever seeing it.

Again that's the driver writer's decision, I have a Linksys WPC11 which is PCMCIA and I believe both the orinoco_cs and prism2_cs (in wlan-ng) print the chipset when they load and you can use cardctl to have the PCMCIA manager print some info about the inserted cards whether they have drivers or not sort of like lspci.

Over all, I don't know what's in cpuinfo and meminfo though, so I can't say for sure. Maybe I'll check it out in the morning when I get home.

cpuinfo varies for architecture, but meminfo is consistent.

One entry from cpuinfo on my dual athlon workstation:
processor : 1
vendor_id : AuthenticAMD
cpu family : 6
model : 6
model name : AMD Athlon(tm) Processor
stepping : 2
cpu MHz : 1194.770
cache size : 256 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse syscall mp mmxext 3dnowext 3dnow
bogomips : 2383.87

Meminfo from the same machine:

MemTotal: 1034676 kB
MemFree: 19908 kB
Buffers: 11168 kB
Cached: 647020 kB
SwapCached: 19568 kB
Active: 661752 kB
Inactive: 288244 kB
HighTotal: 131072 kB
HighFree: 256 kB
LowTotal: 903604 kB
LowFree: 19652 kB
SwapTotal: 1060172 kB
SwapFree: 1010564 kB
Dirty: 12 kB
Writeback: 0 kB
Mapped: 613528 kB
Slab: 36148 kB
Committed_AS: 667624 kB
PageTables: 2100 kB
VmallocTotal: 114680 kB
VmallocUsed: 21372 kB
VmallocChunk: 93192 kB
HugePages_Total: 0
HugePages_Free: 0
Hugepagesize: 4096 kB
 
Originally posted by: Nothinman
Finding stuff in /proc can be a pain, but a lot of that probably has to do with the fact I don't know what I'm looking for.

Well that's one of the things sysfs is supposed to clean up too.

That's what it sounded like.

dmesg gives a lot of information about the hardware.

Yes, but only until that buffer is overwritten.

/var/run/dmesg.boot or whatever.

I think OpenBSD's (I haven't looked through the dmesg for FreeBSD in a long time, and I didn't have NetBSD installed long enough to get a feel for it) dmesg is superior to Linux's.

It's all dependent on what the drivers print, dmesg just shows what's in the kernel log buffer.

There was no driver for this card.

A friend of mine was having difficulties with his wireless card, I plugged it into my laptop, booted up, and we found out which chipset it was using one command later. I don't know if Linux's dmesg shows that information, but I don't remember ever seeing it.

Again that's the driver writer's decision, I have a Linksys WPC11 which is PCMCIA and I believe both the orinoco_cs and prism2_cs (in wlan-ng) print the chipset when they load and you can use cardctl to have the PCMCIA manager print some info about the inserted cards whether they have drivers or not sort of like lspci.

But what does it spit out if there is no driver loaded for the card? How do you find out what driver to load for a particular card you are unfamiliar with if you have no access to google.com or other sites?

Over all, I don't know what's in cpuinfo and meminfo though, so I can't say for sure. Maybe I'll check it out in the morning when I get home.

cpuinfo varies for architecture, but meminfo is consistent.

One entry from cpuinfo on my dual athlon workstation:
processor : 1
vendor_id : AuthenticAMD
cpu family : 6
model : 6
model name : AMD Athlon(tm) Processor
stepping : 2
cpu MHz : 1194.770
cache size : 256 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse syscall mp mmxext 3dnowext 3dnow
bogomips : 2383.87

I believe I get most, if not all of that information in dmesg, except for bogomips. I'm pretty sure that isn't included.

Meminfo from the same machine:

MemTotal: 1034676 kB
MemFree: 19908 kB
Buffers: 11168 kB
Cached: 647020 kB
SwapCached: 19568 kB
Active: 661752 kB
Inactive: 288244 kB
HighTotal: 131072 kB
HighFree: 256 kB
LowTotal: 903604 kB
LowFree: 19652 kB
SwapTotal: 1060172 kB
SwapFree: 1010564 kB
Dirty: 12 kB
Writeback: 0 kB
Mapped: 613528 kB
Slab: 36148 kB
Committed_AS: 667624 kB
PageTables: 2100 kB
VmallocTotal: 114680 kB
VmallocUsed: 21372 kB
VmallocChunk: 93192 kB
HugePages_Total: 0
HugePages_Free: 0
Hugepagesize: 4096 kB

Don't know where to get all of this information, but I can't think of a single place.
 
Normally I say that proc is bad and I hate it and blah blah blah. I am grumpy today, but for some reason I don't feel like saying that stuff.

Just wanted to mention it. 😉

Oh, and IIRC, FreeBSD does use a /proc filesystem by default.
 
But what does it spit out if there is no driver loaded for the card? How do you find out what driver to load for a particular card you are unfamiliar with if you have no access to google.com or other sites?

If no driver loads nothing is printed, if it's PCMCIA cardctl can show you the info on the card and if it's PCI you can use lspci but you have to find what driver is needed on your own.

I believe I get most, if not all of that information in dmesg, except for bogomips. I'm pretty sure that isn't included.

Well bogomips is irrelevant anyway, IIRC it was used in 2.2 and maybe 2.4 for kernel timing but it's not any more and IIRC again it's only calculated at all now because people cried when it was taken out. I mean hell, the bogo stands for bogus.

It's not. I'm pretty sure all of the BSDs store it in /var/run/dmesg.boot .

It can get overwritten, if it's stored in a file on bootup is irrelevant. But, yes I did just look on a FreeBSD 4.9 box and there is a dmesg.yesterday and dmesg.today in /var/log although neither is dated for those days so the names are a little misleading.

Oh, and IIRC, FreeBSD does use a /proc filesystem by default.

Yes, but it's only process information and nothing else.
 
/proc does kinda such.


I am hoping sysfs will be uber-full.


One of the cool things I like about sysfs is that you can now write drivers for new hardware to use it instead of depending on /dev major and minor numbers.

For instance could you imagine populating the /dev file with a couple hundred SATA drives in a big network disk storage array setup? The kernel can only handle so many major/minor number nodes and once they are assigned for something they can't be used for anything else if you want to maintain compatability. With sysfs you just setup the driver to populate a directory in the /sys directory with all the drives and you can (I am guessing) symbolicly link them to /dev/ files if you want.

With my laptop I can control the speed of the proccessor by echo'ng the speed I want into a /sys file.

A article I read had a guy (for illistration about USB programming) programmed a kernel driver for a simple little USB light-up device. It had 3 LEDs and was designed to provide indicator lights for a computer. I suppose you could use it to tell you when a download finished or something. whatever

Well he ended up making a directory somewhere inside of /sys that had 3 files: red, green, and blue. Each corrisponded to a different colored LED light.

You could just "echo -n 1 > red" to light up the red LED and "echo -n 0 > red" to turn it off.

Something interesting and sys looks a lot more conveinent to use, then the hodge-podge that is the /proc directory.
 
Originally posted by: drag
/proc does kinda such.


I am hoping sysfs will be uber-full.


One of the cool things I like about sysfs is that you can now write drivers for new hardware to use it instead of depending on /dev major and minor numbers.

For instance could you imagine populating the /dev file with a couple hundred SATA drives in a big network disk storage array setup? The kernel can only handle so many major/minor number nodes and once they are assigned for something they can't be used for anything else if you want to maintain compatability. With sysfs you just setup the driver to populate a directory in the /sys directory with all the drives and you can (I am guessing) symbolicly link them to /dev/ files if you want.

With my laptop I can control the speed of the proccessor by echo'ng the speed I want into a /sys file.

You can do that with sysctl on some laptops under OpenBSD.

A article I read had a guy (for illistration about USB programming) programmed a kernel driver for a simple little USB light-up device. It had 3 LEDs and was designed to provide indicator lights for a computer. I suppose you could use it to tell you when a download finished or something. whatever

Well he ended up making a directory somewhere inside of /sys that had 3 files: red, green, and blue. Each corrisponded to a different colored LED light.

You could just "echo -n 1 > red" to light up the red LED and "echo -n 0 > red" to turn it off.

Something interesting and sys looks a lot more conveinent to use, then the hodge-podge that is the /proc directory.

This all sounds like it is going to require reworking drivers and the way people understand the system now. I hope they have good plans for backwards compatibility.
 
Originally posted by: Nothinman
But what does it spit out if there is no driver loaded for the card? How do you find out what driver to load for a particular card you are unfamiliar with if you have no access to google.com or other sites?

If no driver loads nothing is printed, if it's PCMCIA cardctl can show you the info on the card and if it's PCI you can use lspci but you have to find what driver is needed on your own.

That's kind of silly. In my dmesg I get information about all of the hardware in the system, whether there is a driver for it or not. Makes life a lot easier.

I believe I get most, if not all of that information in dmesg, except for bogomips. I'm pretty sure that isn't included.

Well bogomips is irrelevant anyway, IIRC it was used in 2.2 and maybe 2.4 for kernel timing but it's not any more and IIRC again it's only calculated at all now because people cried when it was taken out. I mean hell, the bogo stands for bogus.

It's not. I'm pretty sure all of the BSDs store it in /var/run/dmesg.boot .

It can get overwritten, if it's stored in a file on bootup is irrelevant. But, yes I did just look on a FreeBSD 4.9 box and there is a dmesg.yesterday and dmesg.today in /var/log although neither is dated for those days so the names are a little misleading.

If it is saved to a file on bootup, you get the information you are looking for. And it only costs you about 10 key strokes.

Oh, and IIRC, FreeBSD does use a /proc filesystem by default.

Yes, but it's only process information and nothing else.

Ok.
 
Originally posted by: Nothinman

It's not. I'm pretty sure all of the BSDs store it in /var/run/dmesg.boot .

It can get overwritten, if it's stored in a file on bootup is irrelevant. But, yes I did just look on a FreeBSD 4.9 box and there is a dmesg.yesterday and dmesg.today in /var/log although neither is dated for those days so the names are a little misleading.

What do you mean it can get overwritten? Anything *can* get overwritten, but that doesn't mean that you can't rely on them being there (assuming some nut doesn't screw up your machine, but then I doubt dmesg will be your biggest concern if that happens).
 
This all sounds like it is going to require reworking drivers and the way people understand the system now. I hope they have good plans for backwards compatibility.


From what I understand there realy isn't much difference needed on the driver-level itself.

And for backwards compatability is fine for now, the new stuff from /sys and the old stuff are not mutually exclusive. For a while on my laptop I was using sysfs + udev + hotplug to handle modules and device nodes automaticly, and I could reboot into a 2.4 kernel and everything still worked, just minus the new conviences.
 
Originally posted by: drag
This all sounds like it is going to require reworking drivers and the way people understand the system now. I hope they have good plans for backwards compatibility.


From what I understand there realy isn't much difference needed on the driver-level itself.

And for backwards compatability is fine for now, the new stuff from /sys and the old stuff are not mutually exclusive. For a while on my laptop I was using sysfs + udev + hotplug to handle modules and device nodes automaticly, and I could reboot into a 2.4 kernel and everything still worked, just minus the new conviences.

Ok, I guess I don't fully understand then. I'll have to do digging into /sys and what is intended with it in the future. It just seems like replacing /dev is going to make a lot of commands different in the future.
 
Originally posted by: n0cmonkey
Originally posted by: drag
This all sounds like it is going to require reworking drivers and the way people understand the system now. I hope they have good plans for backwards compatibility.


From what I understand there realy isn't much difference needed on the driver-level itself.

And for backwards compatability is fine for now, the new stuff from /sys and the old stuff are not mutually exclusive. For a while on my laptop I was using sysfs + udev + hotplug to handle modules and device nodes automaticly, and I could reboot into a 2.4 kernel and everything still worked, just minus the new conviences.

Ok, I guess I don't fully understand then. I'll have to do digging into /sys and what is intended with it in the future. It just seems like replacing /dev is going to make a lot of commands different in the future.

Ya I don't quite understand it fully either.

Anyways /dev/ will be around for a long long time.

Right now /dev files will be handled by a combination of udev, hotplug, and sysfs. You plug a device in hotplug system will notice it. Or hotplug gets a "fake hotplug" notification stored from initrd during bootup. Hotplug looks up the device and loads the module needed for it.

Udev then notices the newly populated directories in the /sysfs file created by loading the module then it populates the /dev/ directory with corrisponding files, either linking them from the /sys file or created the major/minor nodes and giving it a filename. Depending on the driver I suppose.

Since everything is moved to userspace then all the behavior of any other these deamons or programs can be modified by editing /etc/ config files (so you could have legacy IDE devices use /dev/ major/minor numbers and nice new USB or SATA drives use links from /sys). So you could update them or add new devices detection and managment commands to them.

Then conceivably you would have some futuristic deamon from FreeDesktop.org watching the /sys directory and communicating with udev to notify the desktop user that a new device has been configured and installed for them, or telling them how to go about finding drivers and installing them thru nifty wizards and whatnot if it can't find the driver for it. Also you could use this same stuff to launch programs that corrispond to different hardware.

Like if you were to plug in your Sony Handycam into the firewire port it your computer would notice it, load the module/driver for it, configure the corrisponding /dev/ file and then launch a movie editing application (or more probably just spit out a notification on a taskbar applet) on your desktop. All automagicly.

And thus providing a way for Linux to compete head to head with other desktop OSes on the free market. (well at least that's the idea)

edit:
here is a link to Linux hotplugging if your curious
edit:
here is the link to the FreeDesktop.org counterpart, HAL. For hardware abstraction layer. Currently setup to use udev and sysfs/proc in Linux.
 
Back
Top