Tuesday, May 27, 2008

Differences Between Windows and the UNIX System

The UNIX System and Windows differ in many ways, most of which are hidden from the user. Unless you are an expert programmer, you do not need to know how memory is allocated, how input and output are handled, or how the commands are interpreted. But as a user, if you are moving from one to the other, you do need to know differences in commands, differences in the syntax of commands and filenames, and differences in how the environment is set up. You may also want to compare how the GUI (graphical user interface) environments of both UNIX and Windows are similar, and how they are different.

If you already use Windows, you have a head start on learning to use the UNIX System. You already understand how to create and delete directories; how to change the current directory; and how to display, remove, and copy files. DOS users under Windows are familiar with command-line interfaces to execute commands. Windows users are familiar with using icons and mouse movements to perform simple tasks such as moving and copying files.

While you may never need to understand the actual operations of the “clicks and drags” you use as a Windows user, you can get a clearer understanding of the UNIX System by understanding the corresponding UNIX System commands for these basic Windows commands. These Windows commands are executed as DOS commands in much the same way that commands performed under UNIX desktop environments, such as the Common Desktop Environment and K Desktop or the GNOME desktop are actually executed as UNIX commands. We will use the term DOS in this chapter to describe the command-line environment of Windows. In later versions of Windows such as 2000 and XP, the command-line interface to DOS is replaced by the notion of CMD.EXE instead of COMMAND.COM.

Graphical User Interfaces

Microsoft Windows presents users with a graphical user interface that lets them simplify many different tasks with the help of their mouse. The Windows GUI evolved from earlier GUIs developed at Xerox Park and at Apple Computers. Analogously, GUIs have been developed for UNIX users. Originally, different variants of UNIX had their own GUIs, but standardization efforts have led to the adoption of common GUIs across many variants of UNIX, such as the Common Desktop Environment (CDE), GNOME, and KDE. It is not difficult to move from one UNIX GUI to another, since the underlying principles behind the use of these GUIs are similar.

In the same way, moving from the use of Windows with a GUI to the use of UNIX with a GUI is relatively easy For instance, both the UNIX and Windows GUI environments use icons to represent tasks, files, and directories. As an example, both UNIX and Windows use the concept of a folder to represent a directory The metaphor of “icon dragging” applies to both the UNIX and Windows GUIs. You can move icons around on a page, move the active window, enlarge or minimize it, or move file folders or contents to other folders in both environments. Likewise, the metaphor of “double-clicking” applies. When you double-click an icon in either GUI, an application executes and a new window opens to allow you to run the application. When you are done, you exit the application by selecting an “exit” icon in the active window. Even “right-clicking” is similar. When you use your right mouse button, you see either a drop-down menu of options you can perform with the current icon, or more information about it.

General Differences Between the Command Line in UNIX and in Windows

Although UNIX and Windows tasks can be executed in much the same way by using a graphical user interface, a number of differences exist between them in the way commands are executed, the way files are named and structured, and the environment under which a user interacts with the system.

Some minor differences in command syntax can be confusing when moving from one system to the other. For example, as previously noted, DOS under Windows uses a backslash to separate directories in a pathname, where the UNIX System uses a (forward) slash. In addition, the two systems require different environmental variables, such as PATH and PROMPT, which must be set properly for programs to run correctly

The file system structures also differ from one to the other. Although both Windows and UNIX use the concept of hierarchical files, each disk on a Windows machine has an identifier (for instance, C: or D:) that must be explicitly mentioned in the pathname to a file. This is because each disk has its own root directory with all files on that disk under it in a hierarchy UNIX has only one root directory, and no matter how many physical disks are associated with the files under the root directory, the files are referenced as subdirectories under the root directory This process, called mounting, shields the user from having to know where the files reside. In fact, files may even reside on different machines and still be accessed using this single root concept via remote resource mounting.

Finally, some fundamental concepts underlying the UNIX operating system are not present in DOS-such as standard input and output. And some concepts are used much less frequently in DOS, such as piping commands or using redirection of output. The differences will be outlined here, as these concepts are an essential part of learning the UNIX System.

Common Commands in UNIX and DOS

Most of the common commands in DOS have counterparts in the UNIX System. In several cases more than one UNIX command performs the same task as a DOS command; for example, df and du both display the amount of space taken by files in a directory, but in different formats. In this case the UNIX System commands are more powerful and more flexible than the DOS SIZE command (DOS 7.0 and newer versions use the CHKDSK command). Some commands appear identical in the two systems-for example, both systems use mkdir.Below table shows the most common commands in DOS and the equivalent commands in the UNIX System.

Table 18–1: Basic Commands in DOS and the UNIX System


DOS Command

UNIX Command

Display the date



Display the time



Display the name of the current directory



Display the contents of a directory


Is –l, find

Display disk usage


df, du

Create a new directory



Remove a directory


rmdir, rm –r

Display the contents of a file



Display a file page by page


more, pg

Copy a file



Remove a file



Compare two files


diff, cmp, comm

Rename a file



Send a file to a printer



In some cases, putting them together in a chart may be misleading, because they are not precisely the same. In general, the UNIX System commands take many more options and are more powerful than their DOS counterparts. For example, the UNIX cp command copies files like the COPY command does, but the UNIX ls command allows you to do a little more than the DIR command under DOS.

Command-Line Differences

The differences between how DOS and the UNIX System treat filenames, pathnames, and command lines, and how each uses special characters and symbols, can be confusing. The most important of these differences are noted here:

  • Case sensitivity DOS is-by nature-not case sensitive (except if your system supports long filename capabilities). You may type commands, filenames, and pathnames in either uppercase or lowercase, and they will act the same (e.g., the commands DIR and dir will both list the current directory and myfile and Myfile are treated as the same file). However, the UNIX System is sensitive to differences between uppercase and lowercase. The UNIX System will treat two filenames that differ only incapitalization as different files (e.g., file1 versus File1). Two command options differing only in case will be treated as different; for example, the –f and –F optionstell awk to do different things with the next entity on the command line.

  • Backslash, slash, and other special symbols These are used differently in the two operating systems. You need to learn the differences to use pathnames and command options correctly See for an understanding of the differences in structure.
Differences in Syntactic Use of Slash, Backslash in DOS and UNIX

  • Name/Function

    DOS Form

    UNIX Form

    Directory name separator



    Command options indictor


    ls –x

    Path component separator



    Escape sequences

    Not used

    \n (newline)

  • Filenames In earlier versions of DOS, filenames consisted of up to eight alphanumeric characters, followed by an optional dot, followed by an optional filename extension of up to three characters. Newer versions support something called long filenames, where the name can be up to 255 characters (or longer for some versions of XP). There still is a three-character limit on file extensions (see next entry)-since DOS uses the file extension to determine the type of file in many cases (and thus which program to associate it with). DOS filenames can have multiple dots; but if DOS detects a dot in the filename, it tries to interpret the next three characters after the last dot as the file extension. UNIX System filenames can have up to 256 characters and can include almost any character except “/” and NULL. UNIX files may have one or more dots as part of the name, but a dot is not treated specially except when it is the first character in a filename.

  • Filename extensions In DOS, specific filename extensions are necessary for files such as executable files (.EXE or .COM extensions), system files (.SYS), and batch files (.BAT), as well as Windows files used by applications (such as .DOC, .PPT, .DLL, and .AVI). In the UNIX System, filename extensions are optional and the operating system does not enforce filename extensions. Some UNIX utilities, though, use filename extensions (such as .tmp, .h, and .c).

  • Wildcard (filename matching) symbols Both systems allow you to use the * and ? symbols to specify groups of filenames in commands; in both systems the asterisk matches groups of letters and the question mark matches any single letter. However, if a filename contains a dot and filename extension, DOS treats this as a separate part of the filename. The asterisk matches to the end of the filename or to the dot if there is one. Thus, if you want to specify all the files in a DOS directory, you need *.*, whereas the UNIX equivalent is *. The UNIX System also uses the [] notation to specify character classes, but DOS does not.

No comments: