AIX system /dev/null file recovery after accidental deletion

   /dev/null is a special character device file. It is a virtual device, which can be visually understood as a bottomless black hole, a black hole that devours everything, and can never be filled. Very important to the system, any information that does not need to be saved can be thrown into /dev/null.
testterm1:/# ls -l /dev/null
crw-rw-rw- 1 root system 2, 2 Jul 31 11:49 /dev/null
As can be seen from the result of the ls -l command , /dev/null belongs to a character device file (c Represents character), the permission is 666, the owner is root, it belongs to the system group, and the major/minor numbers are both 2.
After /dev/null is deleted by mistake, it can be recovered by the following methods:


1、创建/dev/null文件
testterm1:/#rm /dev/null
testterm1:/#ls -l /dev/null
ls: 0653-341 The file /dev/null does not exist.
testterm1:/#mknod /dev/null c 2 2
testterm1:/#ls -l /dev/null
crw-r--r--   1 root     system        2,  2 Jul 31 14:08 /dev/null


2. Set /dev/null file permissions
testterm1:/# chmod 666 /dev/null
testterm1:/#ls -l /dev/null
crw-rw-rw- 1 root system 2, 2 Jul 31 14:08 /dev/ null
At this point, the /dev/null file has been successfully restored.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326953827&siteId=291194637