I have taken a course in that suddenly I saw this, I understood until the pipe but the options used after the pipe for the command cut are bit confusing
Asked
Active
Viewed 163 times
1 Answers
3
With -c
cut
selects only specified characters or ranges of characters separated by comas:
N N'th byte, character or field, counted from 1
N- from N'th byte, character or field, to end of line
N-M from N'th to M'th (included) byte, character or field
-M from first to M'th (included) byte, character or field
so cut -c1-11,50-
will print characters 1 to 11 and 50 to end of line from every line printed by ls -l
.
So you will get the file permissions (first 11 characters) and the rest depends on length of your username, size of the files etc., but I assume the idea might be to print name of the file (using cut -f
might be better if this was the goal, but generally parsing ls is not a good idea)?

Vojtech Trefny
- 18,146
-
With ast-open
ls
, you'd rather usels --format='%(mode)s %(name)s
, orls --format='%(mode)s %(name)s%(linkop:case:?*: %(linkop)s %(linkpath)s:)s'
to also get the-> target
for symlinks. – Stéphane Chazelas Sep 08 '21 at 07:16 -
See also
stat -Lns +mode -- *
withzsh
'sstat
orfind ./* -prune -printf '%M %f\n'
with GNUfind
orstat -c '%A %n' -- *
with GNU stat. – Stéphane Chazelas Sep 08 '21 at 07:19
ls
(and what to do instead)? – Vlastimil Burián Sep 08 '21 at 06:06