Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-23-2007, 11:56 AM   #1
LQ Newbie
Registered: Aug 2007
Posts: 1

Rep: Reputation: 0
Simple shell commands

When typing, ls, in a directory with many files, I would like it if as many files as can fit within the shell window are presented, and that there is a prompt for the next screenful to be presented.

I looked at the man page for, more, and did not manage.

Then can I also set it as an enviroment variable to remain so after a reboot?

Alex M.
Old 08-23-2007, 12:05 PM   #2
LQ Guru
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
If you have something that is too large to display all at once in the terminal, you can pipe it through either "more" or "less" (whichever is on your system), so that it is broken up into more manageable pieces.

So for example, to parse the output of ls you would do:

ls | less
This will give you the output in page form, prompting you to continue on to the next lines.
Old 08-23-2007, 12:57 PM   #3
Registered: Oct 2002
Location: Houston
Distribution: Arch, PCLinuxOS, Mint
Posts: 257

Rep: Reputation: 34
Try creating an alias to do the ls | less command. Type 'man alias' at the cli to learn how to create and use aliases.

To make it persistent between login sessions, just put your alias command into your ~/.bashrc file.

I could give you step by step instructions, but you will remember better if you figure as much out as possible on your own, before you ask for more help. You will also find that it makes more people willing to help you.

Welcome to LQ.
Old 08-23-2007, 01:11 PM   #4
Registered: Sep 2006
Location: Durham, NC
Distribution: Slackware, Ubuntu (yes, both)
Posts: 463

Rep: Reputation: 31
The pipe ("|") is one of the most important features of Unix (which in this case is Linux). You should learn to use pipes well. Bless you for using a terminal


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
simple commands automation archive Ubuntu 3 04-20-2007 04:17 PM
simple console commands Four Linux - Newbie 1 03-09-2007 06:40 PM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 02:34 PM
Simple Commands jackel Linux - Newbie 3 04-13-2004 11:43 PM
Simple C Shell script is not so simple elconde Programming 2 09-16-2001 11:53 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:51 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration