Bash connection ls output

How can I join the results of 2 ls? “I need this because the files are in two different directories, and I need to sort them differently.”

In any case, for the output, I need a regular list with both results.

+3
source share
4 answers

No need to run twice ls, just specify a few file parameters as arguments.

ls /path/to/first_file_spec* /different_path/to/second_file_spec*
+4
source
(ls <first dir>; ls <second dir>) | sort ...
+2
source

:

{ ls folder1 && ls folder2; }

:

:

{ ls /etc/fonts && ls /etc/init; }|while read i; do echo $i; done

(, - , ).

+1

, find - "directory:", ls, .

find /etc/dpkg/ /etc/apt -mindepth 1 -maxdepth 1 | sort

, printf,

find /etc/dpkg/ /etc/apt -mindepth 1 -maxdepth 1 -printf "%f\n" | sort
0
source

Source: https://habr.com/ru/post/1776001/


All Articles