Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

5/23/08

Linux Filesystem Demystified

There is only a single hierarchal directory structure. Everything starts from the root directory, represented by '/', and then expands into sub-directories. Where DOS/Windows had various partitions and then directories under those partitions, Linux places all the partitions
under the root directory by 'mounting' them under specific directories. Closest to root under Windows would be c:.

For best system performance, it is best to put /home, / (root) and file swap on it's own partition. Other users have gone as far as putting more than three partitions on their Linux install; Making a partition for /boot, /var and others.

Under Windows, the various partitions are detected at boot and assigned a drive letter. Under Linux, unless you mount a partition or a device, the system does not know of the existence of that partition or device. This might not seem to be the easiest way to provide access to your partitions or devices but it offers great flexibility.

This kind of layout, known as the unified filesystem, does offer several advantages over the approach that Windows uses. Let's take the example of the /usr directory. This directory off the root directory contains most of the system executables. With the Linux filesystem, you can choose to mount it off another partition or even off another machine over the network. The underlying system will not know the difference because /usr appears to be a local directory that is part of the local directory structure! How many times have you wished to move around executables and data under Windows, only to run into registry and system errors (Note: Linux doesn't have a registry like Windows)? Try moving c:windowssystem to another partition or drive.

Another thing to point out is the use of the frontslash '/' instead of the backslash '' as in DOS/Windows. So c:windowssystem would be /c/windows/system. Well, Linux is not going against convention here. Unix has been around a lot longer than Windows and was the standard a lot before Windows was. Rather, DOS took the different path, using '/' for command-line options and '' as the directory separator.

Linux also chooses to be case sensitive. What this means that the case, whether in capitals or not, of the characters becomes very important. So this is not the same as THIS or ThIs for that matter. This one feature probably causes the most problems for people just starting out on command line.

Below is a detailed summary of the Linux Filesystem Hierarchy:

/sbin - This directory contains all the binaries that are essential to the working of the system. These include system administration as well as maintenance and hardware configuration programs. Find lilo, fdisk, init, ifconfig etc here. These are the essential programs that are required by all the users. Another directory that contains system binaries is /usr/sbin. This directory contains other binaries of use to the system administrator. This is where you will find the network daemons for your system along with other binaries that only the system administrator has access to, but which are not required for system maintenance, repair etc.

/bin - In contrast to /sbin, the bin directory contains several useful commands that are used by both the system administrator as well as non-privileged users. This directory usually contains the shells like bash, csh etc. as well as much used commands like cp, mv, rm, cat, ls. There also is /usr/bin, which contains other user binaries. These binaries on the other hand are not essential for the user. The binaries in /bin however, a user cannot do without.

/boot - This directory contains the system.map file as well as the Linux kernel. Lilo or GRUB places the boot sector backups in this directory.

/dev - This is a very interesting directory that highlights one important characteristic of the Linux filesystem - everything is a file or a directory. Look through this directory and you should see hda1, hda2 etc, which represent the various partitions on the first master drive of the system. /dev/cdrom and /dev/fd0 represent your CDROM drive and your floppy drive. This may seem strange but it will make sense if you compare the characteristics of files to that of your hardware. Both can be read from and written to. Take /dev/dsp, for instance. This file represents your speaker device. So any data written to this file will be re-directed to your speaker. Try 'cat /etc/lilo.conf > /dev/dsp' and you should hear some sound on the speaker. That's the sound of your lilo.conf file! Similarly, sending data to and reading from /dev/tty. S0 (COM 1 ) will allow you to communicate with a device attached there - your modem.

/etc - This directory contains all the configuration files for your system. Your lilo.conf file lies in this directory as does hosts, resolv.conf and fstab. Under this directory will be X11 sub-directory which contains the configuration files for X. More importantly, the /etc/rc.d directory contains the system startup scripts. This is a good directory to backup often. It will definitely save you a lot of re-configuration later if you re-install or lose your current installation.

/home - Linux is a multi-user environment so each user is also assigned a specific directory which is accessible only to them and the system administrator. These are the user home directories, which can be found under /home/username. This directory also contains the user specific settings for programs like IRC, X, etc.

/lib - This contains all the shared libraries that are required by system programs. Windows equivalent to a shared library (lib) would be a DLL file.

/lost+found - Linux should always go through a proper shutdown. Sometimes your system might crash or a power failure might take the machine down. Either way, at the next boot, a lengthy filesystem check using fsck will be done. Fsck will go through the system and try to recover any corrupt files that it finds. The result of this recovery operation will be placed in this directory. The files recovered are not likely to be complete or make much sense but there always is a chance that something worthwhile is recovered.

/mnt - This is a generic mount point under which you mount your filesystems or devices. Mounting is the process by which you make a filesystem available to the system. After mounting your files will be accessible under the mount-point. This directory usually contains mount points or sub-directories where you mount your floppy, CD or USB Hard Drive. You can also create additional mount-points here if you want. There is no limitation to creating a mount-point anywhere on your system but convention says that you do not litter your file system with mount-points.

/media - This is also a generic mount for your removable media. Depending on the Linux distro, you may/may not see this. Usually, removable media, mounted partitions, DVD, etc mounted in /media will only show up in your menu such as 'Places'. Otherwise, if mounted in /mnt, it will more than likely show up on your Desktop as well too.

/opt - This directory contains all the software and add-on packages that are not part of the default installation. Generally you will find KDE and StarOffice here. Again, this directory is not used very often as it's mostly a standard in Unix installations.

/proc - This is a special directory on your system. The /proc File System is a pseudo file system residing in the virtual memory and maintains highly dynamic data on the state of your operating system. Most of the information in the /proc file system is updated to match the
current state of the operating system. The contents of the /proc file system can be read by anyone who has the requisite permissions

/root - This one is the home directory of the user root. This is not to be confused with the system root, which is directory at the highest level in the filesystem.

/tmp - This directory contains mostly files that are required temporarily. Many programs use this to create lock files and for temporary storage of data. On some systems, this directory is cleared out at boot or at shutdown.

/usr - This is one of the most important directories in the system as it contains all the user binaries. X and its supporting libraries can be found here. User programs like telnet, ftp etc are also placed here. /usr/doc contains useful system documentation. /usr/src/linux contains the
source code for the Linux kernel.

/var - This directory contains spooling data like mail and also the output from the printer daemon. The system logs are also kept here in /var/log/messages. You will also find the database for BIND in /var/named and for NIS in /var/yp.


Filesystem Commands to point out (with reference examples from the picture above):

1. When you are working within a shell terminal, you are always operating in a particular directory. To determine which directory you are in, use the pwd command:

student@linuxgym$ pwd
/home/student
student@linuxgym$


2. Your home directory is the directory you are in when you first open the terminal. To go to your home directory from anywhere, just type "cd":

student@linuxgym:$ pwd
/usr/local/bin
student@linuxgym:$ cd
student@linuxgym:$ pwd
/home/student
student@linuxgym:$

3. An absolute path name is one beginning with the "/" character, which signifies the root of the file system tree. Therefore, another way of going to your home directory is:

student@linuxgym:/etc$ cd /home/student
student@linuxgym:$ pwd
/home/student
student@linuxgym:$

4. A relative path is one which starts with the name of a directory connected to the current directory. For example, if you are in the /usr directory, then typing only "cd bin" (without preceding "bin" with "/") has the following effect:

student@linuxgym:$ pwd
/usr
student@linuxgym:$ cd bin
student@linuxgym:$ pwd
/usr/bin
student@linuxgym:$

and you go to /usr/bin rather than /usr/local/bin or /bin.

5. To go to the directory containing the current working directory (also called the parent directory) type:

student@linuxgym:$ pwd
/usr/bin
student@linuxgym:$ cd ..
student@linuxgym:$ pwd
/usr
student@linuxgym:$

6. The relative pathname of the current working directory is called "." (the full stop). Therefore typing:

student@linuxgym:$ pwd
/usr/bin
student@linuxgym:$ cd .
student@linuxgym:$ pwd
/usr/bin
student@linuxgym:$

does not change the current working directory.


You can also find a nice Index of Linux Commands and what they do -here. There is also a great directory guide for Unix/BSD/Linux commands for IT work or advanced users called Unix Toolbox.You can get the PDF version of it here.

5/20/08

25 Reasons to Convert to Linux

LINFO

25 Reasons to Convert to Linux



Businesses, educational institutions, governmental agencies and other organizations around the world are converting1 their computer operating systems from Microsoft Windows to Linux at an increasing pace. They are likewise converting their application programs from commercial software to free software (also referred to as open source software). There are at least 25 reasons for this situation, including:

(1) Because it is licensed under a free software license2, Linux (as well as other free software) is available at no cost. It can be downloaded from the Internet for free, and it can be purchased in disk or box form at trivial cost. One copy can be used on as many computers as desired with no restrictions. This is in sharp contrast to Microsoft Windows, which can easily cost US$100 or more per computer.

(2) Because it is free software, Linux is also free in the sense that anybody is permitted to modify it, including its source code, in any way desired. If modified versions are not redistributed (i.e., given away or sold outside of an organization), they can be kept secret. This is also in sharp contrast to Microsoft Windows, for which modification of the software is generally not permitted. Source code is the original version of a program as it is written by a programmer using a programming language and before being converted by a compiler into a form such that its instructions can be understood directly by a computer's CPU (central processing unit); it is generally necessary to have the source code in order to be able to make changes to a program. This ability to freely experiment with and modify the source code, and to do so without disclosing the modifications to outsiders, has been a very important consideration for a number of large organizations3.

(3) High quality support for Linux is available for free on the Internet, including in newsgroups and other forums. Some people claim that this support is at least as good as that provided for proprietary (i.e., commercial) operating systems for a fee. Linux support can also be purchased on a commercial basis if desired. Among the types of support that can be required for operating systems are help with customization, assistance in installing new programs, patches to cope with new security threats and patches to fix newly discovered bugs (i.e., defects). Fortunately, the need for the last two types is relatively infrequent for Linux.

(4) There is little possibility that support for Linux will be discontinued at some future date due to planned obsolescence or for any other reason. This is because the source code will always be available to anyone who wants it, including individuals who provide support for free over the Internet and businesses which provide it for a fee. In contrast, with Microsoft Windows and other proprietary software for which the source code is usually kept secret, obtaining support becomes difficult (from both a technical and a legal point of view) if the developer decides to withdraw it (for example in order to try to force users to pay for upgrades to newer versions).

(5) There is little or no fear of major obsolescence, planned or otherwise, with Linux. This is because the UNIX architecture on which it is based has been exhaustively tested and refined for more than 35 years and has proven to be extremely efficient, robust and secure. Improvements continue at a rapid pace, but new versions remain basically compatible with the underlying UNIX architecture.

(6) There are no forced upgrades4 for Linux users. This because older versions continue to be supported (e.g., with the development of new security patches and device drivers) and because newer versions, if desired, are available for free (as is all free software) and are typically highly compatible with older versions. The developers of proprietary software, however, have strong financial incentives to engage in planned obsolescence, namely, in order to induce users of earlier versions to spend money to buy or lease new versions.

(7) Should a user decide to upgrade to a newer version of Linux, there are no licensing fees or other software costs if the user selects a free distribution (i.e., version). Moreover, the training, program modification/conversion, hardware acquisition and other costs associated with upgrading to a new version are also relatively low due to the compatibility with earlier versions.

(8) Linux has no onerous requirements for keeping track of licenses. In a company with hundreds or thousands of computers, a number of full time personnel can be required just to make sure that all of the computers in use are in compliance with the complex licensing terms of the EULAs (end user license agreements) for Microsoft Windows, Microsoft Office and other proprietary software. And for Linux users there is no fear of surprise audits by the BSA (Business Software Alliance)5, with possible severe penalties for minor license violations.

(9) Linux features superior security, including a very low rate of infection by viruses, trojans, worms, spyware and other malware. This is because UNIX and all of its descendants (including Linux) been designed from the ground up with security in mind, rather than having attempts at security tacked on as an afterthought. For example, users do not routinely use the system as the root (i.e., administrative) user, thereby protecting key system files even in the event of a break-in by a malicious intruder. Also, a robust firewall is included in major distributions and it is enabled by default. Another important factor is the free availability of the source code, which allows thousands of people around the globe to search for security vulnerabilities in it6.

(10) Linux is highly resistant to system crashes and rarely needs rebooting (i.e., restarting). This can be very important for large organizations for which even a few minutes of down time can result in a substantial cost. The reason is that Linux has been designed from the ground up to be an extremely stable and robust operating system, incorporating all that has been learned about attaining these goals from the more than 35 years of history of Unix-like operating systems.

(11) Although the number and variety of application programs for Linux are not yet as large as those available for the Microsoft Windows operating systems, an extensive selection already exists and it is continuing to increase rapidly as more and more developers start creating programs for Linux. Most Linux applications are also free software (including nearly all of the most popular ones), and many have features and performance equal or superior to those of comparable applications for use with Microsoft Windows. In fact, users often find that all the applications that they want are freely available on the Internet and that it is no longer necessary to purchase any commercial software.

(12) There is a choice of numerous distributions (several hundred) of Linux, each with its own unique set of characteristics but all basically compatible with each other. This allows users to select the versions which best meet their specific requirements. It also means that if one provider of Linux were to go out of business, there would still be many others from which to choose. Moreover, it fosters a healthy competition among them, thereby contributing to the continuous improvements in Linux's quality and performance. If the choice seems overwhelming, it is usually difficult to make a mistake by selecting one of the most popular distributions, such as Red Hat or SuSE.

(13) Linux features a high degree of flexibility of configuration, and a great deal of customization can be accomplished very easily and without having to modify the source code. For example, it is a simple matter to configure Linux during installation so that it will be optimized for use as a workstation, desktop computer, notebook computer, web server, database server or a router. Likewise, the appearance and behavior of the desktop, including icons and menus, can be configured in an almost infinite number of ways, according to user tastes or requirements. They can even be made to resemble Microsoft Windows. Should this not be enough, the ability to freely access, revise and recompile the source code allows virtually unlimited flexibility of configuration.

(14) Linux and other free software uses open format file formats. These are formats for word processing, spreadsheet and other file types that conform to industry-wide standards and which can be used by any developer of software to create compatible programs, in contrast to the closed formats commonly used by some proprietary software. This eliminates the problem of lock-in to proprietary standards, with the consequent difficulty and expense of switching to other software in the future. It allows the user to have complete control of its data, particularly in the event that at some future date the developer who originally created the software goes out of business or stops supporting its earlier software.

(15) Linux is generally faster for a given set of hardware specifications. This is due to greater optimization of the source code, including far less code bloat.

(16) Linux features a high degree of compatibility with other operating systems. For example, it can read, write, copy, erase and otherwise manipulate data that resides on Microsoft Windows partitions on the same hard disk drive (HDD), act as a Windows server for a network containing Windows clients, format disks for use with Windows, and even run Windows programs directly if necessary. In contrast, the Microsoft Windows operating systems cannot access HDD partitions that contain other operating systems, cannot format disks for other operating systems, etc.

(17) Very high ethical standards are maintained for Linux and other free software, in large part due to the very openness of their development process and the free availability of the source code. Linux has never been convicted in a Federal court of violation of U.S. antitrust laws or other crimes, nor has it had to pay penalties for the unauthorized copying of technology developed by other companies. Antitrust refers to government policy to regulate or break up monopolies in order to promote free competition and attain the benefits that such competition can provide to the economy and to society as a whole.

(18) Linux reduces the need to upgrade or replace hardware when upgrading to newer versions. This is because its code is very efficient and compact, thus allowing it to work effectively on older computers that are not suitable for the newest versions of Microsoft Windows.

(19) Linux is capable of operating on a wide variety of platforms (i.e., processor and system types), rather than just being limited to Intel-compatible processors and computers. It scales well and is well suited for use on a diverse array of equipment ranging from supercomputers to industrial robots to electronic medical equipment to cell phones (and can even run on a wristwatch).

(20) Linux is a superior choice for use in academic institutions for a number of reasons. Among them is the fact that there are no secrets (in sharp contrast to proprietary software), thereby providing students the opportunity to study how computers really work rather than to just learn how to use them. Many educators are convinced that it is far more important for students to study computer science fundamentals than to practice specific applications (such as Microsoft Word or Microsoft PowerPoint). One reason is that computer science fundamentals will still be valid many years from now, whereas the specific application programs, especially the proprietary ones that do not conform to industry-wide standards, are constantly changing and those currently in use will likely become obsolete in a few years7.

(21) For governmental agencies, Linux and other free software allows for transparency of data because it stores the data in formats consistent with industry-wide standards. This is in contrast to the proprietary, closed formats characteristic of commercial software. Such transparency is important for maintaining an effective democracy. Keeping non-secret data in standards-compliant formats allows anyone to access it without having to purchase expensive proprietary software. Also, storing secret data in standards-compliant formats is widely regarding as being more secure than keeping it in proprietary formats.

(22) With Linux and other free software there is little reason to fear the existence of backdoors, in large part because all of the source code is available for inspection. A backdoor is a secret method for obtaining remote access to a computer. There is a (not unjustified) concern by many foreign governments and corporations that back doors have been covertly inserted into proprietary software that could allow the software developer and agencies of other governments to snoop into their most confidential data.

(23) Using and advocating Linux helps foster a healthy diversity and increased competition throughout the software industry. Such competition can promote technological advance, improve performance and lower costs for open source software and proprietary software alike. Both economic theory and hundreds of years of real-world experience clearly show that monopolies have little incentive to innovate, tend to produce shoddy products, charge inflated prices and tend to corrupt the political system.

(24) Linux and other free software have not only caught up with, or some cases surpassed, their proprietary counterparts, but they are also developing at a faster pace8. This trend will accelerate as demand for such software continues to grow and more and more individuals and organizations become actively involved it its development.

(25) Linux and other free software provide the opportunity for users to contribute to the advance of software technology because the source code is freely available to study, improve, extend and redistribute. This has been fairly common, and the most notable corporate example has been IBM. In addition to giving back to the software community and being a virtue in itself, such contributions can have great public relations value.

(26) There are actually more than 25 reasons that organizations around the world are converting to Linux and other free software. A twenty-sixth reason is that with Linux, in contrast to the Microsoft Windows operating systems, there is no need to defragment HDDs. Fragmentation, which is the spreading of data into non-contiguous locations on a hard disk drive, can reduce the efficiency of data storage and slow down computer operation. Defragmentation is not difficult, but it can be an annoyance to have to do it periodically, and it is unnecessary with a well designed operating system.


There are also several situations in which businesses and other organizations might benefit from converting their operating systems from Linux to Microsoft Windows:

(1) An organization that is downsizing its operation and already has valid but unused licenses for Microsoft Windows might be able to reduce personnel costs by replacing its Linux experts with Windows administrators, as the latter can generally be hired for significantly less than Linux administrators.

(2) Were Microsoft to offer an organization an extremely low cost incentive package, including providing long-term licenses (and upgrades) at nominal cost, paying for new hardware and providing free training and support, this could be a very attractive proposition. In fact, it could be a win-win situation because of the great publicity value that could accrue to Microsoft from a company or other organization converting from Linux to Windows.


________
1For links to articles about some recent conversions to Linux, see Linux Success Stories, The Linux Information Project, December 2005.

2Linux and most other free software is licensed under the GNU General Public License (GPL). This highly successful license has been specifically designed to provide as much freedom as possible for users, both in a monetary sense and with regard to use. The GPL allows anyone to freely access the source code for software licensed under it in order to study, use, modify, extend and redistribute it as desired with only the very minimal requirements of always making the source code for redistributions of modified versions freely available and including a copy of the GPL text with the software.

It should be pointed out in this context that there are also compiled versions of Linux that are not free in a monetary sense, which is also permitted by the GPL. However, they are not necessarily any better than the free versions. Businesses and other organizations have the option of selecting whether they want a free or non-free version, and if they select the former, they have many distributions from which to choose.

3This is a major reason that Google selected Linux, according to industry sources.

4Forced upgrades occur when the developer stops supporting an earlier version of its software, and thus security patches for the newest viruses and other malware become unavailable and drivers are no longer developed for new hardware. Thus, many users have little choice but to purchase or lease the newest version. This can be very costly because of the licensing fees or other payments that must be made to the software developer or vendor. Further adding to the cost is the frequent need to purchase new hardware to accommodate the bloated code in the new versions of the software. In addition, installing the new software and troubleshooting it can be very time-consuming for system administrators and disruptive for business operations.

5 The highly controversial BSA is an international organization that was set up by major developers of proprietary software. It is empowered by the mandatory EULAs accompanying such software to make surprise audits on users and to levy heavy fines in the event of violation.

6 The is the same principle that is employed by public key cryptography (PKC), which is the most secure form of data encryption. And it is the opposite of the approach used with proprietary software, for which an attempt is made to keep the source code secret as a means of hiding security vulnerabilities.

7 For a more detailed look at the reasons that Linux is the best choice for use in educational institutions, see Linux and Education, The Linux Information Project, March 2004.

8Numerous examples could be cited. For example, Apache is the dominant web server, hosting far more web sites than any of its proprietary counterparts. Likewise, it is widely agreed that the free Firefox web browser is far more advanced (in terms of security, usability, etc.) than Microsoft's Internet Explorer. Internet Explorer is free in a monetary sense, but it is not free software because the source code is not made available and users are prohibited from modifying it.






Created January 10, 2006. Updated January 13, 2006.
Copyright © 2004 - 2006 The Linux Information Project. All Rights Reserved.


3/2/07

Linux IBM Commercial

Here is a IBM Linux Commercial from 2003. I think this is a cool commercial, not just because it's linux, but because it touches on spirit, learning and innovation. I think the main goal of this is to make you think, kinda like the Red Hat commercials, if you have ever seen them.
"Linux, for the betterment of Science and therefore Humanity."

Envy - Automated Nvidia/ATI driver Installation


I know this has been covered all over the web and on allot of linux forums, but I can't get over how sweet this program is! I use Ubuntu Linux and every time I update my kernel, I run envy from the command line and uninstall my Nvidia drivers. Then when my system reboots, I drop to a command line once again and run envy again (btw, that is the command 'envy') to install the drivers back for the new kernel modules. No more compiling the drivers with your new kernel by hand, it is all automated. The author of this python based command-line application, Alberto Milone, even has a way in this script to go to the Nvidia website and download the newest proprietary drivers for your card.


From his site, you can download the .deb package. On the site, http://www.albertomilone.com/nvidia_scripts1.html, he explains what envy will do:




  • 1) detect the model of your graphic card (ATI and Nvidia cards are supported)


  • 2) download the right version of the proprietary driver for your ATI or Nvidia card from ATI or Nvidia's websites


  • 3) handle the dependencies (compilers, OpenGL, etc.) required to build the module


  • 4) install the driver


  • 5) set up your xorg.conf (i.e. the configuration file of the Xserver) for you


  • 6) restart the Xserver for you (if you wish so)


So check out the site, there you will find instructions for installation and support. He is also taking donations too.