Skip to content

How to work on Linux with filenames that contain blanks

Personally, I always try to avoid filenames with blanks, usually by filling those places where less blank-phobic people would use them with underscores or hyphens. The filenames are still easy to decipher, and I don’t have to trouble myself with enclosing them in quotes when I want to use them. As a result, some of my files look like this:


I also rarely add .txt file extensions to the end of text files unless I plan to share them with my Windows system.

Use quotes

When blanks in file names are preferable for any reason, however, there are several easy ways to work with them. To reference existing files, you can enclose the filenames in single or double quotes. In fact, you can make this easier by starting with a quote mark, typing as much of the filename as needed to differentiate it from other files and then pressing the tab key to initiate filename completion. For example, typing the portion of a filename as shown in the example below and then pressing tab should add the rest of the filename to the “file n” beginning:

To read this article in full, please click here

Source:: Network World – Linux