Ls usage

From raju

Show file date in YYYY-MM-DD format

Use --time-style='+%Y-%m-%d'

    % ls -l --time-style='+%Y-%m-%d' ~/.vimrc
    -rwx------ 1 rajulocal rajulocal 1087 2020-04-27 /home/rajulocal/.vimrc*
    
    % ls -l ~/.vimrc
    -rwx------ 1 rajulocal rajulocal 1087 Apr 27 20:56 /home/rajulocal/.vimrc*
    

indicators

"ls -F" appends indicators */=>@| 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

only show filename and modification time

    ls -al | cut -d ' ' -f 6- 
    

Another way (using find):

    find -maxdepth 1 -type f -printf "%TY %Tb %Td %TH:%TM\t%p\n"
    

To sort the files based on timestamp (reverse chronological order)

    find -maxdepth 1 -type f -printf "%T+#%TY %Tb %Td %TH:%TM\t%p\n" | sort -rn| cut -d# -f2-
    

The %T+ is used to sort the output properly and gets removed by cut afterwards.

Ref:- https://askubuntu.com/a/1044206/574082