Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We all have to use ls |more and also some other commands.

So i just need info is there a way to bind multiple commands together like I want to bind ls|more together.So when i simply pass ls command it should display some data and wait for user to press key (space bar) to show rest of the data.

Is it possible in linux?????

share|improve this question
up vote 2 down vote accepted

Yes, you can use an alias to overwrite a command. In fact, this is already the case for ls as default this is aliased as ls --color=auto

Create a file called '~/.bash_aliases' and enter the following line

alias ls='ls | more'

Now when you type ls in your terminal, it will instead execute ls | more.

In this case it does has an issue with parameters. ls /some/directory will not work anymore because the parameters are applied to more instead of ls (ls | more /some/directory will be executed)

share|improve this answer

If you want the ls command to still accept command-line switches you need to use a shell-script function, something like this should do:

ls() { command ls $@ | more; }

Put it into ~/.bashrc to make it persistent.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.