LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 08-23-2007, 12:56 PM   #1
Alexman
LQ Newbie
 
Registered: Aug 2007
Posts: 1

Rep: Reputation: 0
Simple shell commands


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


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

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
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:

Code:
ls | less
This will give you the output in page form, prompting you to continue on to the next lines.
 
Old 08-23-2007, 01:57 PM   #3
dickgregory
Member
 
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, 02:11 PM   #4
trashbird1240
Member
 
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
 
  


Reply


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 05:17 PM
simple console commands Four Linux - Newbie 1 03-09-2007 07:40 PM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 03:34 PM
Simple Commands jackel Linux - Newbie 3 04-14-2004 12:43 AM
Simple C Shell script is not so simple elconde Programming 2 09-17-2001 12:53 AM


All times are GMT -5. The time now is 04:16 PM.

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