Quote:
Originally Posted by bilal_jan i read once on a site that Code: in linux everything is file,if it is not a file it is a process
i am not getting what this phrase means.
secondly is this an advantage of linux that here everything is file and how does this differ from windows
thanks |
The second part of that statement is false. The correct statement is:
Quote:
|
In linux, everything is a file
|
You just have to look at /proc to see the processes there as well:
Code:
# ls /proc/
1 20087 242 3725 3847 4131 912 driver mtrr
174 20088 243 3737 3868 4135 914 execdomains net
175 20093 244 3779 3870 4137 9325 filesystems pagetypeinfo
176 20094 2474 3781 3886 4141 9326 fs partitions
182 20097 27541 3782 3887 4145 9367 interrupts self
185 20098 27551 3784 3888 4175 9368 iomem slabinfo
196 20099 27554 3804 3889 4191 9370 ioports stat
19652 20113 27556 3805 3890 4193 969 irq swaps
197 22576 27558 3806 3916 4280 acpi kallsyms sys
2 22600 27560 3810 3917 4796 asound kcore sysrq-trigger
20078 22606 27565 3811 3933 5 buddyinfo kmsg sysvipc
20079 2378 27574 3812 3934 5027 bus kpagecount timer_list
20080 2379 27959 3813 3945 5030 cmdline kpageflags tty
20081 2380 27988 3814 3946 68 config.gz loadavg uptime
20082 2381 3 3815 3947 69 cpuinfo locks version
20083 2382 3683 3816 4 70 crypto meminfo vmstat
20084 239 3684 3817 4011 8928 devices misc zoneinfo
20085 240 3690 3818 4012 893 diskstats modules
20086 241 3699 3839 4016 895 dma mounts
All those numbers are the PIDs (process identification numbers) on my system right now.
The meaning of those words is very simple: anything that is physically or logically attached to your machine, and that the linux kernel can see, is represented as a file in your file system.
For example, your hard disks will be files into /dev, like /dev/hda, or /dev/sdb. The partitions will also be files there: /dev/sda1, /dev/sda2... And so on.
The processes, your cpu, your ram, even your linux kernel memory can be viewed as files under the /proc directory. Anything, from processes, hardware, disks, sound cards, scannes, usb or com ports, modems,... anything, is a file somewhere on your file system.
That why, in linux, you can format a partition, but you can also format a file and mount it as it was a hard disk, because ultimately, linux makes very little -if any- distinctions. The real nature of the device doesn't really matter. That's one of the wonderful things in linux, you really don't have to worry about the nature of the things, so you can concentrate on getting the job done.
It's just like beer. Some people love it, some people hate it.