ls command...

gopunk

Lifer
Jul 7, 2001
29,239
2
0
i'm using ibm aix... and i want to know if there's a way to use ls but have it only list a few of the files, then i can hit a key to see more or something. i couldnt' find this in man... or maybe i'm just really stupid...
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
ls -l | more

the | is a pipe. It will redirect the output of the first command to the second command. So the output of ls -l will be piped to more.
 

pedrog

Member
Jun 30, 2001
68
0
0
*the 'more' command will do this. You can 'pipe' the output from 'ls' through more like this
*
*%ls | more
*
*It'll list untill the screen is full and wait for you to hit a key

ya like n0c said


If you are only looking for a particular file type (e.g. files beginning with the letter a) you can use wildcards

%ls a*

will list all files starting with the letter a

or

%ls *txt

will list files ending in txt
 

gopunk

Lifer
Jul 7, 2001
29,239
2
0
wow, thanks guys.

i have a question about ls a* though... suppose a is a directory... then it lists allt he contents of teh directory as well. is there a way to get it to just list the name and not the contents?

thanks, also, how do i pipe it so that the results are in columns and not one per line?
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
teh -d flag will just list directories and not their contents. I dont think you can pipe the output to more in columns...
 

gopunk

Lifer
Jul 7, 2001
29,239
2
0
thanks...

last question, i hope

how do i do it case insensitive? so i can type in ls a*, and get results even when the files start with 'A'?

i tried: ls -i a*, but that doesn't seem to work.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0


<< thanks...

last question, i hope

how do i do it case insensitive? so i can type in ls a*, and get results even when the files start with 'A'?

i tried: ls -i a*, but that doesn't seem to work.
>>



[ is a powerful command, man it sometime. in this case it would be something like "ls -ld [aA]* | more". [] is like an or what is in there. Or in something like [a-z] an a through z.
 

gopunk

Lifer
Jul 7, 2001
29,239
2
0
thanks...

i guess i was looking for something simpler. i actually already know they're all upper case, but thought there might be some flag i could type that would be faster than hitting the caps lock key

but anyways, thanks, i've learned a lot from you guys.
 

Valhalla1

Diamond Member
Oct 13, 1999
8,678
0
76
not sure if "less" comes with AIX but its better than more, you can page up/down as well as doing everything more can.


$ less ls



edit- actually I'm curious, we have some AIX machines here at work, I'll log on to one and try less
update- okay, nevermind.. this is what I got :


*******************************************************************************
* *
* *
* Welcome to AIX Version 4.3! *
* *
* *
* Please see the README file in /usr/lpp/bos for information pertinent to *
* this release of the AIX Operating System. *
* *
* *
*******************************************************************************
Last unsuccessful login: Tue Nov 27 16:50:41 CST 2001 on /dev/pts/5 from 204.XX.XX.XX
Last login: Tue Nov 27 16:50:57 CST 2001 on /dev/pts/5 from 204.XXX.XXX.XXX
$ less ls
ksh: less: not found.
$
 

gopunk

Lifer
Jul 7, 2001
29,239
2
0
hmm. our aix machines have less, but i guess it was installed separately or something.
 

pedrog

Member
Jun 30, 2001
68
0
0
On my linux box more can do page up and down also...

It works on HPUX also

pressing the 'b' button goes back on page....

return goes forward a single line and space goes forwards a page...

next ask a question about tr
 

NorthenLove

Banned
Oct 2, 2001
525
0
0
I would recomend you buy a book called Your Unix-Your Ultimate Guide by Sumitabha Das. It's a very good book which walks your through commands and their options and arguements. Along with simple filters and meta characters, shell scripting and a lot more. Really comes in handy.

ISBN : 0-70-240500-7
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
The Oreilly UNIX administrator's book is also a valuable guide. I use it even though it doesnt mention my OSes of choice. Great refrence.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |