Operating System - HP-UX
1834916 Members
2816 Online
110071 Solutions
New Discussion

Re: Two null or not two null, that is the question...

 
SOLVED
Go to solution
Daniel M. Gonzales
Frequent Advisor

Two null or not two null, that is the question...

Most of my servers have...

/dev/null
/dev/nuls

What is /dev/nuls used for?

Also, found the following files under /dev on a few servers here and there. I'm assuming these are just programmer mistakes and can be removed?

nul
null (regular file)
null`
null0
null2
null^M

How do you delete the /dev/null regular file? By inode?

Thanks.
7 REPLIES 7
John Poff
Honored Contributor

Re: Two null or not two null, that is the question...

Hi,

I found this on my favorite search engine:

"/dev/nuls"

The STREAMS null device. This device frees all data passed to it from downstream or upstream and NAKs all ioctl requests.


If the other devices are just regular files you can remove them by inode. The one named null could make life fun. I've had one or two of those before and eventually some big process runs some redirection to it and fills up the / filesystem. Fun!

JP
A. Clay Stephenson
Acclaimed Contributor

Re: Two null or not two null, that is the question...

/dev/nuls is associated with the clone driver. Man 7 clone for details. I suspect all of the other except for /dev/null are typo's. You can simply rm each one althouth I suspect you have non-printable characters embedded in some of them so I would do a rm -i /dev/nu* and answer y for each file you want to remove.

To recreate /dev/null (assuming this is an 11x box) after rm'ing /dev/null:

mknod /dev/null c 3 0x02
chmod 666 /dev/null
chown bin:bin /dev/null
If it ain't broke, I can fix that.
TwoProc
Honored Contributor

Re: Two null or not two null, that is the question...

Looks like whereas /dev/null is going to return you ONE null and then return - the /dev/nuls device behaves like its a pipe giving you one null or maybe even a string of nulls.

cat /dev/nuls ... (never seems to return until ctrl-c)
cat /dev/null (returns immediately).

Also tried
cat /dev/null | od -- returns
00000000

cat /dev/nuls | od -- doesn't return...

Looks like nuls is what the prior poster said - a stream of NUL (maybe even NULs).

We are the people our parents warned us about --Jimmy Buffett
H.Merijn Brand (procura
Honored Contributor
Solution

Re: Two null or not two null, that is the question...

To complete the fun, you might also find /dev/zero, which is supposed to give you an endless stream of '\0' (ascii NULL) unless you stop or quit.

Nice to zero out a raw disk

dd if=/dev/zero of=/dev/rdsk/c0t2d4 bs=4194

HP-UX 10.20:
d3:/u/usr/merijn 103 > ll /dev/nul* /dev/zer*
63 crw-rw-rw- 1 bin bin 3, 2 Mar 14 22:10 /dev/null
1398 crw-rw-rw- 1 root sys 3, 3 Apr 26 2002 /dev/zero
d3:/u/usr/merijn 104 >

HP-UX 11.00:
a5:/u/usr/merijn 103 > ll /dev/nul* /dev/zer*
74 crw-rw-rw- 1 bin bin 3, 2 Mar 14 23:36 /dev/null
680 crw-rw-rw- 1 root root 72, 10 Feb 15 11:15 /dev/nuls
1868 crw-rw-rw- 1 root sys 3, 3 Jan 27 2004 /dev/zero
a5:/u/usr/merijn 104 >

HP-UX 11.11:
r3:/u/usr/merijn 101 > ll /dev/nul* /dev/zer*
66 crw-rw-rw- 1 bin bin 3, 2 Mar 14 23:32 /dev/null
70 crw-rw-rw- 1 root root 72, 25 Feb 15 11:10 /dev/nuls
752 crw-rw-rw- 1 bin sys 3, 4 Nov 15 2000 /dev/zero
r3:/u/usr/merijn 102 >

SuSE 9.2 Linux:
lt09:/home/merijn 109 > ll /dev/nul* /dev/zer*
36598 crw-rw-rw- 1 root root 1, 3 2004-04-06 15:27 /dev/null
41334 crw-rw-rw- 1 root root 1, 5 2004-04-06 15:27 /dev/zero
lt09:/home/merijn 110 >

AIX 5.2.0.0:
i4:/u/usr/merijn 101 > ll /dev/nul* /dev/zer*
4183 crw-rw-rw- 1 root system 2, 2 Mar 14 17:39 /dev/null
4298 crw-rw-rw- 1 root system 13, 36 Jul 21 2004 /dev/nuls
4223 crw-rw-rw- 1 root system 2, 3 Jul 21 2004 /dev/zero
i4:/u/usr/merijn 102 >

AIX 4.3.0.0:
i2:/u/usr/merijn 103 > ll /dev/nul* /dev/zer*
4155 crw-rw-rw- 1 root system 2, 2 Mar 14 23:40 /dev/null
4321 crw-rw-rw- 1 root system 13, 30 Jul 29 1999 /dev/nuls
4181 crw-rw-rw- 1 root system 2, 3 Jul 29 1999 /dev/zero
i2:/u/usr/merijn 104 >

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Daniel M. Gonzales
Frequent Advisor

Re: Two null or not two null, that is the question...

Thanks guys. As Drew Carey says, "a million points for everyone"! :o)
RolandH
Honored Contributor

Re: Two null or not two null, that is the question...

No Points, please !!!

Just a recommendation.

Do not use rm for removing device files.
The better way is to use rmsf.

Please, read the manpage rmsf(1m) and you will know.

Roland
Sometimes you lose and sometimes the others win
Bill Hassell
Honored Contributor

Re: Two null or not two null, that is the question...

Other than /dev/nuls, the rest are spelling errors. What happens is that someone uses /dev/null for some output redirection but misspells the name to something like /dev/nulll or similar. The shell is very accomodating and creates the regular file: /dev/nulll. NOTE: /dev must have 755 permissions so only root users can make this mistake. Find all the spelling errors with:

find /dev -type f -exec ll {} \;


Bill Hassell, sysadmin