5

Does the ls command have any functionality to show the column headers for decoding what the columns are? I'm aware of the portion of support text that describes the columns in

info ls
2

I've a function as below in my ~/.profile, for the same reasons,

k(){
    { echo PERMS LINKS OWNER GROUP SIZE modMONTH modDATE modTIME NAME
    ls -l; } |
    column -t |
    grep -v "total"
}
0

Similar to the @Niranjan answer, taken from the man of column command:

EXAMPLES
           (printf "PERM LINKS OWNER GROUP SIZE MONTH DAY " ; \
           printf "HH:MM/YEAR NAME\n" ; \
           ls -l | sed 1d) | column -t
0

This question was also asked on SO – sharing my answer here as well:

exa is a replacement/enhancement for ls. If you pass on the arguments -lh with exa, it will include a header row printing the column names like so:

exa -lh

Example output:

Permissions Size User     Date Modified Name
.rwx------    19 username 29 Sep 11:25  dont_cra.sh
drw-r-----     - username 29 Sep 11:26  f1
.rw-r--r--@ 811k username 29 Sep 11:25  row_count.dat
.rw-r--r--    54 username 29 Sep 11:25  some_text.txt

You can set up an alias in .bashrc that replaces ls with exa.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.