Solved

Linux, how to find files with spaces embedded

Posted on 2014-01-08
2
291 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 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

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

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

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

726 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