bash:commands:ls:link_count_is_zero
Table of Contents
BASH - Commands - ls - link count is zero
Running an ls command shows that the link count of the file or directory is showing as 0.
For example:
ls -al
returns:
-rwxr-xr-x 0 peter peter 20M Apr 29 11:02 afile
The 0 after the three sets of permissions is the link count, and usually specifies the number of hard links the file has, or for directories the number of directories within the directory + this directory itself.
NOTE: For any directory, the minimum amount of links should be at least 2 (self . and parent ..) + the number of sub-directories, as long as the directory isn't rmdir'd.
If the directory is deleted, then the link count is generally 0.
Try
find . -type f -links 0 -size +10000 -ls
returns:
187826224 0 -rwxr-xr-x 0 peter peter 19947047 Apr 29 11:02 afile
Then delete the file using the inode, in this example 187826224.
find . -inum 187826224 -exec rm -i {} \;
Solution
Reboot.
bash/commands/ls/link_count_is_zero.txt · Last modified: 2021/01/26 16:01 by peter