LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Puppy
User Name
Password
Puppy This forum is for the discussion of Puppy Linux.

Notices


Reply
  Search this Thread
Old 03-19-2016, 08:26 PM   #1
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Rep: Reputation: 169Reputation: 169
ls using wildcards


Is there a way to get ls to use wildcards ?

ls *.txt
 
Old 03-19-2016, 08:47 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,780

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
It's the job of your shell to expand wildcards and pass the resulting list to the invoked command. Very few programs other than shells handle wildcard expansion ("globbing").
 
Old 03-20-2016, 08:28 AM   #3
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Okey dokey.
 
Old 03-20-2016, 08:35 AM   #4
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
http://www.linfo.org/wildcard.html
 
Old 03-20-2016, 10:12 AM   #5
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by Fixit7 View Post
Is there a way to get ls to use wildcards ?

ls *.txt
That works for me, what issues are you seeing?
 
Old 03-20-2016, 10:55 AM   #6
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
That actually works.

I meant ls*.*
 
Old 03-20-2016, 11:01 AM   #7
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by Fixit7 View Post
That actually works.

I meant ls*.*
That works too, on my system, returning all files with a dot inside the name. To list everything, including hidden files, if that's what you need it's "ls -a".
 
Old 03-20-2016, 02:35 PM   #8
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
SOLVED

I have a Windows background.

And *.* means any and every file.

Last edited by Fixit7; 03-29-2016 at 06:28 PM.
 
Old 03-20-2016, 02:48 PM   #9
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by Fixit7 View Post
I have a Windows background.

And *.* means any and every file.
Apologies to be a little picky but that's not strictly speaking true. The pattern "*.*" was commonly used to represent "all files, but not directories" and was principally used to delete the file contents of a directory with "del *.*". To delete everything, however, a simple "del *" would work -- the dot is specifically used to exclude directories because all files had extensions "back in the day". It's a fairly common misconception but worth noting especially in the light of PowerShell and the reduced need for file extensions in modern Windows versions.
The ls command doesn't have an option to just show files, that I know of, but the find command can be used instead.
 
Old 03-29-2016, 08:25 PM   #10
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Display or list only files in Unix

Quote:
$ ls -l | egrep -v '^d'
 
1 members found this post helpful.
Old 03-30-2016, 12:52 AM   #11
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by Fixit7 View Post
Display or list only files in Unix
Thanks, nice little tip.
 
Old 03-30-2016, 09:12 AM   #12
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Your welcome.
 
  


Reply



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
Wildcards randalleg Linux From Scratch 3 06-19-2011 08:09 AM
need help with wildcards yanivmomo Programming 4 05-24-2010 07:37 AM
need help with wildcards liorpana Programming 2 05-12-2010 08:45 AM
using wildcards nadroj Linux - General 5 01-28-2007 08:39 PM
Wildcards dazdaz Linux - Newbie 3 01-23-2005 05:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Puppy

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