Invisible Dot Files Revealed!


Invisible Dot Files Revealed!
Mac Tip #363, 05 November 2008

The Finder hides files whose name begins with a dot.

The Finder hides files whose name begins with a dot.

In the last Tip, The Invisible Magic of the Dot File, you created a file named .atest.txt and saved it on the Desktop. You won’t find it though: because the filename begins with a dot the system hides it from you.

So, how can we see these invisible files?

Use the Terminal to list Files

One way is to use the Terminal. Mac Tip #126/05-Nov-2003, A Historic Terminal provided a very brief introduction to this piece of software. Mac Tip #349, 30 July 2008, List Applications and More showed one way to list the files in a folder.

Use Terminal to list files. With the right command the hidden files are visible.

Use Terminal to list files. With the right command the hidden files are visible.

To recap — open Terminal and type the following command to list the content of the Desktop folder: ls ~/Desktop .

Notes:

  1. The command begins with ls (ell ess) and a space
  2. the ~ key is known as tilde. On most keyboards you find it to the left of the 1 key, and you’ll need to press Shift.

The problem is, that if you do that, you still can’t see the invisible file. I keep my Desktop clean, so the only thing that showed up in my list was test.txt. The file .atest.txt was missing.

So, I tried again, with a slightly different command:

ls -A ~/Desktop

Note: this time I typed ls (ell ess) space -A (hyphen capital A).

Here’s what this command showed me:

.DS_Store   .atest.txt   .localized   test.txt  

The .DS_Store file holds information about the folder, such as whether to use List View or Icon View. The .localized file handles folder names for different languages, such as English, Japanese etc.

I can also now see both my test.txt file and the invisible .atest.txt .

Why are these files hidden?

The Operating System hides some files because most users don’t need to know about them. Many are essential to the functioning of your computer, while a few can be safely trashed or edited.

BBEdit has an Open Hidden command that shows hidden files.

BBEdit has an Open Hidden command that shows hidden files.

There’s an important rule though: trashing a hidden file could break your operating system and make your computer unusable. If you don’t know what a hidden file is and does then don’t touch it.

Other ways to see hidden files

Pathfinder, a Finder replacement, can hide or show hidden files.

Pathfinder, a Finder replacement, can hide or show hidden files.

Sometimes hidden files show up when you use certain programs. For example, I do most of my writing work with software called BBEdit. It has a menu option to ‘Open Hidden…’ because web designers often need to work with a hidden file called .htaccess.

I also use software called Pathfinder that replaces the built-in Finder. It offers many advantages, including a menu item to show and hide invisible files.

Try all these great Terminal Tips

Related posts

[wpzon keywords="pressure cooker" sindex="PCHardware" snode="1232597011" sort="salesrank" listing="8"]

2 Comments

  1. Miraz Jordan said:

    Excellent question Jenna.

    the trick for web developers is to change the filename once the file hits the server. So: create a file on your own computer called htaccess (without the dot), upload it to the server and change the filename there to .htaccess.

    Meanwhile:

    1] on your Mac open Terminal and change directory to where the file is on your Mac. For example, on my Mac I have a file called .htaccess inside the Sites folder in my User directory.

    I’d type this:

    cd /Users/miraz/Sites

    Now if you type ls -la you should see the .htaccess file listed.

    2] Now *move* the file to the same directory but with a different name. The new name does not have the dot. Like this:

    mv .htaccess htaccess

    3] Now you can see the file in the normal way, without having to mess around with the Terminal. Open it with your usual text editor (NOT MS Word).

    Extra TIP: the easy way to change directory in terminal:

    1] open a Terminal window and type cd [space]
    2] open the Finder window you want to cd to
    3] drag the proxy icon (the wee folder) from the title bar of the Finder window into the Terminal window. This inserts the path to that folder
    4] in Terminal press Return

    I hope that helps.

    Cheers,

    Miraz

  2. Jenna M said:

    I am self-taught in all of this so I found this tip incredibly helpful. I was able to view my files via the Terminal but how do I open them? I’m trying to find an htaccess file so I can upload it to MODx, a WYSIWYG program. I want to avoid having to pay for Path Finder. Grateful for any advice you can offer on this subject!

Comments are closed.



Top