how unix kernel distinguishes between a normal file and
device file ?

Answers were Sorted based on User's Feedback



how unix kernel distinguishes between a normal file and device file ?..

Answer / asif

This information (file type) is stored in the inode of a
file, as one of the fields.

Is This Answer Correct ?    26 Yes 2 No

how unix kernel distinguishes between a normal file and device file ?..

Answer / manasi mishra

for normal file in the ls -l listing there is a '-' as
first character like '-rw-r--r- '.

-rw-r--r-- 1 batch sybase 0 Dec 4 14:50 test1
This identifies it as normal file.

But for device files , they are saved as character or else
blocks . So the first letter is 'c' for character , and 'b'
for blocks.

Is This Answer Correct ?    20 Yes 0 No

how unix kernel distinguishes between a normal file and device file ?..

Answer / guest

Based on inode table.

Is This Answer Correct ?    8 Yes 0 No

how unix kernel distinguishes between a normal file and device file ?..

Answer / asif

Guest,

You are right about the 'ls' command, but 'ls' is a user
level command, which invokes (among others) read system
call to read and display directory contents (file/ dir
names in a directory). Ultimately kernel parses inode of
each file to get its type.

Rgds,
asif

Is This Answer Correct ?    7 Yes 1 No

how unix kernel distinguishes between a normal file and device file ?..

Answer / komall ambastha

Device files are referenced by a major number, which
identifies the device type, and a minor type, which
identifies the unit, or instance of that major type.
Kernel distinguish between an ordinary file and
device/special file with Major number

Is This Answer Correct ?    3 Yes 0 No

how unix kernel distinguishes between a normal file and device file ?..

Answer / sougat

nornal are basically divided into two part text(printable)
or binary (printable ornonprintable character covering
entire ascii range)
where device file contain (stream of un interpretable
character)they have some attributes stored some where else
for the device to read and excute accordingly

Is This Answer Correct ?    1 Yes 1 No

how unix kernel distinguishes between a normal file and device file ?..

Answer / guest

while listing the file names by ls-l command we get hyphen
is the first character that shows it is a normal file and
if we d instead of hyphen(-) that is device file

Is This Answer Correct ?    6 Yes 54 No

Post New Answer

More Unix Commands Interview Questions

How to find the files that are accessed before 10 minutes?

5 Answers   Amazon,


What is the search command in unix?

0 Answers  


describe the escaping sequence characteres in unix

1 Answers  


What are the commands in UNIX to list the files in a Directory?

0 Answers   CGI,


What is the comma to show the space allocation of files?

0 Answers  






what these two commands prints "echo test","cat test"?

6 Answers   TCS, Wipro,


in UNIX,what is the command to remove directory with files?

10 Answers  


When i run a programm of orphan process. Instead of getting child's parent (ppid)=1 ..i get 1400 and it varies as per system. How can i findthe right soluion??? My pgm: #include<stdlib.h> # include <stdio.h> int main() { int pid; pid=fork(); if(pid < 0) {exit(-1);} else if(pid==0) { printf("Child Process is Sleeping ..."); sleep(10); printf("Orphan Child's Parent ID : %u ",getppid()); } else { printf("Parent Process Completed ... %u ",getpid()); exit(0); } return 0; } Output:

0 Answers  


How does a user get the current date, time in UNIX?

6 Answers   IBM,


Where can I get the free download of Unix by Yeswant Kanetkar?

5 Answers  


What is the basic difference between unix and windows operating systems?

43 Answers   Bopro, College School Exams Tests, CTS, IBM, IT-Kids, Priyadarshini, Sybian Technologies, Tolani Maritime,


How do I run a whois command?

0 Answers  


Categories