Operating System - HP-UX
1838675 Members
5019 Online
110128 Solutions
New Discussion

Re: Creating ttyp2 with mknod problem

 
SOLVED
Go to solution
Jason Ray
Frequent Advisor

Creating ttyp2 with mknod problem

I am trying to recreate the character file /dev/ttyp2. The other files look like this:

crw-rw-rw- 2 bin tty 17 0x000000 Dec 21 13:56 ttyp0
crw-rw-rw- 2 root root 17 0x000001 Mar 27 11:05 ttyp1

I create this one:

crw-rw-rw- 1 root sys 17 0x000002 Mar 28 09:26 ttyp2

I used this command:
mknod ttyp2 c 17 0x000002

My question, what does the "1" in the second column refer to for device files and why do the other device files have a "2" there.
And mostly, how can I create /dev/ttyp2 so that its like the rest?

Thanks in advance.
3 REPLIES 3
Baiju Kumar.B_1
Advisor

Re: Creating ttyp2 with mknod problem

dear jason,
it is the present links of the files only .the previous having one more link file also.the latter one has no more link file.you can use ln -s sourcefile destination file
regards
Baiju
nothing is impossible
James R. Ferguson
Acclaimed Contributor
Solution

Re: Creating ttyp2 with mknod problem

Hi Jason:

The "1" in the second field of an 'ls' is the number of links to a file. The manpages for 'ls' provide you that.

To see the inode number of a file, do:

# ls -il filename

Once you have an inode number, you can find the hard-linked files with:

# find -xdev -inum nnn

NOTE that an inode number is only unique within a mountpoint, so its very important to use '-xdev' with 'find' so not to cross mountpoints.

Regards!

...JRF...
Jason Ray
Frequent Advisor

Re: Creating ttyp2 with mknod problem

Thanks James. That was what I needed to find. Just need to do a hard link of /dev/pty/ttyp2 to the new device file /dev/ttyp2 that I created.