alias to list a specific folder with |more


New Member
Sep 20, 2023
Reaction score
Hi all, I'm new here. Tryed to solve this with TuxBot with no success. Someone can help? Thanks and regards

To create a Bash alias that lists the contents of a specific folder and pipes it through the more command for pagination, you can add the following line to your ~/.bashrc or ~/.bash_aliases file (create the file if it doesn't exist):

alias listfolder='ls /path/to/your/folder | more'

Replace /path/to/your/folder with the actual path to the folder you want to list. After adding this line to your configuration file, you can use the listfolder alias in your terminal to list the contents of the specified folder with pagination. For example:

Sorry, with specific folder I mean any existing folder in my PC. For example, while I'm currently in my home folder, I'd like to list the content of its child folder named Templates. With the already existing alias ll='ls - laF |more' (ll Templates) I got the listing of the current home folder and, at the end, a message like * Templates/: directory *
Last edited:
One alternative is to write a function that outputs the info desired, and have it written into the .bashrc file so that it's available after logging in. For example, add the following contents to the .bashrc file (source the file in the same terminal if not rebooting):
lsdir() { ls -alF $1 | more ; }

This version requires one option for the function to run, as follows:
[flip@flop ~]$ lsdir /home/flip
total 1324
drwxr-xr-x 101 flip  flip   12288 Sep 20 23:47 ./
drwxr-xr-x   5 root root   4096 Mar 14  2022 ../
drwxr-xr-x   2 flip flip    4096 Sep 19 20:50 apple/
drwx------   2 flip flip    4096 Feb  5  2023 .aptitude/
drwxr-xr-x   2 flip flip    4096 Sep 19 20:51 articles/

If the output is too long for the screen, the "more" pager operates, but if not then not.

Note that this is just a proof of concept, and really needs a little more code to make sure that there's only one option provided to the function. Any directory can be entered as an option.

On the other hand, it may not be quite what you want.
Last edited:
Thanks a lot. This is just what I searched for. Now I only have to find a way to reproduce colors, as for 'ls -laF' alone

Members online

Latest posts