$ sudo -iu abc ls -ltr /sites/servers/server_instance/logs/access*
ls: cannot access /sites/servers/server_instance/logs/access*: No such file or directory
$ sudo -iu abc ls -ltr /sites/servers/server_instance/logs/
total 594812
-rwxrwxrwx 1 abc abc 45 Mar 21 12:42 old.log
-rwxrwxrwx 1 abc abc 304537970 Mar 24 12:45 console.log
-rwxrwxrwx 1 abc abc 304537970 Mar 24 13:20 access_nginx.log
Can anyone explain why this happens? I am stuck on a script due to this.
lscommand that can then (when the identity change fromsuhas taken effect) do the globbing. – Marc van Leeuwen Mar 29 '16 at 04:42lsdoesn't do any globbing. – muru Mar 29 '16 at 05:07sh -cto the command line. – Stig Hemmer Mar 29 '16 at 07:43sudo bash -c "ls -d /foo/bar/*". – Noumenon Dec 02 '19 at 14:47sudo sh -c "ls --color=always foo/bar/" | less -Rfor a colorized list that doesn't disrupt the scrollback buffer. Thanks @Noumenon and @StigHemmer. – Bob Stein Jul 05 '21 at 19:22