Wednesday, December 31, 2008

Creating files and directories

As a Linux user, most of the files you save and work with will probably be in your home directory. Here are some of the commands you use in the file creation process:
· cd — Change to another current working directory
· pwd — Print the name of the current working directory
· mkdir — Create a directory
· chmod — Change the permission on a file or directory
· ls — List the contents of a directory
The following procedure steps you through creating directories within your home directory, moving among your directories, and setting appropriate file permissions:
1.First, go to your home directory. To do this, simply type cd.
2.To make sure that you got to your home directory, type pwd.
$ pwd
/home/chris
3.Create a new directory called test in your home directory, as follows:
$ mkdir test
4.Check the permissions of the directory by typing:
$ ls −ld test
drwxr−xr−x 2 chris sales 1024 Jan 24 12:17 test

Tuesday, December 30, 2008

Linux file system

Some of the Linux directories that may be of interest to you include the following:
· /bin — Contains common Linux user commands, such as ls, sort, date, and chmod.
· /dev — Contains files representing access points to devices on your systems. These include terminal devices (tty), floppy disks (fd), hard disks (hd), RAM (ram), and CD−ROM (cd).
· /etc — Contains administrative configuration files.
· /home — Contains directories assigned to each user with a login account.
· /mnt — Provides a location for mounting devices, such as remote file systems and removable media (with directory names of cdrom, floppy, and so on).
· /root — Represents the root user’s home directory.
· /sbin — Contains administrative commands and daemon processes.
· /tmp — Contains temporary files used by applications.
· /usr — Contains user documentation, games, graphical files (X11), libraries (lib), and a variety of other user and administrative commands and files.

Sunday, December 28, 2008

Configuring your shell

You can tune your shell to help you work more efficiently. Your prompt can provide pertinent information each time you press Enter. You can set aliases to save your keystrokes and permanently set environment variables to suit your needs. To make each change occur when you start a shell, you can add this information to your shell configuration files.
Several configuration files support how your shell behaves. Some of these files are executed for every user and every shell. Others are specific to the particular user that creates the configuration file. Here are the files that are of interest to anyone using the bash shell in Linux:
· /etc/profile — This file sets up user environment information for every user. It is executed when you first log in and the shell starts. This file provides default values for your path, your prompt, the maximum file size that you can create, and the default permissions for the files that you create. It also sets environment variables for such things as the location of your mailbox and the size of your history files.
· /etc/bashrc — This file is executed for every user that runs the bash shell. It is read each time a bash shell is opened. It sets the default prompt and may add one or more aliases. Values in this file can be overridden by information in each user’s ~/.bashrc file.
· ~/.bash_profile — This file is used by each user to enter information that is specific to their own use of the shell. It is executed only once, when the user logs in. By default it sets a few environment variables and executes the user’s .bashrc file.
· ~/.bashrc — This file contains the bash information that is specific to your bash shells. It is read when you log in and also each time you open a new bash shell. This is the best location to add environment variables and aliases so that your shell picks them up.
· ~/.bash_logout — This file executes each time you log out (exit the last bash shell). By default, it simply clears your screen.

Command line recall

After you type a command line, that entire command line is saved in your shell’s history list. The list is stored in a history file, from which any command can be recalled to run again. After it is recalled, you can modify the command line, as described earlier.
To view the contents of your history list, use the history command. You can either type the command without options or follow it with a number to list that number of the most recent commands. Here’s an example:
$ history 8
382 date
383 ls /usr/bin
384 man sort
A number precedes each command line in the list. There are several ways to run a command immediately from this list, including:
· Run Command Number (!n) — Replace the n with the number of the command line, and the command line indicated is run.
· Run Previous Command (!!) — Runs the previous command line.
· Run Command Containing String (!?string?) — Runs the most recent command that contains a particular string of characters.

Friday, December 26, 2008

Checking directories and permissions

Associated with each shell is a location in the Linux file system known as the current or working directory. As previously mentioned, each user has a directory that is identified as the user’s home directory.
When you first log in to Linux, you begin with your home directory as the current directory. When you request to open or save a file, your shell uses the current directory as the point of reference.
Simply give a filename when you save a file and it will be placed in the current directory. Alternatively, you can identify a file by its relation to the current directory (relative path). Or you can ignore the current directory and identify a file by the full directory hierarchy that locates it (absolute path).
To find out what your current directory is, type the pwd command:
$ pwd
/usr/bin
At this point, list the contents of your home directory, using the ls command. Either you can type the full path to your home directory to list its contents, or you can use the ls command without a directory name to list the contents of the current directory. Using the −a option to ls enables you to view the hidden files (dot files) as well as other files. With the −l option, you can see a long, detailed list of information on each file.
$ ls −la /home/nitin
You can get the total files in home directory of user 'nitin', with the read/write permissions associated with the file.

Thursday, December 25, 2008

Choosing Different Install Modes

Though most computers will allow you to install Red Hat Linux in the default mode (graphical), there are times when your video card may not support that mode. Also, though the install process will detect most computer hardware, there may be times when your hard disk, Ethernet card, or other critical hardware cannot be detected and require special information at boot time.
Here is a list of different installation modes you can use to start the Red Hat Linux install process.
· text: Type text to run installation in a text−based mode. Do this if installation doesn't seem to
recognize your graphics card. The installation screens aren't as pretty, but they work just as well.
· lowres: Type lowres to run installation in low screen resolution for graphics cards that can't support the higher resolution.
· nofb: Type nofb to turn off frame buffer.
· expert: Type expert if you believe that the installation process is not properly auto−probing your hardware. This mode bypasses probing so you can choose your mouse, video memory, and other values that may otherwise be chosen for you.
· linux rescue: The linux rescue mode is not really an installation mode. This mode boots from CD, mounts your hard disk, and lets you access useful utilities to correct problems preventing your Linux system from operating properly.

Wednesday, December 24, 2008

Red Hat Linux installation methods

Each of the installation procedures from locations other than a CD requires a Red Hat Linux installation boot disk.
· HTTP server — Lets you install from a Web page address.
· FTP server — Lets you install from any FTP site.
· NFS server — Allows you to install from any shared directory on another computer on your network using the Network File System (NFS) facility.
· Hard disk — If you can place a copy of the Red Hat Linux distribution on your hard disk, you can install it from there.
The following specialty installation type also may be of interest to you:
· Kickstart installation — Lets you create a set of answers to the questions Red Hat Linux asks you during installation. This can be a timesaving method if you are installing Red Hat Linux on many computers with similar configurations.

Tuesday, December 23, 2008

Red Hat Linux Installation

Here's how you get started:
1. Insert the first Red Hat Linux installation CD into your computer's CD−ROM drive.
2. Reboot your computer.
3. When you see the Welcome screen, press Enter to begin the installation.
During installation, you are asked questions about your computer hardware and the network connections. After you have completed each answer, click Next. The following list describes the information you will need to enter.
· Language — Choose your language.
· Keyboard — Choose your keyboard type.
· Mouse — Identify the type of mouse you are using.
· Install type — Choose a configuration, such as Workstation (adds Linux and leaves Windows
partitions), Server (adds Linux server packages and erases entire disk), Laptop (ensures that special laptop packages, such as PCMCIA and power management support, are included), or Custom (adds selected Linux packages and lets you choose partitioning).
· Partitions — Either have Red Hat choose your partitions or customize your own (with Disk Druid or fdisk). You must have at least one Linux partition, which must be assigned to root (/), and a swap partition.
· GRUB — Add the GRUB boot manager to control the boot process.
· Network configuration — Set up your LAN connection. Information includes your computer's IP address, netmask, network number, broadcast address, host name, default gateway, and DNS servers.
· Firewall — Choose a default firewall configuration. Select High if you plan to connect to the Internet but don't plan to use Linux as a server. Choose Custom if you want to make particular services available to the network. Select No Firewall only if you are connected to a trusted network, with no connection to a public network.
· Language support — Choose to install support for additional languages.
· Time zone — Identify the time zone in which you are located.
· User accounts — Add the root user account password and add at least one regular user.
· Authentication — Choose whether to use encrypted or shadow passwords.
· Packages — For custom installations, choose groups of software packages to install. (You can also choose individual packages, if you like.)
· Video — Identify your video card.
· Installing packages — Up to this point, you can quit the installation process without having written anything to hard disk. After you select Next, the packages you selected are installed.
· Boot disk — Create a boot disk (optional).
· Monitor — Identify your monitor by selecting the vendor and model.
· Custom X Configuration — Indicate the color depth and screen. You can also choose your GUI environment (GNOME or KDE, if both are available) and whether you will see a graphical or text−based login prompt. During installation, you can choose to install software based on the type of system you want (workstation, laptop, or server) or to select package groups individually (custom). I installed all packages, which I recommend doing only if you are trying out Linux in a nonproduction environment and have the disk space.
After answering the questions, the actual installation of packages takes between 20 and 40 minutes, depending on the number of packages and the speed of the computer hardware. The time will vary depending on your hardware. During this time, you may be asked to insert the other Red Hat installation CD.
When installation is done, remove the Red Hat Linux CD and click Exit to reboot your computer. When you see the boot screen, use up and down arrows to select a partition. Linux should boot by default. After Linux boots, it presents you with a login prompt.

Sunday, December 21, 2008

Journaling file system (ext3)

The default file system for Red Hat Linux has changed from ext2 to ext3 for this release. The ext3 file system is what is referred to as a journaling file system. Journaling file systems are designed to recover quickly from system crashes. Quick recovery makes ext3 an important asset for computers that need to be up all the time.
The ext3 file system is really just an ext2 file system with the ability to recover faster after the system goes down. File systems can grow larger and larger with ext3, without accepting a penalty of long file system checks after a crash.

GRUB boot manager

The GRand Unified Bootloader (GRUB) replaces the LInux LOader (LILO) as the default boot manager for Red Hat Linux 7.2. When your computer starts up, the first thing it does is run the boot manager. The boot manager lets you select which operating system to boot (if you have more than one on your computer), and then hands control of the rest of the boot process to the operating system you chose.
GRUB can boot both multiboot and non−multiboot operating systems. Multiboot operating systems let you pass arguments to the operating system when you boot. Non−multiboot systems simply allow you to use a feature called chain−loading, which allows it to simply load another boot loader to start the operating system.
For multiboot systems, GRUB allows you to pass options to the kernel at boot time. For example, you can identify a hardware device to use a particular driver or override auto−detection of a device. You can also use a configuration file to name and identify the locations of boot images on your computer.

Friday, December 19, 2008

Common features of Linux

No matter what version of Linux you use, the piece of code common to all is the Linux kernel. Although the kernel can be modified to include support for the features you want, every Linux kernel can offer the following features:
· Multiuser — Not only can you have many user accounts available on a Linux system, you can also have multiple users logged in and working on the system at the same time. Users can have their own environments arranged the way they want: their own home directory for storing files and their own desktop interface (with icons, menus, and applications arranged to suit them).
· Multitasking — In Linux, it is possible to have many programs running at the same time, which means that not only can you have many programs going at once, but that Linux, itself, can have programs running in the background. Many of these system processes make it possible for Linux to work as a server, with these background processes listening to the network for requests to log in to your system, view a Web page, print a document, or copy a file. These background processes are referred to as daemons.
· Graphical User Interface (X Window System) — The powerful framework for working with graphical applications in Linux is referred to as the X Window System (or simply X). X handles the functions of opening X−based GUI applications and displaying them on an X server process (the process that manages your screen, mouse, and keyboard). On top of X, you use an X−based desktop environment to provide a desktop metaphor and window manager to provide the specific look−and−feel of your GUI (icons, window frames, menus, and colors). There are several desktop environments and dozens of desktop managers to choose from. (Red Hat provides several desktop managers, but focuses on Gnome and KDE desktop environments.)
· Hardware support — You can configure support for almost every type of hardware that can be connected to a computer. There is support for floppy disk drives, CD−ROMs, removable disks (such as Zip drives), sound cards, tape devices, video cards, and most anything else you can think of. Note Not every hardware manufacturer provides Linux drivers with their peripheral devices and adapter cards. Although most popular hardware will be supported eventually in Linux, it can sometimes take a while for a member of the Linux community to write a driver.
· Networking connectivity — To connect your Linux system to a network, Linux offers support for a variety of Local Area Network (LAN) boards, modems, and serial devices. In addition to LAN protocols, such as Ethernet and Token Ring protocols, all the most popular upper−level networking protocols can be built−in. The most popular of these protocols is TCP/IP (used to connect to the Internet). Other protocols, such as IPX (for Novell networks) and X.25 (a packet−switching network type that is popular in Europe), are also available.
· Network servers — Providing networking services to the client computers on the LAN or to the entire Internet is what Linux does best. A variety of software packages are available that enable you to use Linux as a print server, file server, FTP server, mail server, Web server, news server, or workgroup (bootp or NIS) server.
· Application support — Because of compatibility with POSIX and several different application programming interfaces (APIs), a wide range of freeware and shareware software is available for Linux. Most GNU software from the Free Software Foundation will run in Linux.

Primary advantages of Linux

When compared to different commercially available operating systems, Linux's best assets are its price and its reliability. Most people know that its initial price is free. However, when people talk about Linux’s affordability, they are usually thinking of its total cost, which includes the capability of using inexpensive hardware and compatible free add−on applications.
Although commercial operating systems tend to encourage upgrading to later hardware, Linux doesn’t. In terms of reliability, the general consensus is that Linux is comparable to many commercial UNIX systems but more reliable than most desktop−oriented operating systems. This is especially true if you rely on your computer system to stay up because it is a Web server or a file server.
Another advantage of using Linux is that help is always available on the Internet. There is probably someone out there in a Linux newsgroup who is willing to help you get around your problem. Because the source code is available, if you need something fixed you can even patch the code yourself! On the other hand, I’ve seen commercial operating system vendors sit on reported problems for months without fixing them. Remember that the culture of Linux is one that thrives on people helping other people.