1. Code Used

1: ls --color -h --group-directories-first

2: alias p='ls --color -h --group-directories-first'

2. Example

Usually, when you type a simple ls command in the bash terminal your files will be displayed alphabetically:

cs_1_1

If you want your files sorted with the directory listings first, you can use the following command:

ls --color -h --group-directories-first

This gives the following result:

cs_1_2

Given that this is a pretty long command to type in constantly, you might set it as an alias:

alias p='ls --color -h --group-directories-first'

Now you can type ls for the regular (alphabetic) listing and p for the directories-first listing:

cs_1_3