Share your knowledge at the LQ Wiki.
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 04-19-2016, 02:49 AM   #1
arun natarajan
Registered: Jun 2014
Posts: 111

Rep: Reputation: Disabled
filter only files with starting character.


From the directory cg, i want to list only files starting with v.
Though i ve tried different cmds, its not helping
I dont want to use FIND cmd here.
[root@server cg]# ls -ltr
total 68
-rw-r--r--. 1 root root 45650 Apr 19 09:30 passwd-bkp
-rw-r--r--. 1 root root 43 Apr 19 10:02 user
-rw-r--r--. 1 root root 120 Apr 19 11:17 employees
-rw-r--r--. 1 root root 88 Apr 19 11:22 op.txt
-rwxr-xr-x. 1 root root 109 Apr 19 11:38 sap
-rw-r--r--. 1 root root 0 Apr 19 12:53 van
drwxr-xr-x. 03 root root 4096 Apr 19 12:57 volvo

[root@server cg]# ls -l v*
-rw-r--r--. 1 root root 0 Apr 19 12:53 van

total 4
-rw-r--r--. 1 root root 0 Apr 19 12:57 c1
drwxr-xr-x. 2 root root 4096 Apr 19 12:57 d1

[root@server cg]# ls -l v* | grep ^-
-rw-r--r--. 1 root root 0 Apr 19 12:53 van
-rw-r--r--. 1 root root 0 Apr 19 12:57 c1
Old 04-19-2016, 03:13 AM   #2
Senior Member
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,703
Blog Entries: 23

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
edited out - sorry - answer was for some other thread...

Last edited by ButterflyMelissa; 04-19-2016 at 03:14 AM. Reason: posted in the wrong thread, sorry
Old 04-19-2016, 03:26 AM   #3
LQ Guru
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,719

Rep: Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034
I never really understand when people say "I don't want to use command X". if a particular command is designed to do exactly what you want, why would you want to combine several
to achieve the same task?

Processing ls in of itself can be error prone and find will do the task.

By all means, keep creating your new better wheel.


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
ls only files starting with upper case character sancho1980 Linux - Newbie 17 09-29-2016 08:41 AM
[bash] find - filter files matching a list of files hashbang#! Programming 6 11-25-2010 05:01 PM
Some character adding up starting of log file? your_shadow03 Linux - Newbie 42 03-03-2010 07:26 AM
open office doesn't work and gives me the Filter Selection box on starting chadwick Linux - Software 3 06-18-2009 06:09 PM
Is it possible to have sed only process starting from, say, the 9th character on? lumix Linux - Newbie 3 05-13-2008 09:26 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:10 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration