Friday, May 3, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 1260  / 2 Years ago, thu, september 29, 2022, 9:33:57

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?????


More From » command-line

 Answers
1

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)


[#35621] Thursday, September 29, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
giccolla

Total Points: 161
Total Questions: 124
Total Answers: 117

Location: Aland Islands
Member since Wed, Nov 17, 2021
3 Years ago
giccolla questions
Sun, Oct 17, 21, 05:39, 3 Years ago
Mon, Aug 1, 22, 02:00, 2 Years ago
Sun, Nov 21, 21, 08:21, 3 Years ago
;