Solved

Linux, how to find files with spaces embedded

Posted on 2014-01-08
2
281 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 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now