Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I believe there's a simple fix but cannot debug it out.

I have file called "file name with space" How do I cat this file from Linux bash ?

share|improve this question

migrated from Jun 12 '13 at 20:14

This question came from our site for professional and enthusiast programmers.

cat "file name with space" or cat file\ name\ with\ space – ctn Jun 12 '13 at 18:22
cat "file with space" doesn't work!? Good luck. – shellter Jun 12 '13 at 18:22
Sure: name your file file_name_with_underscore... – H2CO3 Jun 12 '13 at 18:27
@H2CO3 Why if it works if everythin is implemented well? – glglgl Jun 12 '13 at 18:34
@glglgl Safe, convenient, cross-platform and idiomatic. – H2CO3 Jun 12 '13 at 18:35
up vote 6 down vote accepted

Does putting quotation marks around the name not work?

cat "file name with space"
share|improve this answer

Use the escape character '\' like this

cat file\ name\ with\ space
share|improve this answer

A third option would be

cat 'file name with space'

where the file name may contain everything but the '.

If it does, such as file n'ame, replace every ' with '\'':

cat 'file n'\''ame'
share|improve this answer

Enclosing the file in double quotes should work i.e.

cat "file name with space" 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.