User Tools

Site Tools


ls_usage

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
ls_usage [2021/01/15 21:53] rajuls_usage [2022/07/22 23:27] – [Show file date in different date formats] raju
Line 1: Line 1:
 +==== sort ls output by filename length ====
 +<code>
 +ls --color=never --indicator-style=none | awk '{print length, $0}' |
 +sort -n | cut -d" " -f2-
 +</code>
 +
 +To see it in action, create some files
 +<code>
 +% touch a ab abc
 +</code>
 +
 +and some directories
 +<code>
 +% mkdir d de def
 +</code>
 +
 +Output of the normal ls command
 +<code>
 +% ls
 +a  ab  abc  d/  de/  def/
 +</code>
 +
 +Output from the proposed command
 +<code>
 +% ls --color=never --indicator-style=none | awk '{print length, $0}' |
 +sort -n | cut -d" " -f2-
 +a
 +d
 +ab
 +de
 +abc
 +def
 +</code>
 +
 +Ref:- https://stackoverflow.com/a/70628169
 ==== Show file date in different date formats ==== ==== Show file date in different date formats ====
 tags | YYYY-MM-DD, YYYYMMDD, YYYYMMDD_HHMMSS tags | YYYY-MM-DD, YYYYMMDD, YYYYMMDD_HHMMSS
Line 20: Line 55:
 -rwx------ 1 rajulocal rajulocal 1112 20201017 /home/rajulocal/.vimrc* -rwx------ 1 rajulocal rajulocal 1112 20201017 /home/rajulocal/.vimrc*
 </code> </code>
 +
 +==== indicators ====
 +"ls -F" appends indicators <nowiki>*/=>@|</nowiki> to filenames.
 +  * * means executable.
 +  * / means directory.
 +  * = means socket.
 +  * > means door.
 +  * @ means symbolic link (or that the file has extended attributes).
 +  * | means named pipe.
 +
 +Ref:- https://unix.stackexchange.com/questions/82357/what-do-the-symbols-displayed-by-ls-f-mean
  
ls_usage.txt · Last modified: 2022/07/22 23:34 by raju