LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 02-16-2009, 06:50 PM   #1
odimachkie
LQ Newbie
 
Registered: Feb 2009
Posts: 19

Rep: Reputation: 0
is there a "/p" dos like command in llinux?


im very new at this...

i'm going through some tutorials on script writing and am having some issues


when you run a command that takes more than one page of display, how do you get it to pause?

i tried running the set command (still not sure what exactly im looking at) and all i see is miles of code flash before my eyes...

thanks

side question, is there a "ultra newbie" forum, because as i look at the posts here i feel as if i'm a little behind the times...
 
Old 02-16-2009, 06:53 PM   #2
dbogdan
Member
 
Registered: Feb 2005
Location: Metro Detroit, US
Distribution: Suse/Slackware/Mepis
Posts: 174

Rep: Reputation: 31
try ls -al | less
 
Old 02-16-2009, 07:27 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,838

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
To explain that a little ...
In linux the output of (most) commands you'll use goes to stdout - to all intents, the terminal.
Rather than a "/p" switch if you want to page through the output, you pipe (redirect) stdout to a pager program. You may have used "more" for this under DOS. "more" is available under Linux also, but is a little limited - hence "less" (yes, a geek pun) emerged.
When finished with the output, enter "q" (no quotes) to quit.

Plenty of tutorials around - search LQ for recommendations.
 
Old 02-16-2009, 09:16 PM   #4
GsXs
LQ Newbie
 
Registered: Jan 2009
Location: Brazil
Distribution: Slackware
Posts: 10

Rep: Reputation: 0
Like "/p" would be the "more" command.
For instance, to read the "file.txt" you can pipe the cat output (as syg00 mentioned).

cat file.txt|more #here's exactly the "/p" used in DOS

Or you can use "less", to roll up and down the page.

cat file.txt|less #press up, down, PgUp or PgDown key to roll up and down
 
Old 02-17-2009, 12:27 AM   #5
odimachkie
LQ Newbie
 
Registered: Feb 2009
Posts: 19

Original Poster
Rep: Reputation: 0
Thank you all of you for the help...

Since i posted that question ive probably come up with 50 more.
but if you will please indulge me with one more answer...

although i love forums, i am usually an independent learner, meaning i like reference texts.
how would i have found the answer to my question (which command to use, and when) without stumbling through Google search results???
or to rephrase, are there resources you would recommend to someone trying to learn how to use shell? something that starts from the ground up..

Again, i really appreciate the help.
 
Old 02-17-2009, 12:30 AM   #6
Ranguvar
Member
 
Registered: Oct 2008
Location: Upstate NY
Distribution: Arch Linux
Posts: 99

Rep: Reputation: 17
A Google for 'Learn linux shell' provides:

http://www.linuxcommand.org/learning_the_shell.php

And probably some others
 
Old 02-17-2009, 12:57 AM   #7
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Another good resource for bash :

http://linux.about.com/od/bgb_guide/a/gdebgb_idx.htm
 
Old 02-17-2009, 04:16 AM   #8
rich_c
Member
 
Registered: Apr 2008
Location: UK
Distribution: Mepis; Maemo; openSUSE
Posts: 384
Blog Entries: 74

Rep: Reputation: 81
Pipe the output to pg. For example, ls -l | pg.
 
Old 02-17-2009, 04:20 AM   #9
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
That works in Ubuntu but not in RH.
 
Old 02-17-2009, 05:36 AM   #10
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,052

Rep: Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881
Quote:
Originally Posted by odimachkie View Post
how would i have found the answer to my question (which command to use, and when) without stumbling through Google search results???
In principle, either
Code:
apropos
or
Code:
man -k
the trouble is finding a good 'hit' out of the pile of hits that you get. But you can always try:

Code:
apropos string1 | grep -i string2
to get something that contains both string1 and string2. Often this is quite useful, but in this case, if you don't know that either 'more' or 'less' were involved, I don't know how you would succeed.
 
Old 02-17-2009, 06:17 AM   #11
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by salasi View Post
if you don't know that either 'more' or 'less' were involved, I don't know how you would succeed.
Easy: the original poster was talking about DOS, well, let's talk about DOS Only very few DOS commands did have a /p option, it was a design option of the command or tool itself, and had nothing to do with the OS really.

So, since most DOS tools and commands didn't have a /p, and DOS was perfectly capable of using redirection and pipes (they weren't as powerful as in the Linux shells though), there was also a "more" tool in dos which could be used to pipe output from other commands much like the "more" and "less" tools in Linux.

So, yes, the "more" pager was also present in DOS, so, in first place, there was nothing to find at all. It was also frequent to use something like "<whatevercommand> | more" in DOS. It's exactly the same.

 
Old 02-17-2009, 09:29 AM   #12
pcunix
Member
 
Registered: Dec 2004
Location: MA
Distribution: Various
Posts: 149

Rep: Reputation: 23
Quote:
Originally Posted by i92guboj View Post
So, yes, the "more" pager was also present in DOS, so, in first place, there was nothing to find at all. It was also frequent to use something like "<whatevercommand> | more" in DOS. It's exactly the same.

Exactly the same like a tricycle is exactly like an bus because they both have wheels.

My memory of Dos "more" is that it was only a filter - you couldn't say "more file". Dos pipes were horrible (they actually wrote to a disk file and read that!) and most Dos commands couldn't use them anyway - because Microsoft's brilliant programmers didn't understand the value of pipes, utilities would throw out all kinds of extraneous junk that you didn't want..

And yet, thanks to the "brilliant" business acumen of Mr. Gates (you know, putting stuff in the OS to cripple competitors, bullying hardware vendors and so on) that junk became numero uno.

Isn't it wonderful that they really look like they could fail now? Don't you just want to hug everyone you see and say "Yes! Windows could die soon! Isn't life GRAND?"
 
Old 02-17-2009, 09:48 AM   #13
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by pcunix View Post
Exactly the same like a tricycle is exactly like an bus because they both have wheels.

My memory of Dos "more" is that it was only a filter - you couldn't say "more file". Dos pipes were horrible (they actually wrote to a disk file and read that!) and most Dos commands couldn't use them anyway - because Microsoft's brilliant programmers didn't understand the value of pipes, utilities would throw out all kinds of extraneous junk that you didn't want..
I am not here to argue how bad DOS was. That's off this topic. My point what that exactly the same construct, character by character, with the same syntax existed and was very used in DOS, hence, salasi's last statement is to say the least strange when speaking about someone who came from DOS (now talking about the OP, not salasi). For someone coming from DOS it seemed like the first thing to check, but hey, we all fall in the simplest thing some times, and I am particularly "good" at that

I already commented that DOS piping mechanism wasn't quite the same (to say it in an euphemistic way) than it is in Linux by the way, though a big part of the DOS dumbed down functionality is about its -dumb- shell. Those who used 4DOS instead of command.com at some point surely know that.
 
Old 02-17-2009, 08:16 PM   #14
odimachkie
LQ Newbie
 
Registered: Feb 2009
Posts: 19

Original Poster
Rep: Reputation: 0
i didnt know a page command could bring up such controversy are all linux users this feisty?

i'm now realizing with the help of some tutorials and reference that pipes are a very integral part of shell scripting. how to use them properly still baffles me, as a solid understanding of the commands you're piping together is important to secure first.
thanks for the resources chaitanya and Ranguvar, i'll be drying my eyes with them tonight...
 
Old 02-17-2009, 08:21 PM   #15
pcunix
Member
 
Registered: Dec 2004
Location: MA
Distribution: Various
Posts: 149

Rep: Reputation: 23
Quote:
Originally Posted by odimachkie View Post
i didnt know a page command could bring up such controversy are all linux users this feisty?
:-)

Maybe some just need their humor circuits retuned..
 
  


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
Linux equivalent to DOS "tree" command? XDude Linux - Newbie 10 09-25-2014 01:24 PM
Cedega from Fat32 (Invalid path "." given for "--use-dos-cwd") bdox Linux - Software 0 03-30-2005 12:24 PM
Cedega and Fat32 (Invalid path "." given for "--use-dos-cwd") bdox Linux - Games 0 03-26-2005 03:48 AM
Equivalent to Dos "Type" command? greendemon Linux - Newbie 2 08-04-2003 05:48 AM
Linux Equivilant to DOS "Type" command Huggles Linux - General 9 02-27-2002 11:19 PM


All times are GMT -5. The time now is 12:38 AM.

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