Operating System - HP-UX
1849789 Members
2062 Online
104044 Solutions
New Discussion

Re: many /dev/null:12345 files

 
SOLVED
Go to solution
Shawn Miller_2
Frequent Advisor

many /dev/null:12345 files

I noticed that I have thousands of files on one system called /dev/null:xxxxx with xxxxx corresponding to some number. Does anyone know what these files could possibly be used for. I would like to delete all of them.
5 REPLIES 5
Robert-Jan Goossens
Honored Contributor
Solution

Re: many /dev/null:12345 files

Hi Shawn,

Probably someone is trying to send Standard output Errors to /dev/null (maybe a cron command) chcek if you can match the timestamp to a cron command.

Hope this helps,
Robert-Jan
Sridhar Bhaskarla
Honored Contributor

Re: many /dev/null:12345 files

Hi,

Obviously some incorrect code or a shell script is doing this. Since normal users will not be able to create files under /dev directory (unless you gave full permissions to it), it should be a root process.

Check all the cronjobs, processes/scripts running on the system etc.,. If there are files with current timestamp see if there are any processes attached to them using 'fuser /dev/null*' command.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Steven E. Protter
Exalted Contributor

Re: many /dev/null:12345 files

definitely bad code.

Cleanup help:

You should be able to use one of the file tests to identify and remove these buggers via script.

[ -d $file ] for example.

I'd make a little list:

ls -1 | sort > /tmp/filelist

edit it. Make very sure the device /dev/null by itself is not listed. Your sort should put it at the top or bottom.

then


while read -r filename
do
rm -f $filename
done < /tmp/filelist

In a perfect world, it would be best to clean up after identifying the source of the files.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Eric Antunes
Honored Contributor

Re: many /dev/null:12345 files

Hi,

You must be redirecting something to that location with some command like this:

command &>- 2>&1

Best Regards,

Eric
Each and every day is a good day to learn.
Bill Hassell
Honored Contributor

Re: many /dev/null:12345 files

Some poorly written shell scripts or programs are writing to /dev. NOTE: /dev *must* be permission 755 owned by root. If this is the case, then all of these files were created by root (which is a bit scary). There is only one /dev/null and it is a device file. These other files were created by some script/program that just wrote data to /dev/null:123 which for ordinary users is not possible. You can remove all ordinary files in /dev as they definitely do not belong there:

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



Bill Hassell, sysadmin