I often find that, when I'm confronted with a filesystem access failure, during that lovely "wtf?" moment, I often mutter (and type) pathlld (a bash script)

$ pathlld -h
pathlld [-f] [-h] [-l] [-m] <file> ... 
pathlld: Use /bin/ls -ld to show permissions and ownerships for
pathlld: each directory in the path for <file>.
pathlld:     -f  Process nonexistent <file>s, to
pathlld:         see existing parts of path to <file>.
pathlld:     -l  If a path component is a soft-link, do /bin/ls -Lld, too.
pathlld:     -m  Show mount info for any path component.
pathlld:         that is a mountpoint.
pathlld:     -v  Turn on verbose output to STDERR.
pathlld:     -h  This help.


$ pathlld  -m -l  $(type -p vim) 
drwxr-xr-x 27 root root 4096 Aug 21 20:03 /
/dev/sda5 on / type ext4 (rw,errors=remount-ro)
drwxr-xr-x 14 root root 4096 Jan  4  2015 /usr
drwxr-xr-x 3 root root 151552 Aug 25 10:08 /usr/bin
lrwxrwxrwx 1 root root 21 Jan 23  2013 /usr/bin/vim -> /etc/alternatives/vim
-rwxr-xr-x 1 root root 2580984 Jan  2  2014 /usr/bin/vim
$ pathlld  -m -l  mnt/CLIPZIP/PODCASTS/
drwx------ 11 w3 walt 4096 May 21 00:21 mnt
drwxr-xr-x 12 w3 walt 32768 Dec 31  1969 mnt/CLIPZIP
/dev/sdb on /home/w3/mnt/CLIPZIP type vfat (rw,noexec,nosuid,nodev,uid=1003,gid=1000)
drwxr-xr-x 37 w3 walt 32768 Aug 25 14:07 mnt/CLIPZIP/PODCASTS

I would like to publish this tool. Can I do it via AskUbuntu?

I finally published it via github!

GitHub repositories:

https://github.com/waltinator/pathlld.git - Bash script to answer "Why can't I read/write that file?"
https://github.com/waltinator/net-o-matic.git - Watch for (WiFi) network going down, then do a user-specified thing to fix it.

  • Nice. A combination of namei and df?
    – muru
    Commented Aug 25, 2015 at 14:05
  • ls, /bin/mountpoint, option parsing, shell arithmetic, etc
    – waltinator
    Commented Aug 25, 2015 at 14:17
  • 2
    @waltinator If/when you do end up publishing it, please link it here. I would really like to have a copy of it! Thanks Commented Aug 28, 2015 at 18:10
  • @zwork I published it (and another), and linked them here.
    – waltinator
    Commented Jul 19, 2017 at 4:44

1 Answer 1


You can post a share-your-knowledge style question and answer. Say, the question would look like:

How can I find out what's blocking my access to a particular path?

With some back story and a preface and all. And then post your script in your answer, with a good explanation on how it works and its usage.

At which point, I'll post another answer pointing to namei:

$ namei -movx /var/spool/cron/crontabs/foo
f: /var/spool/cron/crontabs/foo
Drwxr-xr-x root root    /
drwxr-xr-x root root    var
drwxr-xr-x root root    spool
drwxr-xr-x root root    cron
drwx-wx--T root crontab crontabs
foo - No such file or directory

It doesn't list what's mounted on a mountpoint, but everything else is covered, I think.

In general, while short enough script can be handled and improved in an answer, one should also post the script where others can easily contribute - such as on Github (as a gist or not), or Gitlab, Bitbucket, etc.

  • 9
    I'd like to add that you'd also likely want to have the actual script live in github or something so that it can be programatically improved instead of wiki-style here. Commented Aug 25, 2015 at 21:20
  • 1
    @JorgeCastro seconded and added.
    – muru
    Commented Aug 25, 2015 at 21:23
  • 3
    With some sort of easy-but-fancy install process too, sudo install -bm 755 <(wget -qO- https://github.../.../...) /usr/local/bin/myscript
    – Oli Mod
    Commented Aug 31, 2015 at 23:18
  • @muru namei -x also distinguishes between mountpoints and normal directories: -x, --mountpoints: Show mountpoint directories with a 'D' rather than a 'd'. Then one can check what exactly is mounted there with mount | grep INSERT_MOUNTPOINT_HERE
    – Byte Commander Mod
    Commented Sep 7, 2015 at 11:26
  • @ByteCommander true, that's why I included that option. But it doesn't, by itself, show what's mounted there.
    – muru
    Commented Sep 7, 2015 at 11:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .