Jump to content

Recommended Posts

Posted

Wikipedia:

 

The Linux null device is a special file that discards all data written to it (but reports that the write operation succeeded). It also provides no data to any process that reads from it (it returns EOF). In Unix programmer jargon, it may also be called the bit bucket or black hole.

 

So, if your linux /dev/null has been missing or deleted somehow, here's how to re-create the special file. Although, we all know that the need to recreate this special file /dev/null does not comes very often. But in case, here is a way on how to recreate a /dev/null special file.

 

From Fedora and CentOS box, go to /dev folder as root by executing the linux command

 

cd /dev
Followed by linux command to list out files

 

ls -la
Since /dev/null does not exists anymore, the above should give us the below lines

 

ls: cannot access null: No such file or directory

So, to re-create /dev/null special file , proceed to execute the below linux command as root

 

mknod /dev/null c 1 3
Then change its mode bits as follows

 

chmod 666 /dev/null
Alternatively, the below has the same effect with the above

 

mknod -m 666 /dev/null c 1 3

Now, let us try to confirm if we have just re-created /dev/null existence

 

ls -la /dev/null
The above should give us something like

 

crw-rw-rw- 1 root root 1, 3 May 24 19:24 /dev/null
Then that is how to recreate /dev/null special file.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.