On Sat, Mar 27, 2021, at 13:24, L A Walsh wrote: > On 2021/03/26 14:03, Peng Yu wrote: > > Hi, > > > > When I try `ls -l dir1 dir2`, the order of dir1 and dir2 in the output > > is not necessarily the same as the input. How to make it the same as > > the input order? Thanks. > > > Use separate invocations of 'ls' to guarantee the order of output > of the arguments. > > When you put more than one name on the command line, you will get > some type of sorted order or the order they appear on disk. > >
Output ordering rules for ls are covered in Section 10.1.3 of coreutils.info: $ info ls and then navigate to "Sorting the output" (which is the above-named section.) Simply $ ls -fl dir1 dir2 will produce what the OP asked for.