Home > front end >  Strange problem with find command on ubuntu
Strange problem with find command on ubuntu

Time:11-02

I used the 'find' command to find a file and encountered a strange issue: the file exists, but 'find' can't find it

I found two .sock in /run with 'sudo find /run -name docker.sock'

$sudo find /run -name docker.sock
/run/march/docker.sock
/run/docker.sock

I got nothing when run 'sudo find /var -name docker.sock' and 'sudo find /var/run -name docker.sock'

$sudo find /var -name docker.sock
$sudo find /var/run -name docker.sock
$

but in fact there are two .sock in /var/run/, any comments?

$ls -al /var/run/docker.sock
srwxrwxrwx  1 root docker 0 Oct 18 20:45 /var/run/docker.sock
$ls -al /var/run/march/docker.sock/
total 0
drwxr-xr-x 2 root root  40 Oct 31 20:35 .
drwxr-xr-x 5 root root 100 Oct 31 20:35 ..
$ls -al /var/run/march/
total 0
drwxr-xr-x  5 root root  100 Oct 31 20:35 .
drwxr-xr-x 34 root root 1120 Oct 31 23:45 ..
drwxr-xr-x  2 root root   40 Oct 31 20:35 docker
drwxr-xr-x  2 root root   40 Oct 31 20:35 docker.pid
drwxr-xr-x  2 root root   40 Oct 31 20:35 docker.sock
$
$

BTW it's on Ubuntu 20.04.2 LTS

Thanks in advance

enter image description here

CodePudding user response:

As /var/run is a symbolic link to /run, you have to tell find to follow links :

sudo find -L /var/run -name docker.sock
  • Related