Thursday, 10 November 2022

BITS CF 5th Unit

 

Fundamental of Computers & Information Technology

Unit -V

MICROSOFT DISK OPERATING SYSTEM -Microsoft Disk Operating System (MS-DOS) is the most popular single user operating in the world. Microsoft Corporation of USA had released it in august 1981. It includes a number of utilities that have become common place on most PCs; disk compression, memory management, anti-virus, backup, disk optimization. Earlier these utilities were brought separately from third party vendors who were selling them long before DOS 6. An operating system is the overseer (Supervisor, Manager) of the computer. In general, an operating system is a collection of the programs that manage system resources and aid in the development and execution of application programs.  IBM (International Business Machines), the pioneer in computer manufacturer, adopted and promoted MS-DOS for its range of personal computers. Even many other hardware vendors found it useful and compatible for their machines and with this MS-DOS gained so much popularity that it became a defacto operating system for micros.

            Every operating system has a version number that allows you to keep track of whether or not the software you are running is the latest version and also of the current capabilities supported by different versions. Every version number is broken down into two parts, a major and minor version number. In the case of DOS version 1.0, for example, 1 is the major version number while 0 is the minor version number.

            First version of MS-DOS was a refined version of an OS developed by Tim Peterson of Seattle Computers, which he had named as QDOS (Quick and Dirty Operating System) as he had developed it in record two months and could not introduce some good functions of process management and memory management into it. After the release of first version of MS-DOS, every time some refinement is made, a new version of it is launched. The latest version of MS-DOS available in the market is 7.x.

            An operating system is an interface between the user and the computer system.

DISK DRIVES

            Most of the personal computers work with disks.  PCs, PC-XTs, PC-ATs work with floppy drives and hard disk drives.

PCs (Personal Computer) have one or two floppy disk drives.

PC-XTs (Extended Technology) have one or two floppy disk drives and hard disk drive. Speed and capabilities of XTs are the same as that of a PC.

PC-ATs (Advanced Technology) have one or two floppy disk drives and a hard disk drives with advanced microprocessor chip which is much more faster and capable of performing complex functions.

Floppy Disk Drive (FDD) – The mechanism, which handles a floppy disk, is called Floppy Disk Drive. All operations on a floppy disk (e.g. reading from a floppy disk or writing on it) are performed by a floppy disk drive. The FDD consists of a read –write head, which moves to and fro on a rotating floppy disk to perform read, or write operations. Each FDD is given an identification letter. The first FDD is called drive A and if there is second FDD also, it is called drive B.

Hard Disk Drive (HDD) - The hard disk drive (HDD) is also called a Winchester Disk Drive. The HDD is group of some platters, each having a read/ write arm for it. The HDD is responsible for all operations (reading/writing) performed on a hard disk. The hard disk is given an identification letter drive C. One hard disk can be partitioned into several parts. Each partition forms a logical disk. If a hard disk has been partitioned, then first partition is called drive C, second as drive D, third as drive E, and so on.

FAT File -A FAT file system is a specific type of computer file system architecture and a family of industry-standard file systems utilizing it.The FAT file system is a legacy file system which is simple and robust.[3] It offers good performance even in very light-weight implementations, but cannot deliver the same performance, reliability and scalability as some modern file systems. It is, however, supported for compatibility reasons by nearly all currently developed operating systems for personal computers and many home computersmobile devices and embedded systems, and thus is a well suited format for data exchange between computers and devices of almost any type and age from 1981 through the present.

 

LOADING OF DOS INTO MAIN MEMORY (BOOTING)

            Loading of DOS into main memory involves loading of three essential files of DOS viz. IO.SYS also called (IBMBIO.COM), MSDOS.SYS also called (IMDOS.COM) and COMMAND.COM into the main memory. Loading these files into main memory is called booting up (which means getting ready) of the computer. The booting up process is a step-by-step process as follows:

1. As soon as the machine is switched on, POST (Power on Self Test) is performed which checks for integrity of all components (CPU, RAM, IO devices etc) of a computer system. If any component is found faulty, an error message is displayed.

2. A chip called ROM-BIOS (Read Only Memory – Basic Input Output System) is read and executed. Then a check is performed for DOS files presence in the following order. (1. First in A drive, if found there, DOS is loaded from drive A. 2 If not found in A drive, then C drive is scanned for DOS files availability. If DOS files are found in C drive, Then DOS is loaded from C drive.)

3. If DOS files are found in a drive, its very first sector (called boot sector) is read which stores a small program called bootstrap loader in which instructions for booting up process are stored. The bootstrap loader is then loaded into main memory and its instruction are executed.

DOS System Files

The computer loads three basic files called MS DOS.SYS, IO.SYS and Command.Com. These are the three system files which are needed  to load DOS.

FILES AND FILE NAMING CONVENTIOS

            Any information, which is to be stored on the computer’s secondary storage, would be stored as a file. A file is a collection of logically related information e.g. a file containing all details about mid-term exams, a file containing monthly sales data etc. Each file stored on the system is given a name. The file name has two parts: primary file name and secondary file name (also called extension). A primary file name consists of one to eight (1-8) characters in length. File extension consists of a period followed by zero to three (0-3) characters. Extensions are optional, but it is better to use them, as they are useful for describing the contents of a file. For instances, all document files can be given an extension. Doc. The primary file name and file extension can have any characters other than following:

   [] \ /: < > + “ =? |

Extension .exe specifies that it is an executable file, .bas specifies it is BASIC program file, .PAS specifies that it is Pascal file and so on. Therefore, extension can be used for better understanding of filename.

TYPES OF DOS COMMANDS

            There are two types of dos commands.

Internal Commands

External Commands

Internal Commands: The internal commands are loaded into memory when DOS is booted. Internal commands are always available for your use, although they are not seen when you display the disk directory of filenames on your screen.  In other words, DOS commands for which the specification is available within the shell (COMMAND.COM) are called internal commands. Some common internal commands are:

COPY, DEL, DIR,CLS, DATE, TIME, PATH,REN, TYPE, DIR, MD, CD, RD

External Commands: External commands are conventional programs. These files can be deleted, copied and even renamed. Their filenames are displayed when DIR lists a directory on the screen. In other words, DOS commands for which specification is not internally available in COMMAND.COM are called External commands. The specifications for these commands are made available to the shell through external specifications files e.g. FORMAT is an external command and its specification are available in FORMAT.COM, for DISKCOPY external command, specification file is DISKCOPY.COM and so on. For Example: CHKDSK, XCOPY, PRINT, ATTRIB

DIRECTORY STRUCTURE OF MS-DOS

            In an office, the file cabinet is divided into shelves, shelves into boxes, boxes into drawers etc. and files are kept in them. Similar types of files are grouped and kept in the same drawer or box or shelf. In the same way, files on disks are stored. The disk is divided into subdirectories; each subdirectory can further be divided into sub subdirectory and so on. DOS files with some similarity are grouped together and a directory is formed for them under which they are kept.

WILD CARDS         

            Two special characters ‘?’ (Question mark) and ‘*’ (asterisk) are called wildcards in DOS. They are useful in MS-DOS command lines because they give flexibility in specifying paths and files.

The? Wild Card

            A question mark (?) in a filename or file name extension means that any one or none character can occupy that position. For instance

            Memo? Doc would represent

            Memo.doc

            Memo3.doc

            Memo4.doc

            Memo7.doc and so on

The * Wildcard

            The *(asterisk) replaces any number of characters .For instance

            A*.exe would represent

            Ab.exe

            Abc.exe

            Ans.exe

            Answer.exe

            Ans2.exe

As A*.exe means A followed by any number of characters (but length should not exceed eight in number) and extension .exe

Command Prompt:- When you first switch on IBM PC computer, you will see some coded information displayed by DOS 6. This information tells the configuring of your computer. When the information stops you will see the following:

C:\>

This is the command prompt. The flashing underscore next to the command prompt is called the cursor. The cursor shows the place on the screen where the command will appear as you type it.

Dir: This command is used to list files under a directory.

            SYNTAX   C:\>dir

Dir command lists names of all the files and subdirectories under the current working directory.

Dir also lists the drive’s volume label and volume serial number

Directory names are shown with <DIR> entries in the directory listing. The ‘.’ And ‘.’ default entries in the directory listing denote current directory and parent directory respectively that store information about current directory and its parent directory. File information is displayed in five columns

1st Column gives the primary name of the file.

2nd Column gives the extension of the file.

3rd Column gives the file size i.e. number of bytes stored in the file.

4th Column gives the last-updation-date i.e. date on which the file was modified /updated last.

5th Column gives the last-updation-time i.e. time at which the file was updated last.

As the monitor size is 25*80 i.e. 25 rows and 80 columns, only 20 file names can be displayed in one go, on the screen as first 3 rows display volume label, volume serial number and directory’s path name and last 2 rows display total number of bytes occupied and number of free bytes. If there are more than 20 files in the directory being listed, the screen is scrolled up and first few file names cannot be viewed. To view the directory-listing page wise i.e. one screen at a time, the command used is

SYNTAX   C:\>dir/p

Dir/w – It display width wise. The wide display lists up to five files per line.

SYNTAX   C:\>dir/w

Dir/on – It display sorted order of primary name

SYNTAX   C:\>dir/on

Dir/oe – It display sorted order of extension

SYNTAX C:\>dir/oe

Dir/od – It display sorted order of date

SYNTAX C:\>dir/od

Dir/ad – It display only directories

SYNTAX   C:\>dir/ad

Dir/ah – It display only hidden files

SYNTAX   C:\>dir/ah

Dir/o-s – It display first files then second directory

SYNTAX C:\>dir/o-s

Dir/os – It display first directory then second files

SYNTAX    C:\>dir/os

Dir/l – It display all files and directory in small letter

SYNTAX   C:\>dir/l

Dir/s – It display the directory listing of all sub directories a sub subdirectories under the directory being listed.

You can also display the files of other directories as well. This can be done by specifying a path. A path tells DOS where a particular file is located. For example you want to see the of abc directory.

SYNTAX   C:\>Dir\abc

CD – This command changes your working directory to the directory you specify.

SYNTAX   C:\>Cd  <Dir name>

                   C:\>Cd ABC       

CD. . – Makes the parent directory of working directory as working directory.

CD\ - Makes root directory as the current working directory.         

MD – This command is used to create a subdirectory.

SYNTAX   C:\>Md  <Dir name>

                   C:\>Md ABC

RD – This command is used to delete a directory, which is empty (i.e. with no files under 

It and no directories under it except for two directories. And.) . The directory         being removed should not be the current working directory.

SYNTAX   C:\>Rd abc

File Commands

            File commands are those commands, which operate on files.

COPY – This command is used for copying one or more files from one location to

                Another. The structure of COPY command is

                 C:\> COPY Source pathname Destination pathname

                 C:\> COPY C:\student\abc.txt   C:\student\Sandeep

            C:\>COPY C:\Students\abc A:\

            C:\>COPY A:\abc C:\Students

DEL – This Command is used for deleting the specified files.

            C:\>Del <File Name>

            C:\>Erase <File Name> /p

            /p switch causes del or erase to prompt you before a file is actually deleted. If  /p        

            Is specified, file name is displayed and confirmation is asked as Delete Y/N? If

            You press Y; file is deleted, if N, delete operation is canceled.

REN (RENAME) – This command is used for renaming file(s)

            C:\>Ren Filename1 Filename2

            Where filename1 is old filename and filename2 is new file name.

TYPE – This command is used to display the contents of specified filename. Type

               Command works for one file only at a time.

                C:\>Type  <File Name>

BREAK – This command can be used to stop an activity.

                   C:\> Break

                   Ctrl+C

CLS – This command clears the screen.

            C:\>Cls

When used this command clears the screen, leaving only MS-DOS PROMPT and a cursor.

DATE – This command displays or sets the system date.

                C:\>Date      

TIME – This command allows one to enter or change the system time.

               C:\> Time   

PROMPT – This command changes the MS-DOS prompt. Mostly when you start your computer, you get either C:\> or A:\> as the prompt. To change the prompt to disk, give the following command.

                     C:\>Prompt Sandeep

                      SandeepPrompt $P$G

VER – This Command display the version number of MS-DOS you are working upon.

             C:\>Ver

VOL – This command display the disk volume label and serial number, if they exist

             C:\>Vol

EDIT – This command is used to change a file contents i.e. add, delete in a file.

              C:\>Edit <file name>  

PATH – This command displays or sets a command search path. The PATH command is used to tell DOS which directories it should search to find programs. If a directory is listed in the path, you don’t have to change to that directory to use a command or to start a program, which is stored under that directory.

            SYNTAX: Path [drive:] [path] [; [drive] [path]…]

                        C:\>Path=C:\dbase; c:\dos

The search path is the path of directories, which MS-DOS searches for executable

File after its search in the working directory is over. Executable files are files

With extensions .com or .exe or .bat. By default no path is set. The maximum

Length of a search path can be 127 characters.

DOSKEY – Doskey is a special utility program, that gives you more control over the    

                    Command prompt. You can edit the command line, recall the old command

                    For reuse or editing with the help of DOSKEY. Each time the user enters a command, the command added to DOSKEY’s command buffer.

                 SYNTAX: C:\> Doskey

MOVE – Move command helps you to move one or more files to the location you      

                Specify. The move command can also be used to rename directories.

                SYNTAX: C:\> Move <Source Path> <Destination Path>

                SYNTAX: C:\> Move abc.txt C:\student\xyz

DISKCOMP – This command compares two floppy disks and performs a track-by-track      

                          Comparison. Diskcomp only works for similar double density with double density and high density with high-density floppy disks and not for hard disks.

                  SYNTAX: C:\> diskcomp drive1: drive2

                                      C:\>diskcomp a: b:

                                       C:\>diskcomp a: a:

Will first prompt you to insert source diskette in a drive and after some time, it will ask you to remove source diskette and insert the target diskette in A drive. This command is used in single FDD systems.

DISKCOPY – This command makes the exact replica of source floppy disk in the destination floppy disk. Diskcopy formats the target disk before copying. Diskcopy works only for floppy disk and not for a hard disk.

                 SYNTAX: C:\> Diskcopy a: a:

FORMAT – This useful command formats a disk for use with MS-DOS. The FORMAT command creates a new root directory and file allocation table for the disk. It also checks for bad sectors on the disk. In order to make a new disk usable, it must be formatted using FORMAT command.

                                    Formatting means creating and marking new tracks and sectors on a disk. If the disk being formatted already contains information, it will be lost, as FORMAT will recreate the tracks and sectors.

                                                Tracks are concentric circles on a disk and each sector is further divided into smaller sections called sectors. The number of tracks on a disk and number of sectors on a track depend upon the disk type and its capacity. The storage unit

On a disk is a sector.  A read/write head reads or writes some fixed number of sectors (known as cluster) at a time.

                                    The outermost track is given number 0; next track is number 1, next 2 and so on. Track 0 is reserved for the disk information. The system area consists of three parts:  Boot area, directory area and File Allocation Table (FAT)

Boot area contains the bootstrap loader if the disk is bootable (i. e. it contains three system files IO.SYS, MSDOS.SYS and COMMAND.COM).

Directory area stores the names of files stored under the root directory. It also stores the starting cluster number of files it contains.

File Allocation Table is a table that stores all the clusters numbers which contain information of a file e.g. if a file ENTRY.DBF has an entry in the root directory and its starting cluster number is 3. The rest of the information of ENTRY.DBF is stored in clusters 5, 9, 10, 15, 16, 19, 20. Therefore the information sequence (cluster – chain) for ENTRY.DBF is cluster number 3 - > 5 - >9 - > 10 - > 15 - > 16 -> 19 -> 20 EOF.

            SYNTAX: C:\> Format a:

            SYNTAX: C:\>Format a:/s

The /S switch copies the system files to the floppy and makes it bootable.

This command specifies that you want to format the disk in drive A. When you press ENTER, the following message appears:

Insert new diskette for drive A:

And press ENTER when ready

            As it formats the disk, MS-DOS displays the percentage of the disk that has been formatted. When the format is complete, the following message appears.

Volume label(11 characters, Enter for none)?

LABEL – This command creates, changes or deletes the volume label on a disk. Label is upto 11 characters.

            SYNTAX: C:\>Label

MORE – It displays the output one screen at a time.

            SYNTAX: C:\> Dir | More

                               C:\> Type abc.doc | More

SYS – This command transfers MS-DOS system files (IO.SYS, MSDOS.SYS and COMMAND.COM) to the specified drive’s disk.

            SYNTAX: C:\> SYS A:

            Will transfer the system files to the disk in drive A and make it bootable.

PRINT – This command prints a text file.

            SYNTAX: C:\> Print abc.bio

                               C:\>Type abc.bio>prn    or dir>prn

TREE – This command graphically displays the path of each directory and sub-directory on the given drive.

            SYNTAX: C:\>Tree

            /f    displays the names of the files in each directory.

XCOPY – Xcopy is kind of a super version of Copy command available with the all Dos version 3.2 and hence. This command copies directories, their sub-directories, and files (except hidden and system files) to the specified destination.

            SYNTAX: C:\> Xcopy C:\student\abc c:\student\xyz\abc /s

(/S copies all the subdirectories also)

 

BATCH PROCESSING (FILE) - You may often find yourself repeatedly typing the same sequence of commands to perform some common task. With MS-DOS, you can put this command sequence into a special file called batch file, and then run the whole sequence of commands by simply typing the name of the batch file. MS-DOS performs these “batches” of commands just as if you had typed them from keyboard. This is called batch processing. Batch files are text files with .bat extension containing MS-DOS commands.

            SYNTAX: C:\> Copy Con A.bat

                        Dir

                        Dir/p

                        Dir/on/p

                        Dir/oe/p

                        Date

                        Time

                        F6

If you want to run the batch file, just type the primary name of batch file at command prompt..

For example-  C:\>A

CHKDSK (SCANDISK) – The CHKDSK command can be used to check a hard disk or floppy disk for directory entries or the file allocation table. In most cases, these errors are repairable. These are not errors that you have made, but rather flaws that arise over time as a result of disk aging. With regular use of CHKDSK you can identify and repair disk errors before they become unmanageable. 

            SYNTAX: C:\> chkdsk a:

SORT – In order to view the file list in alphabetical order, you must have the sort.exe file in the current directory or in the path given by you. Sort is an external command.

SYNTAX: C:\> Dir | Sort | More

If you have too many files to fit on one screen, you will desire to make the listing pause after each screen. Use the following command.

                             C:\>Dir | Sort | More

FDISK – The command is used to define disk partitions on a DOS fixed disk. Fdisk directs DOS to divide your fixed disk into logical collections of cylinders called partitions. If the disk is partitioned, different operating systems can be kept on fixed disk. The Fdisk command permits user to add, change, display, or delete disk partitions.

            SYNTAX: C\> Fdisk

FIND – If you want to find all the lines, which contain a particular group of characters in a file, you can do this with the Find command. Find is an external command.

            SYNTAX: C:\> Find “Hello” Friend.txt

This will display all the lines in the file, which contain the word Hello.

BACKUP – It is extremely necessary to have more than one copy of your important files. This can be done by using the Backup command. A backup is an exact copy of the data and programs on your hard disk. If something happens to the original copy, you can use the backup to restore the data and programs. The backup command can be used to copy from the Hard Disk to Floppy disk only and not vice versa. Also it erases all the data previously stored on the floppy disk. Backup is an external command.

SYNTAX: C :\>Backup c:\docs a:

RESTORE – The copied data from a hard disk to floppies using Backup command cannot be retrieved by using the Copy command This data can only be retrieved by using the Restore command. Only the files, which were copied using the Backup command, can be retrieved by the restore command.

SYNTAX: C:\> Restore A: C:\docs

ATTRIB – Attrib allows you to display or change the current file attributes. Attributes, which are allowed under DOS r (read-only), h (hidden) and s (system)

+H – Sets the file as a Hidden file. –H Clears the Hidden File attribute.

SYNTAX: C:\> Attrib abc +h

APPEND – Defines the data file search path that DOS will use each time it fails to locate a file in the current directory or in a specified directory.

When DOS cannot find a data file as specified or in the current directory, it searches to see if the user has defined a data file search path. The DOS APPEND command will allow you to define disk drives and subdirectories to be included in this path.

SYNTAX: C:\> Append C:\wordroc

                    C:\> Append c:\; d:\; a:\

MODE – The command is used to specify device characteristic i.e. a parallel printer’s mode of operation is set. A graphic/colour display adapter’s mode of operation is set.

SYNTAX: C:\> Mode LPT1: 80,6,P

This command will set parallel printer1 to print 80 characters per line with 6 lines printed per vertical inch.

                        C:\>Mode 40

This command sets the display width to 40 characters per line.

HELP – It displays short summaries of command syntax. Invoke the HELP command without parameter to list all the standard DOS line and batch commands.

SYNTAX: C:\>Help

DELTREE – The command deletes an entire directory that contains files; sub-directories or both files and subdirectories you will like to use this command when you want to delete an entire directory without having to empty it first.

SYNTAX: C:\>Deltree <Directory Name>

ECHO – The command is used in batch files to display or suppress batch command messages.

Echo On/Off

On – Enables the display of batch command as they execute.

Off – Disables the display of batch commands as they execute.

REM – Display a message during the execution of a batch file. Message is the character string whose length can be only upto 123 characters. Message is displayed only if ECHO is ON.

CALL-This commands invokes a second batch file from within a currently running batch file, then returns to the original batch file.

SYNTAX   CALL[drive:\path\]batch file

Call requires the name of another batch file. For example

@ECHO OFF

CALL ABC

DEL C:\BOOK\*.BAK

XCOPY C:\BOOK\*.* A:/M/S

The AUTOEXEC.BAT File:-The AUTOEXEC.BAT file is the most important batch file in your system. It is located in your root directory, this file is read automatically when you boot your PC. This file is useful because it executes a sequence of commands, like setting the path and prompt, etc. as soon as the computer is switched on.

The CONFIG.SYS File:- When you start your computer, DOS carries out certain commands which configure your hardware and reserve space in memory for information processing. The file containing these commands is called CONFIG.SYS. This file helps in enhancing the performance of your PC.

There are two types of files in DOS

  1. Executable Files
  2. Non- Executable

Executable Files—Executable files are files that are run or execute directly on the PC. Extension of these files is .EXE, .COM and .BAT.  COM and .EXE are in the Binary Code (Machine language) while .BAT files are made in Simple Words. Batch files are the set of instruction.

Non-Executable Files—Non executable files are files in which data, information or program are stored which could not be run directly. Non-executable files are many types and extension of these files may be anything. Like .DOC, .TXT, .BMP, .TIF etc

Concepts of Free/Open Source and Proprietary software

The term open source refers to software whose source code — the medium in which programmers create and modify software — is freely available on the Internet; by contrast, the source code for proprietary commercial software is usually a closely guarded secret.

The most well-known example of open source software is the Linux operating system, but there are open source software products available for every conceivable purpose.

Open source software is distributed under a variety of licensing terms, but almost all have two things in common: the software can be used without paying a license fee, and anyone can modify the software to add capabilities not envisaged by its originators.

A standard is a technology specification whose details are made widely available, allowing many companies to create products that will work interchangeably and be compatible with each other. Any modern technology product relies on thousands of standards in its design — even the gasoline you put in your car is blended to meet several highly-detailed specifications that the car’s designers rely on.

For a standard to be considered an open standard, the specification and rights to implement it must be freely available to anyone without signing non-disclosure agreements or paying royalties. The best example of open standards at work is the Internet — virtually all of the technology specifications it depends on are open, as is the process for defining new ones.

An Application Programming Interface (API) is a feature of a software application that allows other software to inter-operate with it, automatically invoking its functionality and exchanging data with it. The definition of an API is a form of technology standard. The term open API doesn’t yet have a universally accepted definition, but it’s generally expected to be “open” in the same manner as an open standard.

The common theme of “openness” in the above definitions is the ability of diverse parties to create technology that interoperates. When evaluating your organization’s current and anticipated software needs, consider a solution’s capability to interoperate as an important criterion. To extend the value of your technology investment, select a software solution that is based on open standards and APIs that facilitate interoperability and has the capability for direct integration between various vendors’ products.

 

 

 

Linux

 

Linux: - Before knowing the Linux, you must know about the Unix. Unix is the most versatile and popular operating system found today on scientific and high-end workstations.  Linux is a project initiated to create a working version of UNIX on Intel-based machine, more commonly referred to as IBM PC-compatible computers that most people are familiar with. Linux is an open-source operating system enhanced and backed by thousands of programmer’s worldwide. It is a multi-tasking operating system that was originally designed to be used on personal computers. The name “Linux” is derived from its inventor Linus Torvalds. Linus was a student at the University of Helsinki, Finland in early 1990s when he wrote the first version of an Unix-like kernel as a toy project. He later posted the code on the Internet and asked programmers across the world to help him build it into a working system. The result was Linux. Torvalds holds the copyright but permits free distribution of the source code.  Today, there are thousands of software developers around the world contributing software to the open source community that feeds the Linux initiative. Because the source code for the software is freely available, anyone can work on it, change it, or enhance it.

            Linux is basically a UNIX clone, which means that with Linux you get many of the advantages of UNIX. Linux is multitasking, means that you can run multiple programs at the same time, and each program seems to process continuously. Other system, such as Microsoft Windows 3.1, allows you to run multiple programs, but when you switch from one program to another, the first program typically stops running. Microsoft’s Windows 98 and Windows NT are more like Linux because they allow preemptive multitasking.  Linux allows you to start a file transfer, print a document, copy a floppy, use a CD-ROM and play a game-all at the same time.

            Linux is fully multi-user capable, which means that more than one person can log in to and use the system at the same time. Although the multi-user feature may not be very useful at home, it gives many people in a corporate or university setting access to the same resources at the same time yet eliminates the need to duplicate expensive machines.  If you have heard Linux described as a free version of UNIX, there is good reason for it. Although much of the code for Linux started from scratch, the blueprint for what the code would do was created to follow POSIX (Portable Operating System Interface for UNIX) standards. POSIX is a computer industry operating system standard that every major version of UNIX complied with.

            Linux grew within a culture of free exchange of ideas and software. Like UNIX, the focus was on keeping communications open among software developers. In the 1980s and 1990s, while Microsoft flooded (busy) the world with personal computers running DOS and Windows operating system, power users demanded more from an operating system. They want such systems that could run on networks, support many users at once (multi-user), and run many programs at once (multitasking). DOS and Windows did not cut it. On the other hand, UNIX grew out of a culture where technology was king and marketing people were hard to find. Bell Laboratories in Murray Hill, New Jersy, was a think tank where ideas came first and profits were somebody else’s problem. A quote from Dennis Ritchie, co-creator of UNIX, sums up the spirit that started NIX. In that spirit, the first source code of UNIX was distributed free to universities. Like Linux, the availability of UNIX source code made it possible for a diverse population of software developers to make their own enhancement to UNIX and share them with others.

Basic 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:

·       Multi-user: -Linux is the multi-user operating system. Not only you can 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. If users want, They can have their own environments arranged the way they want such as, their own home directory for storing files and their own desktop interface (with icons, menus, and applications arranged to suit them). User accounts can be password-protected, so that users can control who has access to their applications and data.

·       Multitasking: - It also has the features of 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 the Linux operating system can itself 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 request 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): - Linux is a GUI based 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 graphical user interface 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 image and windows manager to provide the look and feel of your GUI (icons, window frames, menus, and colors, or a combination of those items called themes). There are several desktop environment and several desktop managers to choose from. 

·       Hardware Support: - You can organize (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 DVDs and pen drives), sound cards, tape devices, video cards, and most anything else you can think of. As device interfaces, such as USB and FireWire, have been added to computers, support for those devices has been added to Linux as well. (Most hardware manufacturers don’t provide 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) cards, modems and serial devices. In addition to LAN protocols, such as Ethernet (both wired and wireless), all the most popular upper level networking protocols can be built-in. The most popular of these protocols is TCP/IP. 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: - 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 server.

·       Application Support: - Because of compatibility with POSIX (Portable Operating System Interface for UNIX) and several different application programming interfaces (APIs), a wide range of freeware and shareware software is available for Linux. 

 

Advantage of Linux: - Linux has many advantages. When compared to different commercially available operating system, the best properties of Linux are its price, its reliability and the freedom it gives you. Linux is the most popular free operating system that is widely available. 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 no licensing fees and the capability of using inexpensive hardware and compatible free add-on applications. Although commercial operating system tend to encourage upgrading to later hardware. Linux does not require that (although faster hardware and larger disks are nice to have).

            In terms of reliability, Linux is more reliable than most desktop-oriented operating system. This is especially true if you rely on your computer system to stay up because it is a Web server or a file server. (You don’t have to reboot every time you change something).

               Because you can get the source code, you are free to change any part of the Linux system, along with any open source software that comes with it, in any way that you choose. Unlike many self-contained commercial products, open source software tends to be built in pieces that are meant to interact with other pieces, so you are free to mix and match components to suit your tastes.

            Another advantage of using Linux is that help is always available on the Internet. For the IBM PC, Linux provides a complete system with built in multi-user and multitasking capabilities that take advantage of the entire processing power of your 386 and higher computer systems. Linux comes with a complete implementation of the TCP/IP networking protocol. With Linux, you can connect to the Internet and the vast wealth of information it contains. Linux also provides a complete email system to send message back and forth through cyberspace. Linux also has a complete graphical user interface (GUI), Xfree86, that’s based on the popular X Window System. Xfree86 is a complete implementation of the X Window System that can be distributed free of charge with Linux. Xfree86 provides the common GUI elements you find on other commercial GUI platforms, such as Windows and OS/2. Today, all these features are available for Linux and are basically free.

            Although using an operating system is sometimes fun in and of itself, it is not the reason most people use a computer. Most people need to do productive work with their computers. Linux has literally thousands of application available today, including programs for spreadsheets, databases, word processing, and application development in a variety of computer languages and telecommunications packages to get you online. Linux also comes with a wide range of games, both text and graphics-based. If you are a computer professional, Linux provides a wealth of tools for program development. It includes compilers for many of the top computer programming languages today, such as C, C++ and Smalltalk. If you don’t like those languages, Linux provides you with tools, such as Flex and Bison that you can use to build your own computer languages. Linux also allows you to communicate with your company’s office systems. And if you are a UNIX system administrator, Linux can help you perform your duties from home.

            Linux is a culture that encourages interoperability. For example, if you don’t like a window manager, you can plug in a different one because so many were built to operate within the same framework. Linux is also beneficial to students also. Linux provides you with editors to write your assignments and spell checkers to proof those assignments.

            At the basic level, Linux is a system built by and for hackers. The popular definition of hacker has a negative connotation (suggestion/shade) in today’s society, but computer hackers are not criminals by their definition of the world. (Hackers feel a certain depth of commitment and an enhanced level of excitement at hacking a system). Hacking basically means learning all there is to know about a system, becoming absorbed (deep) in the system to the point of distraction (interruption), and being able to fix the system if it breaks.

Hardware Requirements of Linux

To be able to install Linux successfully, you need supported hardware. Choosing the right level of hardware for your Linux system depends on such factors as the number of users to be supported and the types of application to be run. Most Linux system today consist of PCs. These Linux installations are often for only a single user, although they may also be tied into larger Linux or UNIX systems. Linux developers typically have access only to their personal computers. Luckily, because so many Linux developers exist, most of the standard hardware found in the PC world is supported.

  • The System’s CPU:- A basic system requires an IBM-compatible PC with an Intel 80386 or later CPU in any of the various CPU types and Intel’s various Pentium processors. Other CPU clones, such as the 80686 clone chips made by Cyrix and Advanced Micro Devices(AMD), are also compatible with Linux. For a text-only installation, a 200 MHz Pentium, while a 400 MHz Pentium II is the minimum for a GUI installation. The Linux kernel has also been ported(believe) to other processors. Among those now supported are the DEC Alpha, the PowerPC(Macintoshes), Sun Sparcs and even embedded systems processors such as those used in Corel’s Network PC running the Debian distribution.
  • The System’s Bus:- The types of bus used to communicate with the peripherals is also important. Linux works with only the ISA, EISA and PCI buses. Some newer systems use a faster bus, called the local bus, for example,  for disk access and video displays. Linux does support the VESA Local Bus might not support a non-VESA Local Bus architecture.
  • Memory Needs:- Linux requires surprisingly little RAM to run, especially when compared to comparable operating system such as OS/2 and Windows NT. Linux requires at least 16MB of RAM, although 64MB is highly recommended. If you have less than 32Mb of RAM, you need to use what’s called a swap file. The next memory consideration for Linux is the use of the X Window System clone called XFree86. XFree86 is a version of the X Window System that can be freely distributed and is included with Linux for that reason. XFree86 is a GUI similar to Microsoft Windows.
  • Disk Drives and Space Requirements:- Although you can run Linux from a floppy drive only system, running Linux from your system’s floppy drive is not recommended. For better system performance, you should install Linux on a hard drive. The amount of disk space required depends on the software you install and the amount of data you expect that software will generate. Linux requires less disk space than most implementation of UNIX systems. You can run a completely functional Linux system, without X Window System support, in 600MB. For a complete installation of everything in the distribution, more than 1.6 GBs is recommended.
  • Swap Space:- If you have limited RAM, you need swap space. Whereas systems such as Microsoft Windows create a swap file that resides on your hard drive as any other file, Linux allows the swap file to reside on a separate swap partition. Most Linux installation use partitions rather than files. Because you can place multiple on the same physical hard drive, you can place the swap partition on the same drive  as Linux, but for better performance, you should place the swap partition on a separate drive. Linux allows up to eight swap partitions that can be no larger than 16MB. A rule of thumb is set to set the swap file size to twice the amount of physical RAM contained on your system. Thus, if you have 8MB of physical RAM, your swap partition should be 16MB in size.
  • Monitor Requirements:- For text-based terminals, Linux supports all standard CGA, EGA, VGA and SuperVGA video cards and monitors. To take advantage of the color coding directory listings available with Linux, you need a color monitor. So for text-based operation, any video/controller combination should work.
  • CD-ROMs:- To install the Linux system, you must have a CD-ROM drive supported by Linux. Because most CD-ROMs use a SCSI interface controller, any SCSI controller should work with a CD-ROM attached to the controller. Linux also now supports many of the new EIDE and ATAPI CD-ROMs available on the market.
  • Mouse Devices:- Using text-based Linux does not require a mouse. However, Linux does allow you to cut text from any area of the screen and paste it to the command line by using a mouse. If you intend to use the X Windows system clone, XFree86, you must like a mouse.

Various flavors of Linux

 

Linux is distributed by many different organizations, each of which provides a unique collection of programs along with the core group of files that constitute a Linux release. Today there are close to 200 Linux distribution versions. Some of the most popular distribution versions include Caldera OpenLinux eServer, Red Hat, SuSe, TurboLinux Server, Linux-Mandrake, Debian Linux, Connectiva and Red Flag. These versions are available from commercial vendors who make money by selling their implementation as well as installation, maintenance and other services. Linux is also distributed by the non-profit Debian organization, which is developing a free operating system and related software. The main difference among various distribution versions includes the set of tools, library version, number and quality of application, documentation, support and service.  Different Linux distributions are suited for different purposes. People looking for a more stable, well tested system may want to go with Debian, CentOS(a free version of Red Hat Enterprise Linux), or even Ubuntu LTS. There is no one right distribution for everyone has a favorite.

Linux Standard Directories

When you log in, the system places you in your home directory. The PATH environments variable is set to point to other directories that contain executable programs. These other directories are part of the standard Linux directory structure. These directories include the classic set of directories for UNIX and what can be called the “emerging standard set of directories”, which Linux basically follows.

Classic UNIX Directories: - Before UNIX System V Releases 4 (for example, UNIX System V Release 3.2 and earlier), most versions of UNIX settled on a regular system of organizing the UNIX directories that looked like this:

/

            /etc

            /lib

            /tmp

            /bin

            /usr

                        /spool

                        /bin

                        /include

                        /tmp

                        /adm

                        /lib

The /etc directory contains most of the system-specific data required to boot, or bring the system to life. It contains such files as passwd and inittab, which are necessary for the proper operation of the system.

The /lib directory contains a library of function needed by the C compiler. Even if you don’t have a C compiler on your system, this directory is important because it contains all the shared libraries that application programs can call. A shared library is loaded into memory only when the command calling it is run. This arrangement keeps executable programs small. Otherwise, every running program contains duplicate code, requiring a lot more disk space to store and a lot more memory to run.

The /tmp directory is used for temporary storage. Programs that use /tmp generally clean up after themselves and delete any temporary files. If you use /tmp, you should be sure to delete any files before logging out. Because the system automatically deletes the contents of this directory periodically, don’t keep anything you might need later in it.

The /bin directory keeps all the executable programs needed to boot the system and is usually home for the most commonly used Linux commands. However, note that an executable program does not have to be binary (which the names bin implies). Several smaller programs in /bin are, in fact, shell scripts.

The /usr directory contains everything else. Your PATH variable contains the string /bin:/usr/bin because the /usr/bin directory contains all the Linux commands that are not in the /bin directory. This arrangement has a historical precedence. In the early days of Linux, hard disks were not very big. Linux needs at least the /etc/tmp/ and /bin directories to bootstrap itself. Because the disks of the early Linux era held only those three directories, everything else was on a disk that could be mounted after Linux was up and running. When Linux was still a relatively small operating system, placing additional subdirectories in the /usr directory was not much of a burden. It allowed a moderately sized Linux system to exist with just two disks: a root disk and a /usr disk.*********************************

Linux Directories: - One problem with the classical structure of UNIX is that backing up your data files is difficult with a fragmented /usr directory. Three different levels of backup generally are required in a system: the basic system itself, any changes to the tables that define the basic system for a specific site, and user data.

            The basic system should be backed up only once, with changes to the controlling tables backed up when changes are made. User data changes all the time and should be backed up frequently. The typical Linux directory structure is shown here, but your structure might be a little different depending on what packages you have installed:

/

            /etc

                        /passwd (user database)

                        /rc.d (system initialization scripts)

/sbin

/tmp

/var

/lib

/home

            / <your user name here>(user accounts)

/install

/usr

            /bin

/proc

 

The /bin, /etc, and /tmp directories have the same function as they do in the classic structure. System definition tables are moved into the /var directory so that whenever the operation of the system changes, you can back up only that directory.

What’s new is that all system programs are moved into the /sbin directory. All the standard Linux programs are in /usr/bin, which is linked to /bin. For compatibility, all the classic directories are maintained with symbolic links. The /usr directory, which no longer contains user data, has been reorganized to make sense from the chaos that once was the /usr/libdirectory.

Functions of Profile and Login Files in Linux

The /etc/profile file—It stores system-wide environment configuration and startup programs for login setup. All configurations that you want to apply to all system user’s environments should be added in this file. For instance, you can set you’re the global PATH environment variable.

            Linux is a multi-user, time sharing system, implying that more than one user can log in and use a system. Linux also allows user’s environment to be created or maintained in two major ways: using system-wide(global) and user-specific(personal) configurations. Normally, the basic method of working with a linux system is the shell, and the shell creates an environment depending on certain files it reads during its initialization after a successful user login.

            When the shell is invoked, there are certain initialization/startup files it reads which help to setup an environment for the shell itself and the system user: that is predefined (and customized) functions, variables, aliases and so on.

There are two categories of initializations files read by the shell:

  • System-wide startup files – these contain global configuration that apply to all users on the system, and are usually located in the /etc directory. They include: /etc/profiles and /etc/bashrc or /etc/bash.bashrc
  • User-specfic startup files – these store configurations that apply to a single user on the system and are normally located in the users home directory as dot files. They can override the system-wide configuarions. They include : .profiles, .bash_profile, .bashrc and .bash_login

SHELL: - Shell is a command interpreter. There are a large number of commands, which is provided by shell. After you log in, Linux places you in your home directory and runs a program called a shell. A shell is really nothing more than a program designed to accept commands from you and execute them. Many kinds of programs can be used as shells, but several standard shells are available with almost all versions of Linux. Before icons and windows took over computer screens, you typed commands to run most computers. On UNIX systems, from which Linux was derived, the program used to interpret and manage commands was referred to as the shell. The shell provides a way to run programs, work with the file system, compile code, and manage the computer. Although the shell is less intuitive (perceptive) than common GUIs, most Linux experts consider the shell to be much more powerful than GUIs. Because shells have been around for so long, many advanced features have been built into them.

Red Hat Linux provides the following shells: sh, bash (Bourne Again Shell), tcsh, csh, pkdsh (Public Domain Korn Shell), zsh, ash and mc. You should try each shell and pick the one you like. Most Linux distributions install bash as the default shell. Also, sh is available on most UNIX systems, and you will find many shell scripts written with sh commands.  Because the shell serves as the primary interface between the operating system and the user, many users identify the shell with Linux. They expect the shell to be programmable, but the shell is not part of the kernel of the operating system. With enough background in systems programming and knowledge of the Linux operating system, you can write a program that can become a shell.

Linux Kernel

The kernel is the core of the Linux operating system and provides the basic system services to the rest of Linux. As you know, Linux is not a commercial product, so you might find some problems after a new distribution is released. This happens all the time with both commercial and free operating systems. The difference is that with Linux, because the source code is available, you can patch any problems immediately after they are discovered. You don’t have to wait for your commercial vendor to release a new service pack to fix a hole in your system.  In addition, a new feature in the current releases of the Linux kernel enables you to load specific device and program support into the kernel without precompiling the support into a large kernel. As a result, Linux can load into memory only those parts of the kernel it needs. Modules also provide a way for you to modify the kernel to solve a problem or to add a new feature without recompiling the entire system.

               Sometimes a problem has only one solution- a new kernel. The Kernel is the core operating system for Linux. If you have some programming experience and know your way around way the C Programming language, you should be able to build and install a new kernel.

 

 

Login and Logout from Linux System

When you begin working on your system, you will need to log in. Logging in tells the system who you are and what you have permission to do. Likewise, when you finish, you will log out so that no one else can access your files without permission.

            To ensure security and organization on a system with many users, Unix machines employ a system of users accounts. The user accounting features of Unix provide a basis for analysis and control of system resources, preventing any user from taking up more than his or her share, and preventing unauthorized people from accessing the system. Every user of a Unix system must get permission by some access control mechanism.

Logging in to a Unix system requires two pieces of information: A username and a password. When you sit down for a Unix session, you are given a login prompt that looks like this:

Login:

Type your username at the login prompt, and press the return key. The system will then ask you for your password. Your username is assigned by the person who creates your account. Your username must be unique on the system where your account exists since it is the means by which your are identified on the system.

            When your account is created, a password is assigned. The first thing you should do is change your password, using the password utility. To change your password, type the command

Passwd

It is very important that you choose a good password, so that someone else cannot guess it.

When you are ready to quit, type the command

Exit

Before you leave your terminal, make sure that you see the login prompt, indicating that you have successfully loffed out. It is always a good idea to clear the display before you log out, so that the next user doesnot get a screenful of information about you, your work, or your user account. You can type the command

Clear

 

Linux Commands

 

BC :- The calculator called bc. Bc stands for base conversion, which is one of its function, or the best calculator. It is invoked by typing bc at the shell prompt. Once you type bc at the prompt, you are in the calculator mode, and the $ prompt disappears. The input to the calculator is taken line by line. Enter an expression and Linux supplies the result as shown here:

$bc

10/2*2

10

2.5*2.5+2

8.25

quit

 

Typing quit ends your tryst(meeting) with bc. While working with floats if you want precise answers all that you need to do is set the variable scale to a value equal to the number of digits after the decimal point till which you want the answer to be printed.

$bc

scale=1

2.25+1

3.35

After setting the scale variable if the answer of an expression turns out more than what scale can provide than the value in scale is ignored and the correct answer is displayed.

Another useful features of bc is that of base conversion. Ibase and obase, two command are used for base conversion.

$bc

ibase=2

obase=16

11010011

89275

1010

A

Quit

By setting the variable ibase to 2 and obase to 16 all input that we supply is taken as a binary number whereas all output is displayed in hexadecimal.

Bc also supports functions like sqrt, cosine, sine tangent etc.

$bc

sqrt(196)

14

s(3.14)

unimplemented

sqrt() is an in-built funtion whereas s() and c() which stand for sine and cosine respectively would work only when bc is invoked(appeal to) with the –l option.

$bc-l

scale=2

s(3.14)

0

Note that the trigonometric functions expect their argument in radians and not in degrees.

Bc also allows setting up of variables. The life of these variables is until you exit bc(by typing quit). These variables can be used in programs. Yes, bc is a programmable calculator in its truest sense.

$bc

for(I=1;I<=5;I=I+1) I

1

2

3

4

5

quit

[This C like program prints numbers from 1 to 5 using a for loop which gives values 1 to 5 to the variable i. If you want print the variable’s value, simply type it’s name, as justified by the I following the closing parenthesis in the above program. ]

The scope of bc’s programming ability is vast. It can support loops, decision, function definitions, several operators etc. [Just say man bc and explore on your own what more bc has to offer.]

 

Cal:- Linux understanding of time is superb(excellent ). You already know that date command is displayed current date and time. But if you want to calendar, you can use cal command. It is capable or printing calendar  for any year in the range 1 to 9999. To invoke it all that we have to do is type cal.

$ cal

Fri Apr 26 18:21:10 1996

            Mar                             Apr                              May

The output shows the current date as well as the calendar of preceding, current and succeeding month. If you want to see only calendar of only a specific month, say, February 1997, you will have to be more explicit(begin) while using the cal command. 

$ cal 2 1997

Here, 2 indicates February. In place of 2 you could have used feb or just a f. However, you can not use cal j 1997 to obtain January 1997’s calendar. This is because j might as well stand for June or July. If you become more specific and say cal ja 1997, it works.

CAT: Cat( concatenate) command is very frequently used in Linux. It reads data from the file and gives their content as output. It helps us to create, view, concatenate files.

1)     To view a single file command

$cat filename

2)     To view multiple files command

$ cat file1 file2

3)     To view contents of a file preceding with line numbers

$cat –n filename

4)     Create a file command

$cat >newfile

CD: Cd command in Linux known as change directory command. It is used to change current working directory.

Syntax:

$cd [directory]

To move inside a subdirectory

$cd [directory_name]

 

 Clear: Clear is a standard Unix computer operating system command that is used to clear the terminal screen. This command first looks for a terminal type in the environment and after that, it figures out the terminfo database for how to clear the screen. And this command will ognore any command line parameters that may be present. Also, the clear command does not take any argument and it is almost similar to cls command on a number of operating system.

Syntax:

$Clear

 

 

CMP:- You may often require to know whether two files are identical so that one of them can be deleted. There are three commands in the UNIX/Linux system that can tell you that. It needs two filenames as arguments:

$ cmp chap01 chap02

chap01 chap02 differ: char 9, line 1

the two files are compared byte by byte, and the location of the first mismatch (in the ninth character of the first line) is echoed to the screen. The –l(list) option gives a detailed list of the byte number and the differing bytes in octal for each character that differs in both files:

$ cmp –l note1 note2

3          143      145

6          170      167

7          171      170

8          172      171

There are four differences in the two files. If the two files are identical, cmp displays no message, but simply returns the $ prompt. For example,

$ cmp chap01 chap01

$

CP: The cp command is similar to the DOS copy command. You can use this command to copy one or more files from one directory to another directory. The syntax of cp is as follows:

Cp from-filename to-filename

You must supply both the from-filename and to-filename parameters for the files to be copied. For example:

$ cp letter.a letter.b

This will copy the contents of letter.a into a file letter.b. If letter.b does not exist, it will be created. However, if it does  exist, Linux will overwrite it without warning you.  Just as in DOS, in Linux too you can copy files from or to different directories by specifying their name along with the path. For example,

$ cp /usr/aa16/chapter1 /usr/aa16/newbook/chap1

here the file chapter1 is copied from the directory /usr/aa16 to the directory /usr/aa16/newbook. When copied to this directory it would have the name chap1 instead of capter1.

Also note that in the above example we have used absolute pathname to refer to the file chapter1. the absolute pathname started at the root directory /.

Sometimes instead of absolute pathname we may use a relative pathname. This refers to the pathname starting from the directory in which you are now.  This command is used to copy files or group of  files or directory. It creates an exact image of a file on a disk with different file name. cp command require at least two filenames in its arguments.

Syntax:

Cp [option] Source Destination

Cp [option] Source Directory

 

MV: mv command is used to move existing file or directory from one location to another. Is is also used to rename a single directory or file then mv option will be better to use.

Syntax:

Mv [option] source destination

For example

$ mv a.txt geek.txt

If the destination file does not exist, it will be created. In the above command mv simply replace the source filename in the directory with the destination file name (new name). if the destination file exist, then it will be overwrite and the source file will be deleted. By default, mv does not prompt for overwriting the existing file, so be carefule.

Date- command is used to display the system date and time. date command is also used to set date and time of the system. By default the date command displays the date in the time zone on which unix/linux operating system is configured.You must be the super-user (root) to change the date and time.

Syntax:

date [OPTION]... [+FORMAT]

date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]

Options with Examples
1: date (no option) : With no options, the date command displays the current date and time, including the abbreviated day name, abbreviated month name, day of the month, the time separated by colons, the time zone name, and the year.

Command:

$date

Output:

Tue Oct 10 22:55:01 PDT 2017

 

Find Command:- If you can not find a file by looking with the ls command, you can use the find command. The find command is an extremely powerful tool, which makes it one of the more difficult commands to use. The find command has three parts, each of which can consist of multiple subparts:

  • Where to look
  • What to lokk for
  • What to do when you find it

If you know the name of a file but do not know where in the Linux file stricture it’s located, the simplest case of the find command works like this:

Find / -name filename –print

If you know that a file is probably in the /usr or /usr2 directory, you can use the following command instead:

Find /usr/usr2 –name filename –print

For example,

Find *.jpg

It finds all the files in the current directory with the .jpg extension.***

 

Listing Files: - The basic command to list files is ls. The way ls displays files depends on how you use the command. If you use the ls command in a pipe, every file is displayed on a line by itself. This is also the default for some version of UNIX, such as SCO UNIX. Other version of UNIX list files in several columns. For most uses, the columnar format is more convenient; systems that list files one per row often have an alternative command, usually lc, for lists in column format. The ls command’s behavior is modified with the use of flags that take the form –abcd.

Flags used with the ls command can be concatenated or listed separately. This means that the following commands are effectively identical:

Ls –l –F

Ls –lF

 

Several of the flags used with ls and their uses are shown in the table: -

Flag

Description

-a

Lists all entries. In the absence of this or the –A option, entries whose names begin with a period (.) are not listed. Linux has a way of “hiding” files; all files that begin with a period by default are not listed because they are generally files used to customize applications.

-A

Acts the same as –a, except that. and .. are not listed.

-b

Forces printing of nongraphic characters to be in octal \ddd notation. –b is more useful than the –q flag because it allows you to figure out what the characters are.

-c

Uses the time of the last edit (or last mode change) for sorting or printing. Linux maintains three time and date stamps on every file: the file creations date, the date of last access, and the date of last modifications. Normally, files are listed in ASCII order (alphabetical order, except that capitals are sorted before lowercase letters).

-C

 

 

 

 

 

 

 

 

 

 

PWD: pwd stands for Print Working Directory. It prints the path of the working directory, starting from the root. Pwd is shell built-in command (pwd) or an actual binary(/bin/pwd). $PWD is an environment variable which stores the path of the current directory. This command has two flags.

Pwd –L: Prints the symbolic path

Pwq –P: Prints the actual path

MKDIR:-  Because Linux’s file system is based on directories, Linux provides the mkdir command so that users can create new ones. Unlike DOS, which has an alias for the mkdir command called MD, Linux requires that the full mkdir command be spelled out. You must specify a name for each new directory, as shown in the following example:

$ mkdir backup

among the options available with mkdir is –p, which allows you to create multiple generations of directorie, at one go. That means, it creates all the parent directories specified in the given path too. For example

$ mkdir –p works/bpb/linux/book

The –p option tells Linux to first create works, then within it bpb, next its child directory linux, and lastly book, nested within all these.

MORE:- The more command displays a screen of a text file. You can look through a text file without invoking an editor, printing the file, or trying to pause the terminal as it displays the file. For example, to display the contents of your Emacs configuration file, you can type the following:

$ more –emacs

A disadvantage of using more is that you can not backup to see a screen of information after it passes.

RM:- To delete files under Linux, you can use the rm command. The rm command is dangerous because as soon as a file is deleted, you can never recover it. for safety reasons , you should use the following form of the rm command:

$ rm –i filename

 where –i  is a switch, removes file interactively; i.e. you are asked for confirmation before deleting the file. For example, the command rm fred1 removes the file named fred1, whereas the command rm-i fred1 deletes the fred1 file after asking whether you really want to remove this file.

            In DOS, to remove a directory, you are first required to empty the directory, and then delete it. Linux offers a single command for the same.

$ rm –r dir1

This command recursively (-r) removes all contents of dir1 and also dir1 itself.

Rm used with the –f option removes files forcibly, irrespective of whether you have write permission to them or not.

RMDIR:- The rmdir command deletes Linux directories. The command takes the name of the directory to delete. This directory must be empty, otherwise, Linux can not remove it. For  example, if the /backup directory has two directories within it, the command rmdir /backup fails. The command rmdir /backup/jack/* removes all files in the /backup/jack directory, and then rmdir /backup/jack removes the now empty /backup/jack directory.

            With the –p option, rmdir wields enough power to remove not only the specified directory, but also its parent directories.

 

Chgrp- chgrp in Linux is used to change the group ownership of a file or directory. All files in Linux belong to an owner and a group. You can set the owner by using “chown” command, and the group by the “chgrp” command.

Syntax:

chgrp [OPTION]… GROUP FILE…

chgrp [OPTION]… –reference=RFILE FILE…

 

Note: First we need to have administrator permission to add or delete groups. We can Login as root for this purpose or using sudo. In order to add a new group we can use:

sudo addgroup geeksforgeeks

 

Example 1: To change the group ownership of a file.

Chmod-  It is used to change the access permissions of files and directories. It stands for change mode. The file permission in Linux are the following three types:

  1. Read(r)
  2. Write(w)
  3. Execute(x)

Syntax:

Chmod [reference][operator][mode] file

The references are used to distinguish the users to whom the permissions apply i.e. they are list of letters that specifies whom to give permissions. The references are represented by one or more of the following letters:

Reference                    Class               Description

U                                 Owner             File’s owner

G                                 group               users who are members of the file’s group

O                                 others              users who are neither the file’s owner nor members of the file’s group

A                                 all                    All three of the above, same as ugo

The operator is used to specify how the modes of a file should be adjusted. The following operators are accepted.

Operator                                  Description

+                                  Adds the specified modes to the specified classes

--                            Removes the specified modes from the specified classes

=                                  The modes specified are to be made the exact modes for the specified classes

 

Finding out Who’s on the system with who:- The purpose of the who command is to find out who’s logged in to the system. The who command lists the login names, terminal lines, and login times of users currently logged in. The who command is useful in many situations. For example, If you want to communicate with someone on the computer by using the write command, you can find out whether that person is on the system by using who. You can also use who to see when certain users are logged in to the computer to keep track of their time spent on the system. To see everyone who’s currently logged in to the system, you can enter who. Then you see a display similar to the following:

  • $ who
  • root                       console                 Dec 13                  08:00
  • ernie                     tty02                                    Dec 13                  10:37
  • bkraft                   tty03                                    Dec 13                  11:02
  • jdurum                 tty05                                    Dec 13                  09:21
  • ernie                     tty07                                    Dec 11                  18:49
  • $
  • This listing shows that root, ernie, bkraft, and jdurum are now logged in.
  •                Several option are available with who.
  •                -u           Lists only users who are currently logged in
  •                -H           Displays headers above each column
  • the headers displayed with the –H option are NAME, LINE, TIME, IDLE, PID and COMMENTS. Table explains the terms appearing in the heading.

Field

Description

NAME

Lists the user’s login name

LINE

Lists the line or terminal being used

TIME

Lists the time the user logged in

IDLE

Lists the hours and minutes since the last activity on that line. A period is displayed if activity occurred within the last minute of system time. If more than 24 hours has elapsed sine the line was used, the word old is displayed.

PID

Lists the process ID number of the user’s login shell

COMMENTS

Lists the contents of the comment field if comments have been included in /etc/inittab or if there are network connections.

 

The whois System-The whois system is a listing of records that contains details about both the ownership of domains and the owners. The Internet Corporation for Assigned Names and Numbers (ICANN) regulates domain name registration and ownership, but the list of records is held by many companies, known as registries.

Anyone can query the list of records. When you do, one of the registries will handle your request and send you details from the appropriate whois record.

Before we go any further, it’s important that you’re familiar with the following terms:

Registry: A company that manages a list containing a set of domain names (there are many of these).

Registrant: The legal owner of the domain; it’s registered to this person.

Registrar: A registrant uses a registrar to make his or her registration.

A whois record contains all the contact information associated with the person, company, or other entity that registered the domain name. Some registrations contain more information than others, and some registries return differing amounts of information.

A typical whois record will contain the following information:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

No comments:

Post a Comment