Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display column headers for 'ls -l' command in unix/linux?

I want to display all the column headers when I type ls -l command in bash shell in unix/linux

When we type ls -ltr on command prompt we get something like the following.

-r--r--r--  2   makerpm   root   1898   Jan 28 14:52   sample3 -r--r--r--  2   makerpm   root   1898   Jan 28 14:52   sample1 

What I want is to know whether ls has any options to display with column headers:

File_Permissions  Owner Group   Size   Modified_Time  Name -r--r--r--  2  makerpm   root   1898   Jan 28 14:52   sample3 -r--r--r--  2  makerpm   root   1898   Jan 28 14:52   sample1 
like image 759
sunil_rbc Avatar asked Jan 28 '16 12:01

sunil_rbc


People also ask

How do I view headers in Unix?

There's no such thing as a "header" in UNIX files. To see if the files are the same, you must compare their contents. You can do this using the "diff" command for text files or using the "cmp" command for binary files.

How do I display a specific column in Unix?

1) The cut command is used to display selected parts of file content in UNIX. 2) The default delimiter in cut command is "tab", you can change the delimiter with the option "-d" in the cut command. 3) The cut command in Linux allows you to select the part of the content by bytes, by character, and by field or column.

What are the columns in ls output?

The first column gives the type of the file (e.g., directory or ordinary file) and the file permissions. The second column is the number of links to the file i.e., (more or less) the number of names there are for the file.

How do I find header files in Linux?

Usually, the include files are in /usr/include or /usr/local/include depending on the library installation. stdio. h can be found there, but stdbool. h can be found in /usr/lib/clang/.../include or /usr/lib/gcc/.../include .


1 Answers

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.

like image 69
Bart Schuijt Avatar answered Oct 13 '22 18:10

Bart Schuijt