LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-11-2015, 11:49 PM   #1
Huamin
Member
 
Registered: May 2011
Posts: 562

Rep: Reputation: 12
Not able to find out file


Hi,
The file name "*wild*" should be existing within the OS, but I don't know why I get this

[root@CentOS65x64 /]# ls -R *wild* > t01.txt
ls: cannot access *wild*: No such file or directory
[root@CentOS65x64 /]#

that is being run on root folder.
 
Old 10-12-2015, 01:15 AM   #2
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
You could use the find command. Example:
Code:
find . -name "*wild*" > t01.txt


Edit: As chrism01 wrote below, this should be written with single quotes:
Code:
find . -name '*wild*' > t01.txt

Last edited by Beryllos; 10-12-2015 at 09:01 AM.
 
1 members found this post helpful.
Old 10-12-2015, 01:51 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,329

Rep: Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745
Re find cmd: best to use single quotes for wildcard chars like '*' as this ensures they are parsed by the find cmd, not the shell.
Otherwise, you could eg end up with 'too many args..' error.
 
1 members found this post helpful.
Old 10-12-2015, 08:59 AM   #4
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
Originally Posted by chrism01 View Post
Re find cmd: best to use single quotes for wildcard chars like '*' as this ensures they are parsed by the find cmd, not the shell.
Otherwise, you could eg end up with 'too many args..' error.
Thanks. I had wondered what the difference is.
 
Old 10-12-2015, 09:37 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,067

Rep: Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128
you can simply try:
echo *wild*
echo '*wild*'
echo "*wild*"
and you will see the differences. Remember, it is the shell who evaluates * (and other chars, like ?) not the echo command.
 
Old 10-12-2015, 09:59 AM   #6
hortageno
Member
 
Registered: Aug 2015
Distribution: Ubuntu 22.04 LTS
Posts: 240

Rep: Reputation: 67
Quote:
Originally Posted by pan64 View Post
you can simply try:
echo *wild*
echo '*wild*'
echo "*wild*"
and you will see the differences. Remember, it is the shell who evaluates * (and other chars, like ?) not the echo command.
Hmmm, what am I missing?
Code:
$  echo *wild*
*wild*
$  echo '*wild*'
*wild*
$  echo "*wild*"
*wild*
 
Old 10-12-2015, 10:03 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,067

Rep: Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128Reputation: 7128
nothing, In your case it is the correct answer.
But you can create some files: touch apple banana asdwildrty wildness
and check again
 
1 members found this post helpful.
  


Reply


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 to find the complete file path using struct file in linux kernel modules prabhurajreddy Linux - Kernel 2 04-17-2014 02:45 PM
Move file contents to another file with bash script (find, mimetype and cat) _furrycat_ Linux - Newbie 1 10-06-2013 12:12 PM
[SOLVED] using awk to find item listed in one file in another file - runs very long bop-a-nator Linux - Newbie 5 02-12-2013 08:37 PM
how to find free software to convert an imported .dst file to a .pes file. seabee 2 Linux - Software 3 08-28-2012 04:01 PM
[SOLVED] Find a file in directories without using find command sikanders Linux - Newbie 14 08-06-2010 09:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:24 PM.

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