?
Solved

Linux, how to find files with spaces embedded

Posted on 2014-01-08
2
Medium Priority
?
295 Views
Last Modified: 2014-01-08
I am using RHEL 6.5

I want to locate a file named  

/mnt/path/AA BB/file1

however if I do a ls on this name it gets confused because of the spaces

How can I do an ls on this file name from root

Thanks
0
Comment
Question by:Los Angeles1
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 39766515
ls -l "/mnt/path/AA BB/file1"

ls -l /mnt/path/"AA BB"/file1

Allow any number of characters between AA and BB (e.g. spaces):

ls -l /mnt/path/AA*BB/file1

Allow exactly one character between AA and BB (e.g. space):

ls -l /mnt/path/AA?BB/file1
0
 
LVL 48

Expert Comment

by:Tintin
ID: 39766572
or if you want to find any files with a space in their name, do

find / -type f -name "* *"
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month14 days, 10 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question