Find the answer to your Linux question:
Results 1 to 5 of 5
I know this is probably a dumb question, but since I'm new to the Linux OS, and especially to using the Linux command prompt, most likely this will be an ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2008
    Posts
    5

    Pausing the ls command


    I know this is probably a dumb question, but since I'm
    new to the Linux OS, and especially to using the Linux
    command prompt, most likely this will be an easy one.
    I'm a long time MS user and since I've used it since DOS 5,
    I'd rather use the shell to run things, plus it gives you
    more control over them.
    Since I'm wanting to move to using Linux as my main OS,
    I'm trying to find the equivalent to the more common
    shell commands that I use. One that I'm having a problem
    finding is the option for the list command 'ls' to
    pause the screen after each page, the way 'dir /p' would
    do in DOS. Can anyone help?

  2. #2
    Linux Engineer khafa's Avatar
    Join Date
    Apr 2008
    Location
    Tokyo, Japan
    Posts
    858
    what about
    Code:
    ls [Options] <your_directory_to_list> | less
    Linux and me it's a love story

  3. #3
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,733
    Welcome to the forums!

    The command given above by khafa should work for you.

    For more information on Linux commands and working with the command line under Linux, check out LinuxCommand.org.

    Below is a free online book that you can look through for additional commands:

    Linux Command Directory: Index

    Another option for additional information regarding commands is:

    Code:
    man command_name
    Hope you have fun with it.
    oz

  4. #4
    Just Joined!
    Join Date
    Dec 2008
    Posts
    5
    Thanks for the help guys. It's working great. The links have come
    in handy, too.

  5. #5
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    I want to clarify one other thing.

    In the Linux shell, as I'm sure you will learn, we do a lot of work by taking the output of one command and using it as the input to a second command. This is called piping, and allows you to perform complex behaviours very simply. It also allows commands to focus on doing one thing well, because it is very easy to interweave them.

    khafa's command is an example of this. "ls" lists files, and "less" (successor to an older command called "more") is a pager that reads input and allows you to navigate up and down and search for words.

    So what has been done here is piping the output of ls into less. However, unlike dir /p, you can pipe anything into less. So if you're compiling a program and want to see all of the output, you can do "gcc ... | less". Or if you just want to read a file more easily than printing the whole thing at once, you can just do "less /path/to/file".

    Best of luck in learning more about the Linux shell. It's a very powerful tool.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •