Linux - The Same But Different

 

Part of the process of moving to Linux is to start with what is familiar. Well, we looked at making the desktop look like our familiar Windows® desktop. So are there other ways to make Linux more “transition friendly”? Yes, and No!

This is not to be cryptic, just honest! Since both operating systems contain similar functions, they could necessarily have similar applications to perform those functions. But because they have some fundamental differences, they will also necessarily have stark departures. First, the concentration will be on the similarities so that a clear path of transition can be indicated. Later some differences you will likely encounter will be covered.

File Structures

A simple description of the UNIX system, also applicable to Linux, is this:

“On a UNIX or Linux system, everything is a file; if something is not a file, it is a process.”

This statement is true because there are special files that are more than just files (named pipes and sockets, for instance), but to keep things simple, saying that everything is a file is an acceptable generalization. A Linux system, just like UNIX, makes no difference between a file and a directory (folder), since a directory is just a file containing names of other files. Programs, services, texts, images, and so forth, are all files. Input and output devices, and generally all devices, are considered to be files, according to the system.

Frequent Windows® users know that Microsoft® has developed a supporting stucture of files and folders that makes it easy to organize and find data you have stored. In order to manage all those files in an orderly fashion, users like to think of them in an ordered tree–like structure on the hard disk. This system of files and folders is addressed using a pathname or URL (short for universal resource locator). Pathnames given under DOS (the Microsoft Operating System core) is designed to denote the volume, folder, and file or folder with a one to three character extension. Backward compatibility is enforced at the command line by specifying only 8 characters for a filename followed by a period and a one to three character extension. The desktop does not enforce this restriction and allows longer file and folder names with special charaters and spaces included. The elements of this URL are separated by a backward slash character (“\”). The volume is denoted by a single character beginning with “A” through “Z” and followed by a colon (“:”). This URL notation worked well for small single user systems, but as technology advanced – Microsoft made only minute changes in the URL notation. Today, users may have terrabytes of data available in multi–device arrays. The simple volume–folder–file notation is no longer adequate.

Linux, as an outgrowth of its’ big brother Unix, has developed URL notation that is much more flexible and useful. The physical device or partition on a device is useful only when naming a resource. It is also true that each partition may be formated with different style formatting (e.g. ext3, ext4, ntfs, fat, etc.). For instance, if we have a physical drive that is 500 Gb large and we have logically divided it into 5 partitions (one Windows® NTSF, one FAT, and ext3 or ext4) we can assign any name we wish to any of these physical or logical resources and from that point on use the volume name rather than the physical or logical designation.

A workstation or client installation is for use by mainly one and the same person. The selected software for installation reflects this and the stress is on common user packages, such as nice desktop themes, development tools, client programs for E-mail, multimedia software, web and other services. Everything is put together on one large partition, swap space (an area on the disk for Linux to use as virtual memory) twice the amount of RAM is added and your generic workstation is complete, providing the largest amount of disk space possible for personal use, but with the distinct disadvantage of possible data integrity loss during problem situations.

On a server, system data tends to be separate from user data. Programs that offer services are kept in a different place than the data handled by this service. Different partitions will be created on such systems:

Servers usually have more memory and thus more swap space. Certain server processes, such as databases, may require more swap space than usual; see the specific documentation for detailed information. For better performance, swap is often divided into a different partition specifically for this purpose and none other.

Looking at the theoretical physical device mentioned earlier, if we want to make one of the ext3 partitions our system volume for Linux, we can assign it to be mounted as “/” - meaning this is the root or system volume. We can also tell the partitioner program that one of the ext3 partitions can be used by the system to improve performance by swapping applications out of memory to disk and back as needed. This partition can be mounted as “swap”. Users can have their own area for data by assigning “home” to one of the ext3 partitions. That way all of the user data is contained in the volume mounted as “home”. So, if we want to notate a file for a specific user, we would write the URL as “/” (the starting volume in all Linux URL pathnames), “home/” to direct the path to the users area, “user/” the login name of the user, and “filename.ext” or “foldername/filename.ext” as the folder or filename. The entire pathname can be up to 1024 characters long whether we are on our desktop or at a command prompt in a terminal. If you have ever used the command window in Windows® you know that URL notation requires you to shorten all folders and files to 8 characters long and no more than 256 characters total. This is not a limitation on Linux or Unix. There is a requirement on Linux/Unix systems to either use names without spaces, or refer to them in quotes that encapsulate the spaces (e.g. /"Program Files"/ instead of /Program Files/).

Since Linux treats every resource as a file, it important to know about the different file types. There are quite a few file types used by Linux including: “normal” files (text, data, executables, etc.), directory entries, links to other files, named pipes, sockets, and block devices.

Typical Linux systems (server and destop workstations) can have certain default folders created by the underlying file system. Among the folders created by default are:

The phyical device and/or partition that any or all of these folders may use is determined by the mount point given by the partitioner (review the discussion earlier if this is still confusing). This is quite a few more folders than created by default on a new Windows® installation.

A stark difference between Linux and Windows®, is that Linux will use case sensitivity for naming of URL pathnames. On Windows® you were not concerned with this since DOS always converted pathnames to upper or lower case automatically. Linux does not assume this, and will take your pathname exactly as you type it. That means that “/home/path/Path/patH/FILENAME.EXT” is not interpreted as all caps or all lower case. It is used as typed. This is a source of much confusion for new users of Linux, and can be avoided by remembering these simple concepts early in the learning curve.

You should also not assume you have access to all paths on your system or permission to read, write, and execute files on all paths. Unlike Windows®, Linux requires that each user be assigned specific permissions for access to any path or file – even execution of applications and system functions. The actual folder and file stored on your system also has permissions assigned to it that must match your login to allow access. Your login name determines whether you can access and/or execute even common applications by virtue of how your system administrator (you if yours is a single user desktop system) has set your permissions values upon creation of your login. Linux is, of course, very flexible and allows files, folders, and user permissions to be changed by administrators to suit the need for access by any user or group...or all users. Once again you should turn to your Elmer to show you how to do this and when it is important. It is especially important, if you have full time high–speed Internet access. It is possible to protect your system from hackers even in the unlikely event that they do get into your system. This is taking into consideration protection that is beyond your personal firewall (an application common on many distros that roughly equates to Windows Defender® albeit much more versitile and robust).

Administration of Linux systems is an extensive subject not covered here.

If you have used Windows® for very long you will have had the occasion to use the Command Prompt or Command Window. This environment is a non–GUI (Graphical User Interface), text only environment. At the prompt you enter DOS commands to perform various functions without using the Windows® desktop. Until Windows XP®, the command prompt was the default environment. The window manager was executed as a system command. In recent versions of Windows®, the window manager is the default environment and you must start a command environment in a desktop window. Linux is much like the earlier versions of Windows® in that X–window, and the window manager boot in command line mode (called a shell) and then starts the window environment (the desktop GUI) after login.

Unlike the DOS shell that only understands the narrow DOS command set, Linux can understand a number of different shell command sets. The default command set for most distros is the Bourne shell. Other command sets(shells) include:

It is possible for any user to switch between command sets at will. Command batch files can also use different shell types between files. One script can be bash while it calls another written in python or korn. This flexibility provides system programmers and users with a huge array of commands to perform basic system tasks.

One of the most powerful things a user can do at the command prompt is viewing and changing file an folder permissions. To do this the X–windows user must start a terminal (a window that allows command line access). The Windows® DOS command to list files in the current directory is DIR. The Linux command to do the same thing is ls (for list system). The resulting list is all folders and files visible from the current folder (i.e. working folder). Some distros include additions to the shell that mimick the DOS commands. The use of these is not recommended due to the lengthening of the learning curve for the new user.

If you want to know where you are (what folder is current) you can type pwd (or print working directory – observe the lower case – not PWD or Pwd). On most Linux systems colors may be seen for different file types. Quite often blue is used for directories, white for text files, green for executables, cyan for links and pink for image files. This is not a hard and fast rule and may vary widely from distro to distro. It is also system configurable by each user to their preference.

The ls command can be given some options that provide more information or expand the display to multiple columns. If the user types ls -l the visible folders and files are listed along with several columns of specific information about each. A typical listing might look like (your system prompt may look different):

 ken@ken-shack:~$

 ken@ken-shack:~$ ls -l

 total 23222
 drwxr-xr-x 11 ken users      4096  2009-04-21 09:50 google-earth
 drwxrwxr--  9 ken root       4096  2009-09-02 13:25 installbuilder-6.2.1
 -rw-r--r--  1 ken ken       17983  2009-12-15 09:43 gpl-lic-v2.0.txt
 -rw-r--r--  1 ken ken       49734  2009-09-17 10:16 LaSectionAppointments.ods

 ken@ken-shack:~$

This partial listing is quite informative. It shows several file types and the permission information of each. Permissions are indicated by the string of characters at the start of each line. The first character is the file type. The next 10 characters indicate (r)ead, (write), and (x)ecute permission for user, group, and other categories. Recall the information provided so far has indicated that user permission must match file permission to access or execute each folder or file. So for the google–earth folder (indicated by the d in the first column) the user must have at least read–write and/or execute permission. If your user permission is set to read–write but you are not ken, access is denied. If your group permission does not include read–execute permission you will be denied. Get the picture? Files owned by ken may have permissions set to -rwx------ which will deny access by anyone except a user logged in as ken. Any folder or file you create is owned by you. You can change the file or folder permissions at will. Other users may or may not have access to your files depending on the level of permission you set. Administrators (the root or superuser) have access to all files, even yours, regardless of permission settings. On single user workstation systems you are, of course, the system administrator when using sudo at the command line. You will always be asked for the root password you set during installation if you are trying to perform a root level command.

If the ls command is used with the -w option, files and folders will be displayed in a multi–column format similar to the illustration below.

 ken@ken-shack:~$

 ken@ken-shack:~$ ls -w80
 141A.TXT         F3.SER          N4.SER
 APRS.TXT         F4.SER          N5.SER
 bin              F5.SER          N6.SER
 ken@ken-shack:~$

In this illustration, the command ls requires the -w option to include the width of the display to use. For this purpose the value of 80 was used. Some terminal windows can support up to 132 charaters per line. In such a case, the -w option can use 132 as the value. Notice that files and folders are listed in several columns within the 80 characters specified. Also, no detailed information is displayed, only the name. Unless you know your system very well, the user may not be able to discover what type of file is displayed. For instance, the “bin” listing can be a data file or a folder name. To find out which, type the command “file bin”. The terminal responds with “bin: directory”. This display indicates that the name “bin” is a directory named bin. Identical commands may be performed on other files listed in order to reveal the type of the file.

The number and syntax of commands varies with the command interpreter in use. The bash interpreter has a large command set, but korn will have a different command set with overlaping functions having different syntax. Consult your system’s help manual for a complete list of commands from each interpreter.

At this point, only a minute portion of the total Linux environment has been covered. For a much more comprehensive look at the general Linux system, you can go to:  http://www.tldp.org/LDP/intro-linux/html/index.html   for more information on general use of the Linux system and administration duties for Linux, too extensive to be included here. Bear in mind that Linux, like its’ big brother Unix, was developed out of a command line environment. With the notable exception of GUI only applications, you can do the same thing either from a GUI desktop using a GUI application (clicking on a menu choice or desktop icon), a command line window or strictly from a command line environment using the command interpreter of your choice. So, for this reason, you should be aware that most of the introductory education may be command line oriented. Orientation for window manager use is available on the desktop window menu, because each window manager is different and each distro will configure window managers differently.

 

 

Rev. 1.01 2018-01-04 AD5XJ