Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-12-2009, 08:18 AM   #1
LQ Newbie
Registered: Sep 2009
Posts: 23

Rep: Reputation: 15
how to "ls" file starting with ./

When i do below command, i get the output:
linux% find ./work_work -type f
./work_work/bad_summary/ 123.log
./work_work/bad_summary/12 212.log

When i do below command, i get the output:
linux% ls work_work/| grep -P "^( |-)"

How to get exactly like 1st out put (starting with ./) with second command (using ls)?

Urgent, thankful for those who can help me..
Old 11-12-2009, 08:46 AM   #2
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Rep: Reputation: 55
Originally Posted by simransab View Post
When i do below command, i get the output:
linux% find ./work_work -type f
Try with
ls -Rl | grep '^-' | grep "work_work"
Cheers !!!

Last edited by vinaytp; 11-12-2009 at 08:51 AM.
Old 11-12-2009, 08:55 AM   #3
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,803

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
Urgent?? Why? Is anyone in danger or needing medical attention?

When you say "exactly like", I am **guessing** that you mean that you want the path from the current directory. I don't find a simple way of doing it, but it seems there should be one. Look at "man ls" and "man -k path"


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
how can I "cat" or "grep" a file to ignore lines starting with "#" ??? callagga Linux - Newbie 7 08-16-2013 07:58 AM
Hostname defined in file "network" changes after change to file "hosts" qwkfish Linux - Networking 2 10-14-2009 05:07 PM
gs not starting "CRIT: rangecheck in get" some TTF file duryodhan Slackware 2 10-01-2007 12:37 AM
"No such file or directory" when starting tinyX rhauff Linux - General 1 12-23-2003 08:53 AM
Can't locate object method "splitpath" via package "File::Spec" RobJohnston Linux - General 2 06-28-2003 10:59 AM > Forums > Linux Forums > Linux - Newbie

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

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