LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-30-2012, 04:19 AM   #1
jayeshsharma52
Member
 
Registered: Jul 2012
Posts: 54

Rep: Reputation: Disabled
"Everything is a file".


When we say that everything is a file in linux what does it basically means,because in windows also we can find a file for everything eg for printer or any device or any log.
Thanks.
 
Old 10-30-2012, 04:26 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
It means that devices live in /dev, memory can be directly access under /proc etc., whereas a windows printer is NOT a file. you can't literally write text to a printer file in windows and see it come out on paper. You really can do this on Linux (echo "THIS IS A TEST" > /dev/lp0) etc. A simpler example is a disk, you can open up /dev/sda1 in a text editor if you so desire and see the raw contents of a disk.

Note though that whilst it's nice to say so, LOADS of things actually aren't files. Like sound and network interfaces in most cases these days (I think)
 
2 members found this post helpful.
Old 10-30-2012, 04:45 AM   #3
jayeshsharma52
Member
 
Registered: Jul 2012
Posts: 54

Original Poster
Rep: Reputation: Disabled
If lets say printer is not a file in windows then how come other programs able to use it?,what do they actually uses to have access on printer?
i.e if I want to use a printer in my program I will have to access printer's device driver.
 
Old 10-30-2012, 04:49 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
*you* don't use the driver, there's no actual file that IS the printer. It disappears into hardware abstraction code and gets dealt with like that. I don't know all that much about how it works, but the basic point here is there is no c:\windows\systems32\davesprinter.prn or something similar.

Actually, there are shitty remnants of this is the DOS environment I believe. On unix you can run "echo TEST > /dev/ttyS0" which would write the word "TEST" to the first serial port, there IS a file at /dev/ttyS0. On windows the same would be "type TEST > COM1" But note here that COM1 is NOT a file. It was just a nasty nasty hack where using the word "COM1" would be arbitrarily pulled out of the ether and sent into the 1st serial port, rather than a file called "COM1"
 
1 members found this post helpful.
Old 10-30-2012, 06:25 AM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
Quote:
Originally Posted by jayeshsharma52 View Post
If lets say printer is not a file in windows then how come other programs able to use it?,what do they actually uses to have access on printer?
i.e if I want to use a printer in my program I will have to access printer's device driver.
You neither access a "printer file" nor the driver directly, you use functions of one of Windows' APIs to print something: http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I "cat" or "grep" a file to ignore lines starting with "#" ??? callagga Linux - Newbie 7 08-16-2013 07:58 AM
unpredictable "delete" "move to trash" or "cut" file menu option dorianrenato Linux - General 3 11-28-2011 07:41 PM
"bad tty" & "file descriptor error" while building RPM on F13 gosssamer Linux - Software 7 12-28-2010 06:02 PM
Hostname defined in file "network" changes after change to file "hosts" qwkfish Linux - Networking 2 10-14-2009 05:07 PM


All times are GMT -5. The time now is 08:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration