The Penguin and the Window have many differences and many similarities. The similarities, believe it or not, dig deep into the heart of simplicity and ease of use. The differences, however, range from the glaringly obvious to the subtly obfuscated.
One of the more subtle differences between Linux and Windows is the way the respective operating systems (OS) deal with hidden files, permissions, and filenames. Below are some useful tips regarding these three differences.
To give a file hidden attributes in Windows, simply right-click on the file and check off the Hidden check box. When that directory is refreshed, the file will no longer appear. But how do you get that file back? How do you view the contents of that newly hidden file? Linux looks at hidden files in an entirely different way. Simply put, a Linux hidden file begins with a period (.), which is where the term "dot file" comes from, and can be viewed like any other file. But why even bother making the file hidden in the first place? Hidden files are mostly configuration files that set preferences in programs, window managers, shells, and more. The reason they're hidden is to help prevent any accidental tampering by the user. This also avoids some screen clutter because the hidden files do not show up with a normal ls command.
In order to see a listing of hidden files within Linux, simply run the ls command with the -a flag so:
will return all of the contents of a directory.
Although the topic of permissions goes well beyond the scope of this document, it is important to know that due to the multiuser nature of Linux, each file and directory must have permissions that are set by either the OS or the user. Permissions are used to insure the safety and integrity of the system and its files. Without permissions, a system is wide-open for anyone to wreak havoc upon its contents.
Permissions are categorized three ways: by user, group, and other.
- user (u) refers to the owner of the file. A user who creates a file automatically owns it. Only the owner and the SuperUser (alias root) can change the permissions of a file.
- group (g) refers to the group of a file. One group of users is given special access to a file. This is determined by the file owner.
- others (o) refers to all other users on the system—that is, every account except the file's owner or users in the file's group.
If you use the ls command with the -l flag, you will see something similar to:
drwxrwxr-x 2 jlwallen jlwallen 4096 Mar 5 21:45 web
-rwxrw-r-- 1 jlwallen jlwallen 385 Feb 23 18:12 who
drwxr-xr-x 2 root root 4096 Feb 14 01:38 wpbin
drwxr-xr-x 2 root root 4096 Feb 14 01:37 wpexpdocs
Above you will see a typical long list of files and directories that contain a good deal of information. The first section is the permissions section. You will notice a 10-character string in the beginning of the listing that contains the map of permissions for that file/directory. The first character indicates whether the listing is a file with a hyphen (-) or a directory with the letter d (d). The following nine characters are in groups of three and list the (r)ead, (w)rite, and e(x)ecute permission for each. In the first example above:
drwxrwxr-x 2 jlwallen jlwallen 4096 Mar 5 21:45 web
you see drwxrwxr-x. The leading letter d (d) indicates the listing is a directory. The next three characters, rwx, indicate that the user (here jlwallen) has (r)ead, (w)rite, and e(x)ecute (or full) permission on the file. The next three characters, rwx, indicate that any member of the group that particular directory, here called web, belongs to has the same (r)ead, (w)rite, and e(x)ecute) permissions. The final three characters, r-x, belongs to other and says that all others have only (r)ead, and e(x)ecute permissions. The hyphen (-) in the last three characters indicate that other does not have (w)rite permission on the file.
Linux filenames differ from Windows filenames in a number of ways that can easily stump the MS-trained user. Within the Windows environment, it is legal to create filenames with spaces, so the name this filename is legal.txt is perfectly fine. Let's say, however, that you're in Linux and you want to view the contents of that file with the less or pico (or vi or emacs or whatever) applications. If you were to type in the command:
less this filename is legal.txt
you would have the following error returned:
[jlwallen@willow jlwallen]$ less this filename is legal.txt
this: No such file or directory
file: No such file or directory
name: No such file or directory
is: No such file or directory
legal.txt: No such file or directory
As you can see, the less application treated the filename as five different files. In order to escape this error, you would need to run the command with the filename in quotation marks. So:
less 'this filename is legal.txt'
would open up the file in question.
There is another way around this issue that makes much more sense to me. I've never understood the convention of creating filenames with allowed spaces. To me, that is confusing and dangerous. Instead of spaces, I use the underscore symbol, so the name this filename is legal.txt becomes less_this_filename_is_legal.txt. Yes, it may involve a bit more typing, but you will have a filename that is simple to access and open from within any eligible operating system. Platform independence is what it's all about!
Another issue with filenames is extensions. The common Windows OS relies on extensions to tell the system what type of program to use to open the file. Linux, however, does not rely on extensions. Try this test. Open up your favorite Linux word processing application (StarOffice, Word Perfect, Applixware, Abiword, etc) and create a test file (with some content), saving it as test.doc format. Once you've saved it, go to the console, navigate to the directory where the test file was saved, and run the following command:
cp test.doc test
The above command is basically copying the file and giving the new file an extension-less name. Now, open up that same word processor and open up both the test.doc and the test files. You should see that there is no difference in the contents of the files.
Yes, both operating systems have their similarities and their differences. There are ongoing wars between users to prove which OS is better, but frankly, it's all a matter of taste. Do you like your hidden files to be completely hidden (even from the creator's sight?) Do you prefer your computer to be a single-user environment? Do you prefer filenames with spaces? Although these questions seem a bit trivial, try living in an environment that supports one style and then move over to the other side. You'll quickly see how trivial ideologies can completely change the way you compute.
Jack Wallen, Jr., is TechRepublic’s resident Linux guru. Visit his office and you’re likely to find four or five system fans humming as he tests the most popular Linux distributions with zeal.If you'd like to share your opinion, please post a comment at the bottom of this page or send the editor an e-mail.
Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.