Results 1 to 10 of 10
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.
...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-21-2008 #1
in linux everything if file
i read once on a site that
i am not getting what this phrase means.Code:in linux everything is file,if it is not a file it is a process
secondly is this an advantage of linux that here everything is file and how does this differ from windows
thanks
- 05-21-2008 #2
What that means is that Linux treats hardware devices as files and Windows doesn't. Every device has a file corresponding to it (you'll find them in the /dev directory) and a program can open this file and read from or write to it just like with any other file. Each time that happens, the kernel intervenes and writes to/reads from the hardware, then passes back the result to the program. Which is a huge advantage if you are writing programs because you don't need to know how to actually access the hardware.
"I'm just a little old lady; don't try to dazzle me with jargon!"
- 05-21-2008 #3Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
The second part of that statement is false. The correct statement is:
You just have to look at /proc to see the processes there as well:In linux, everything is a file
All those numbers are the PIDs (process identification numbers) on my system right now.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
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.
- 05-22-2008 #4
thanks hazel and i92guboj for ur worthy replies they are very usefull.
i have learned that whether it is process or it is hardware they are all treated as file in linux.
another question is that does this feature(that in linux everything is a file) of Linux was the reason that linux has no VIRUS.
- 05-22-2008 #5
That statement should be corrected:
In Unix/Linux/BSD, there are only files or process's
Men occasionally stumble over the truth,
but most of them pick themselves up
and hurry off as if nothing had happened.
Winston Churchill
... then the Unix-Gods created "man" ...
- 05-22-2008 #6Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
That's inaccurate. There are viruses for every OS under the sun, though admittedly, the panacea for them is Windows. The whole point of unix and it's clones (linux amongst them) is that the user doesn't have god-like powers. In other words: you can only write in your home dir. So, if you get a virus on your mail box and accidentaly run it (it has to be executable on linux, which is another barrier) at most, it can compromise the data in your home dir, but nothing else. This is why I advise to run wine as a separate user, by the way.
Note also that 99% of the windows virus come the same way: via a vulnerability in IE (don't you love activeX? :P ). Since we don't use dumb things like activex on linux, that's another wall. Denying exec permissions to javascript globally also help. Smart users only enable it on trusted sites. Anyway, most viruses are just product of script kiddies which use windows exclusive stuff like activex or vbscript and the like, so, even if we enable some malicious javascript on linux by accident, most times there will be no negative effect.
Of course, that's just plainly circumstantial. I mean: there's nothing stopping the people from programming more linux viruses (even if it's just to foobar your home dir only). The only limiting factors there are the quality of the clients (browsers, MTA's etc) and the ignorance of those script kiddies who make silly viruses for windows and IE.
As I already mentioned above, processes are seen as files too under /proc/<pid_number>. So, they are files as well in a sense.
- 05-23-2008 #7
thanks for the reply
it means that we should avoid logging on with root as in this case vius can trouble linux distribution.
- 05-24-2008 #8Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
- 05-24-2008 #9Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
- 05-25-2008 #10
most of viruses are written for Windows and windows EXEs do not run on LINUX thats why Linux cant be infected with viruses!!!
i have tried alot to install a multimedia on Ubuntu but i failed,it is very difficut to install softwares on linux as conmaped to "NEXT-------NEXT --- FINISH"(i am refering to windows)


Reply With Quote

