ls command basics???


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ls command basics???
# 1  
Old 10-02-2011
ls command basics???

how do i use the ls command with a single argument to list all files whose names end with the letter 'r'?
# 2  
Old 10-02-2011
$ ls *r
or
$ ls -l *r
This User Gave Thanks to budz26 For This Post:
# 3  
Old 10-03-2011
sweet thanks, do you know how to list only 4 letter words in a directory?

---------- Post updated at 08:23 PM ---------- Previous update was at 08:03 PM ----------

How do i use the ls command with a single argument to list all files whose names contain only 4 letters? Also, How do i use the ls command with a single argument to list all files whose names contain either an 'l' or an 'n' as the third letter?Smilie
# 4  
Old 10-03-2011
4 letter files
Code:
ls | egrep [a-z]{4}

3rd letter l or n
Code:
ls | egrep "..[l|n]"

Not sure if "ls" command alone can be used to get all these.

--ahamed
This User Gave Thanks to ahamed101 For This Post:
# 5  
Old 10-03-2011
hmmmm..... i cant get that command to work??
# 6  
Old 10-03-2011
ls ??[l-n]?
# 7  
Old 10-03-2011
this will work i guess..if the length of the words is same...
try to increase or decrease the dots depending on the size of the word
Quote:
ls | egrep [a-z]..[r]
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

UNIX Basics

Hello, 1) I am trying to get involved in UNIX for educational purposes so I have installed the latest Ubuntu edition 12.04. Do you know another package that I could use it instead for educational purposes? 2)What is the difference between "~$" and "/$" (it comes with cd / and cd ~) .The... (1 Reply)
Discussion started by: Iwn
1 Replies

2. UNIX for Dummies Questions & Answers

help me with basics

hello everyone i have to start with unix as it is a part of my training programme and i have to do a self study, i dont know where to start from. i need some basic questions to be answerd like why we use unix ? what is a terminal? what is an editor? why we write commands inside terminal? these... (4 Replies)
Discussion started by: aryancool
4 Replies

3. AIX

AIX Basics

Hello , Everyone , I want to know the Aix Basics and how it works ,hardware related problems and solution etc. (1 Reply)
Discussion started by: narendram
1 Replies

4. UNIX for Dummies Questions & Answers

awk basics

Hi, Please tell me where can I get started with awk..like the basics and the whole awk stuff. Regards, Deepti (2 Replies)
Discussion started by: gaur.deepti
2 Replies

5. AIX

DB2 basics

Dear friends I am going to study DB2 and i dont have any experience with any DB's.. Please provide me with some links or pdf's for DB2 starters. any advice will be very usefull (2 Replies)
Discussion started by: Vit0_Corleone
2 Replies

6. IP Networking

SAN basics

Hi I like to learn and practice SAN, iSCSI. Could you sugges the appropriate tutorial and small tasks to practice SAN. Thankyou (1 Reply)
Discussion started by: kingskar
1 Replies

7. UNIX for Dummies Questions & Answers

Installation basics

hello, Im new to this Os. so, can i get any information'bout installation basics of unix. (1 Reply)
Discussion started by: Abhijit Bhatt
1 Replies

8. Shell Programming and Scripting

Shell basics

Hi All, I have a basic question in Scripting. Can anyone tell me what is the difference b/w the two syntax : if (( $lines = 0 )); and if ; when do we use the square brackets & when to use the paranthesis. Thanks, Pradeep (3 Replies)
Discussion started by: pradeep_desh
3 Replies

9. UNIX for Dummies Questions & Answers

UNIX Basics

I want to learn UNIX, but I have a few questions. If anybody could help me out I'd greatly appreciate it. First, I've decided I'm going to use Red Hat Linux and I've been told the only difference between 7.2 and the Professional (besides the price), is the tech support that you'll receive. Is... (2 Replies)
Discussion started by: paulSF
2 Replies
Login or Register to Ask a Question