Unix ls command: show full path when using options

前端 未结 8 1681
故里飘歌
故里飘歌 2020-12-07 12:13

I often use this list command in Unix (AIX / KSH):

ls -Artl

It displays the files as this:

-rw-r--r-- 1 myuser mygroup 0 Apr 2

相关标签:
8条回答
  • 2020-12-07 12:57

    simply use find tool.

    find absolute_path

    displays full paths on my Linux machine, while

    find relative_path

    will not.

    0 讨论(0)
  • 2020-12-07 12:59

    What about this trick...

    ls -lrt -d -1 $PWD/{*,.*}
    
    OR
    
    ls -lrt -d -1 $PWD/*
    

    I think this has problems with empty directories but if another poster has a tweak I'll update my answer. Also, you may already know this but this is probably be a good candidate for an alias given it's lengthiness.

    [update] added some tweaks based on comments, thanks guys.

    [update] as pointed out by the comments you may need to tweek the matcher expressions depending on the shell (bash vs zsh). I've re-added my older command for reference.

    0 讨论(0)
提交回复
热议问题