I am trying to get ls like output from find command (this is on Linux Mind with find (GNU findutils) 4.7.0.
This is because I want to see the numerical chmod permissions.
What I managed so far is:
% find . -maxdepth 1 -printf "%m %M %y %g %G %u %U %f %l\n" 755 drwxr-xr-x d blueray 1000 blueray 1000 . 664 -rw-rw-r-- f blueray 1000 blueray 1000 .zshrc 644 -rw-r--r-- f blueray 1000 blueray 1000 .gtkrc-xfce 644 -rw-r--r-- f blueray 1000 blueray 1000 .sudo_as_admin_successful 777 lrwxrwxrwx l root 0 root 0 resolv.conf /run/systemd/resolve/resolv.conf Here, %l print empty string if file is not a symbolic link.
What I am looking for is, if %l is not empty then print -> %l.
How can I do that with -printf?
find -maxdepth 1 -lsstat(which can be told to emit them via its more-expressive format string syntax).ls-like output, instead of just asking for numerical permissions and filenames (and potentially nothing else)?statdoesn't list files at all -- it requires something else to give it the list. So, f/e, instat *, it's notstatdeciding what files are included in*, it's your shell making that decision; you can make your shell include hidden files in*by changing its configuration, or you can tellfindto pass filenames tostatwith something likefind . -exec stat ... {} +, substituting...with the arguments you choose.