How to sort ll output
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
0
down vote
favorite
ll
returns this result:
51380224 Aug 3 08:23 tig_10.d1
51380224 Aug 3 08:18 tig_10.d10
51380224 Aug 3 08:20 tig_10.d11
51380224 Aug 3 08:23 tig_10.d12
51380224 Aug 3 08:21 tig_10.d13
51380224 Jul 31 12:06 tig_10.d14
131072 Jul 31 12:06 tig_10.d15
51380224 Aug 3 08:15 tig_10.d2
51380224 Aug 2 23:08 tig_10.d3
51380224 Aug 2 14:24 tig_10.d4
51380224 Aug 2 14:24 tig_10.d5
51380224 Aug 3 08:21 tig_10.d6
51380224 Aug 3 08:22 tig_10.d7
51380224 Aug 3 08:13 tig_10.d8
51380224 Aug 3 08:20 tig_10.d9
Been unsuccessful to list the files like this
51380224 Aug 3 08:23 tig_10.d1
51380224 Aug 3 08:15 tig_10.d2
51380224 Aug 2 23:08 tig_10.d3
51380224 Aug 2 14:24 tig_10.d4
51380224 Aug 2 14:24 tig_10.d5
51380224 Aug 3 08:21 tig_10.d6
51380224 Aug 3 08:22 tig_10.d7
51380224 Aug 3 08:13 tig_10.d8
51380224 Aug 3 08:20 tig_10.d9
51380224 Aug 3 08:18 tig_10.d10
51380224 Aug 3 08:20 tig_10.d11
51380224 Aug 3 08:23 tig_10.d12
51380224 Aug 3 08:21 tig_10.d13
51380224 Jul 31 12:06 tig_10.d14
131072 Jul 31 12:06 tig_10.d15
Any ideas how?
ls filenames sort hp-ux
add a comment |Â
up vote
0
down vote
favorite
ll
returns this result:
51380224 Aug 3 08:23 tig_10.d1
51380224 Aug 3 08:18 tig_10.d10
51380224 Aug 3 08:20 tig_10.d11
51380224 Aug 3 08:23 tig_10.d12
51380224 Aug 3 08:21 tig_10.d13
51380224 Jul 31 12:06 tig_10.d14
131072 Jul 31 12:06 tig_10.d15
51380224 Aug 3 08:15 tig_10.d2
51380224 Aug 2 23:08 tig_10.d3
51380224 Aug 2 14:24 tig_10.d4
51380224 Aug 2 14:24 tig_10.d5
51380224 Aug 3 08:21 tig_10.d6
51380224 Aug 3 08:22 tig_10.d7
51380224 Aug 3 08:13 tig_10.d8
51380224 Aug 3 08:20 tig_10.d9
Been unsuccessful to list the files like this
51380224 Aug 3 08:23 tig_10.d1
51380224 Aug 3 08:15 tig_10.d2
51380224 Aug 2 23:08 tig_10.d3
51380224 Aug 2 14:24 tig_10.d4
51380224 Aug 2 14:24 tig_10.d5
51380224 Aug 3 08:21 tig_10.d6
51380224 Aug 3 08:22 tig_10.d7
51380224 Aug 3 08:13 tig_10.d8
51380224 Aug 3 08:20 tig_10.d9
51380224 Aug 3 08:18 tig_10.d10
51380224 Aug 3 08:20 tig_10.d11
51380224 Aug 3 08:23 tig_10.d12
51380224 Aug 3 08:21 tig_10.d13
51380224 Jul 31 12:06 tig_10.d14
131072 Jul 31 12:06 tig_10.d15
Any ideas how?
ls filenames sort hp-ux
What is the command aliasll
set for? Please post the output ofalias ll
so we can figure out what's messing with the sorting of the output.
â Mioriin
Aug 3 at 19:05
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
ll
returns this result:
51380224 Aug 3 08:23 tig_10.d1
51380224 Aug 3 08:18 tig_10.d10
51380224 Aug 3 08:20 tig_10.d11
51380224 Aug 3 08:23 tig_10.d12
51380224 Aug 3 08:21 tig_10.d13
51380224 Jul 31 12:06 tig_10.d14
131072 Jul 31 12:06 tig_10.d15
51380224 Aug 3 08:15 tig_10.d2
51380224 Aug 2 23:08 tig_10.d3
51380224 Aug 2 14:24 tig_10.d4
51380224 Aug 2 14:24 tig_10.d5
51380224 Aug 3 08:21 tig_10.d6
51380224 Aug 3 08:22 tig_10.d7
51380224 Aug 3 08:13 tig_10.d8
51380224 Aug 3 08:20 tig_10.d9
Been unsuccessful to list the files like this
51380224 Aug 3 08:23 tig_10.d1
51380224 Aug 3 08:15 tig_10.d2
51380224 Aug 2 23:08 tig_10.d3
51380224 Aug 2 14:24 tig_10.d4
51380224 Aug 2 14:24 tig_10.d5
51380224 Aug 3 08:21 tig_10.d6
51380224 Aug 3 08:22 tig_10.d7
51380224 Aug 3 08:13 tig_10.d8
51380224 Aug 3 08:20 tig_10.d9
51380224 Aug 3 08:18 tig_10.d10
51380224 Aug 3 08:20 tig_10.d11
51380224 Aug 3 08:23 tig_10.d12
51380224 Aug 3 08:21 tig_10.d13
51380224 Jul 31 12:06 tig_10.d14
131072 Jul 31 12:06 tig_10.d15
Any ideas how?
ls filenames sort hp-ux
ll
returns this result:
51380224 Aug 3 08:23 tig_10.d1
51380224 Aug 3 08:18 tig_10.d10
51380224 Aug 3 08:20 tig_10.d11
51380224 Aug 3 08:23 tig_10.d12
51380224 Aug 3 08:21 tig_10.d13
51380224 Jul 31 12:06 tig_10.d14
131072 Jul 31 12:06 tig_10.d15
51380224 Aug 3 08:15 tig_10.d2
51380224 Aug 2 23:08 tig_10.d3
51380224 Aug 2 14:24 tig_10.d4
51380224 Aug 2 14:24 tig_10.d5
51380224 Aug 3 08:21 tig_10.d6
51380224 Aug 3 08:22 tig_10.d7
51380224 Aug 3 08:13 tig_10.d8
51380224 Aug 3 08:20 tig_10.d9
Been unsuccessful to list the files like this
51380224 Aug 3 08:23 tig_10.d1
51380224 Aug 3 08:15 tig_10.d2
51380224 Aug 2 23:08 tig_10.d3
51380224 Aug 2 14:24 tig_10.d4
51380224 Aug 2 14:24 tig_10.d5
51380224 Aug 3 08:21 tig_10.d6
51380224 Aug 3 08:22 tig_10.d7
51380224 Aug 3 08:13 tig_10.d8
51380224 Aug 3 08:20 tig_10.d9
51380224 Aug 3 08:18 tig_10.d10
51380224 Aug 3 08:20 tig_10.d11
51380224 Aug 3 08:23 tig_10.d12
51380224 Aug 3 08:21 tig_10.d13
51380224 Jul 31 12:06 tig_10.d14
131072 Jul 31 12:06 tig_10.d15
Any ideas how?
ls filenames sort hp-ux
edited Aug 3 at 16:00
SivaPrasath
3,27511333
3,27511333
asked Aug 3 at 15:36
user3753660
1
1
What is the command aliasll
set for? Please post the output ofalias ll
so we can figure out what's messing with the sorting of the output.
â Mioriin
Aug 3 at 19:05
add a comment |Â
What is the command aliasll
set for? Please post the output ofalias ll
so we can figure out what's messing with the sorting of the output.
â Mioriin
Aug 3 at 19:05
What is the command alias
ll
set for? Please post the output of alias ll
so we can figure out what's messing with the sorting of the output.â Mioriin
Aug 3 at 19:05
What is the command alias
ll
set for? Please post the output of alias ll
so we can figure out what's messing with the sorting of the output.â Mioriin
Aug 3 at 19:05
add a comment |Â
4 Answers
4
active
oldest
votes
up vote
3
down vote
ls
will re-sort the filenames you give it (or the current directory, if you don't) itself; one way around this would be to give it the filenames separately:
ls -l *.d? ; ls -l *.d??
Or, since you appear to have an alias/function to do a long listing:
ll *.d?; ll *.d??
Note that GNUls
has a-U
option to disable the sorting.
â Stéphane Chazelas
Aug 3 at 15:51
add a comment |Â
up vote
3
down vote
I don't know what your ll
is. ll
is a commonly given alias to ls -l
, but that doesn't look like it.
In any case, that particular output could be sorted in the order you want with GNU sort
and its version sort applied to the 5th column and over:
ll | sort -bVk5
If ll
is somehow an alias to ls
and your ls
is GNU ls
, then that ls
also has a version sort enabled with -v
.
With the zsh
shell, you can have its globs sorted in a similar fashion with the numericglobsort
option or the (n)
glob qualifier. So if your ll
command can get the list of file names as argument and doesn't do any further sorting itself, you could do (in zsh
, and zsh
only):
ll *(n)
add a comment |Â
up vote
1
down vote
Using sort
:
$ ls -lghFG | sort -n -td -k2
total 0
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d1
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d2
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d3
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d4
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d5
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d6
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d7
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d8
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d9
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d10
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d11
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d12
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d13
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d14
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d15
This will use the letter d
as a delimiter and sort the output numerically on the field 2 so there could be issues if your filenames contain the letter d
.
To meet your requirement of using ll
(which is an alias) you could do (not recommended:
alias ll='ls -lghFG | sort -n -td -k2'
add a comment |Â
up vote
1
down vote
from man
,
ll -v
- -v natural sort of (version) numbers within the text
add a comment |Â
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
ls
will re-sort the filenames you give it (or the current directory, if you don't) itself; one way around this would be to give it the filenames separately:
ls -l *.d? ; ls -l *.d??
Or, since you appear to have an alias/function to do a long listing:
ll *.d?; ll *.d??
Note that GNUls
has a-U
option to disable the sorting.
â Stéphane Chazelas
Aug 3 at 15:51
add a comment |Â
up vote
3
down vote
ls
will re-sort the filenames you give it (or the current directory, if you don't) itself; one way around this would be to give it the filenames separately:
ls -l *.d? ; ls -l *.d??
Or, since you appear to have an alias/function to do a long listing:
ll *.d?; ll *.d??
Note that GNUls
has a-U
option to disable the sorting.
â Stéphane Chazelas
Aug 3 at 15:51
add a comment |Â
up vote
3
down vote
up vote
3
down vote
ls
will re-sort the filenames you give it (or the current directory, if you don't) itself; one way around this would be to give it the filenames separately:
ls -l *.d? ; ls -l *.d??
Or, since you appear to have an alias/function to do a long listing:
ll *.d?; ll *.d??
ls
will re-sort the filenames you give it (or the current directory, if you don't) itself; one way around this would be to give it the filenames separately:
ls -l *.d? ; ls -l *.d??
Or, since you appear to have an alias/function to do a long listing:
ll *.d?; ll *.d??
answered Aug 3 at 15:42
Jeff Schaller
30.7k846104
30.7k846104
Note that GNUls
has a-U
option to disable the sorting.
â Stéphane Chazelas
Aug 3 at 15:51
add a comment |Â
Note that GNUls
has a-U
option to disable the sorting.
â Stéphane Chazelas
Aug 3 at 15:51
Note that GNU
ls
has a -U
option to disable the sorting.â Stéphane Chazelas
Aug 3 at 15:51
Note that GNU
ls
has a -U
option to disable the sorting.â Stéphane Chazelas
Aug 3 at 15:51
add a comment |Â
up vote
3
down vote
I don't know what your ll
is. ll
is a commonly given alias to ls -l
, but that doesn't look like it.
In any case, that particular output could be sorted in the order you want with GNU sort
and its version sort applied to the 5th column and over:
ll | sort -bVk5
If ll
is somehow an alias to ls
and your ls
is GNU ls
, then that ls
also has a version sort enabled with -v
.
With the zsh
shell, you can have its globs sorted in a similar fashion with the numericglobsort
option or the (n)
glob qualifier. So if your ll
command can get the list of file names as argument and doesn't do any further sorting itself, you could do (in zsh
, and zsh
only):
ll *(n)
add a comment |Â
up vote
3
down vote
I don't know what your ll
is. ll
is a commonly given alias to ls -l
, but that doesn't look like it.
In any case, that particular output could be sorted in the order you want with GNU sort
and its version sort applied to the 5th column and over:
ll | sort -bVk5
If ll
is somehow an alias to ls
and your ls
is GNU ls
, then that ls
also has a version sort enabled with -v
.
With the zsh
shell, you can have its globs sorted in a similar fashion with the numericglobsort
option or the (n)
glob qualifier. So if your ll
command can get the list of file names as argument and doesn't do any further sorting itself, you could do (in zsh
, and zsh
only):
ll *(n)
add a comment |Â
up vote
3
down vote
up vote
3
down vote
I don't know what your ll
is. ll
is a commonly given alias to ls -l
, but that doesn't look like it.
In any case, that particular output could be sorted in the order you want with GNU sort
and its version sort applied to the 5th column and over:
ll | sort -bVk5
If ll
is somehow an alias to ls
and your ls
is GNU ls
, then that ls
also has a version sort enabled with -v
.
With the zsh
shell, you can have its globs sorted in a similar fashion with the numericglobsort
option or the (n)
glob qualifier. So if your ll
command can get the list of file names as argument and doesn't do any further sorting itself, you could do (in zsh
, and zsh
only):
ll *(n)
I don't know what your ll
is. ll
is a commonly given alias to ls -l
, but that doesn't look like it.
In any case, that particular output could be sorted in the order you want with GNU sort
and its version sort applied to the 5th column and over:
ll | sort -bVk5
If ll
is somehow an alias to ls
and your ls
is GNU ls
, then that ls
also has a version sort enabled with -v
.
With the zsh
shell, you can have its globs sorted in a similar fashion with the numericglobsort
option or the (n)
glob qualifier. So if your ll
command can get the list of file names as argument and doesn't do any further sorting itself, you could do (in zsh
, and zsh
only):
ll *(n)
answered Aug 3 at 15:49
Stéphane Chazelas
277k52511841
277k52511841
add a comment |Â
add a comment |Â
up vote
1
down vote
Using sort
:
$ ls -lghFG | sort -n -td -k2
total 0
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d1
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d2
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d3
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d4
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d5
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d6
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d7
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d8
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d9
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d10
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d11
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d12
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d13
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d14
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d15
This will use the letter d
as a delimiter and sort the output numerically on the field 2 so there could be issues if your filenames contain the letter d
.
To meet your requirement of using ll
(which is an alias) you could do (not recommended:
alias ll='ls -lghFG | sort -n -td -k2'
add a comment |Â
up vote
1
down vote
Using sort
:
$ ls -lghFG | sort -n -td -k2
total 0
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d1
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d2
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d3
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d4
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d5
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d6
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d7
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d8
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d9
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d10
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d11
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d12
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d13
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d14
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d15
This will use the letter d
as a delimiter and sort the output numerically on the field 2 so there could be issues if your filenames contain the letter d
.
To meet your requirement of using ll
(which is an alias) you could do (not recommended:
alias ll='ls -lghFG | sort -n -td -k2'
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Using sort
:
$ ls -lghFG | sort -n -td -k2
total 0
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d1
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d2
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d3
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d4
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d5
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d6
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d7
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d8
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d9
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d10
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d11
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d12
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d13
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d14
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d15
This will use the letter d
as a delimiter and sort the output numerically on the field 2 so there could be issues if your filenames contain the letter d
.
To meet your requirement of using ll
(which is an alias) you could do (not recommended:
alias ll='ls -lghFG | sort -n -td -k2'
Using sort
:
$ ls -lghFG | sort -n -td -k2
total 0
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d1
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d2
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d3
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d4
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d5
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d6
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d7
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d8
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d9
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d10
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d11
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d12
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d13
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d14
-rw-r--r-- 1 0 Aug 3 09:43 tig_10.d15
This will use the letter d
as a delimiter and sort the output numerically on the field 2 so there could be issues if your filenames contain the letter d
.
To meet your requirement of using ll
(which is an alias) you could do (not recommended:
alias ll='ls -lghFG | sort -n -td -k2'
answered Aug 3 at 15:45
Jesse_b
10.1k12658
10.1k12658
add a comment |Â
add a comment |Â
up vote
1
down vote
from man
,
ll -v
- -v natural sort of (version) numbers within the text
add a comment |Â
up vote
1
down vote
from man
,
ll -v
- -v natural sort of (version) numbers within the text
add a comment |Â
up vote
1
down vote
up vote
1
down vote
from man
,
ll -v
- -v natural sort of (version) numbers within the text
from man
,
ll -v
- -v natural sort of (version) numbers within the text
answered Aug 3 at 15:58
SivaPrasath
3,27511333
3,27511333
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460358%2fhow-to-sort-ll-output%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
What is the command alias
ll
set for? Please post the output ofalias ll
so we can figure out what's messing with the sorting of the output.â Mioriin
Aug 3 at 19:05