Sample Header Ad - 728x90

nl: How to start line numbers on the second line?

9 votes
5 answers
1563 views
This is the standard output of ls -ln | nl wolf@linux:~$ ls -lh | nl 1 total 24 2 -rw-rw-r-- 1 wolf wolf 186 Sep 24 22:18 01.py 3 -rw-rw-r-- 1 wolf wolf 585 Sep 24 22:21 02.py 4 -rw-rw-r-- 1 wolf wolf 933 Sep 24 22:26 03.py wolf@linux:~$ Instead of starting the number from total 24, would it be possible to start it from the actual files/directory which is the second line? Desired output wolf@linux:~$ ls -lh | nl total 24 1 -rw-rw-r-- 1 wolf wolf 186 Sep 24 22:18 01.py 2 -rw-rw-r-- 1 wolf wolf 585 Sep 24 22:21 02.py 3 -rw-rw-r-- 1 wolf wolf 933 Sep 24 22:26 03.py wolf@linux:~$
Asked by Wolf (1741 rep)
Sep 25, 2020, 11:29 AM
Last activity: Feb 11, 2025, 07:06 PM