how to open a file which contain space in the file name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sameera741
    New Member
    • May 2015
    • 1

    how to open a file which contain space in the file name

    hi

    i have file called "space in this filename" i have tried to open it with the cat command but it's showing a error massage .
    pls if any one know how to open this kind of file let me know
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    Actually, this is a pretty common thing. If you put a "\" character before the space, you should be able to open it, like so:

    Code:
    cat ./space\ in\ this\ filename
    Also, on linux systems (at a minimum), where you have tab complete functionality, simply typing:

    Code:
    cat ./space
    and then hitting the tab key, should complete the filename for you.

    Regards,

    Jeff

    Comment

    • computerfox
      Contributor
      • Mar 2010
      • 276

      #3
      Or the cleaner way, especially when using it in code, use quotes around the name.

      For example, "./space in this filename"

      and in code, it would look like:

      Python
      Code:
      #!/bin/python
      print open('./space in this filename').read();
      Last edited by computerfox; May 21 '15, 02:19 AM. Reason: More details.

      Comment

      • ChristianC123
        New Member
        • Aug 2017
        • 6

        #4
        Quote the commands

        eg cat "file name.txt"

        Regards,
        Christian
        Windows Virtual Desktop hosted in the Cloud. Easily manage, add users & applications. Office 365 & GPU options. 24/7 support. Take a risk free trial!

        Comment

        Working...