finalfile (1)f

32
DIFFERENCE BETWEEN LINUX & UNIX Linux is a graphical user interface OS which provides two basic types of GUI’s Gnome and KDE while UNIX was established initially by using command code. UNIX was also converted to the GUI by looking at the consumer market. The famous X Windows was created for UNIX by AT&T. Linux is considered very efficient in terms of threat detection. This because of two facts Linux is a community OS and whenever any user encounters any specific virus he reports to the community and OS developers start to help him/her. Secondly it is an open source OS and allows for code changes. On the other hand UNIX is an operating system any user has to wait for the anti virus patches from the manufacturers. Thus we can say that in terms of security Linux can be rated more than UNIX. The cost structure of UNIX is also different for different models. On the contrary Linux can be distributed and downloaded freely. Though Linux is considered more secure but it has so far been reported to capture only 60 viruses while UNIX has reported more than 80 viruses. Even if we consider this fact Linux is regarded more responsive towards bugs and viruses. A widely used Open Source Unix-like operating system kernel. Linux was first released by its inventor Linus Torvalds in 1991. UNIX is the foundation for a number of operating systems, with Linux being the most popular one. UNIX is an operating system created in the early days of computers. More recently, Linux was created as an open- source, freeware operating system. (Note: Linux is free software, not freeware.

description

dfavavvadfavaabdfaaefeda

Transcript of finalfile (1)f

DIFFERENCE BETWEEN LINUX & UNIX

Linux is a graphical user interface OS which provides two basic types of GUIs Gnome and KDE while UNIX was established initially by using command code. UNIX was also converted to the GUI by looking at the consumer market. The famous X Windows was created for UNIX by AT&T. Linux is considered very efficient in terms of threat detection. This because of two facts Linux is a community OS and whenever any user encounters any specific virus he reports to the community and OS developers start to help him/her. Secondly it is an open source OS and allows for code changes. On the other hand UNIX is an operating system any user has to wait for the anti virus patches from the manufacturers. Thus we can say that in terms of security Linux can be rated more than UNIX. The cost structure of UNIX is also different for different models. On the contrary Linux can be distributed and downloaded freely. Though Linux is considered more secure but it has so far been reported to capture only 60 viruses while UNIX has reported more than 80 viruses. Even if we consider this fact Linux is regarded more responsive towards bugs and viruses. A widely used Open Source Unix-like operating system kernel. Linux was first released by its inventor Linus Torvalds in 1991. UNIX is the foundation for a number of operating systems, with Linux being the most popular one. UNIX is an operating system created in the early days of computers. More recently, Linux was created as an open-source, freeware operating system. (Note: Linux is free software, not freeware. UNIX is a closed-source, proprietary operating system which you need to purchase a license for, Linux is open-source and available to anyone for free. UNIX is used by Apple Mac and Banks as it is virtually impossible to get viruses or hackers. Linux is also one of the original platforms and still widely used, and also virus free.

CALENDARTo get the calendar in the screen just type cal and the year which you want to see in the terminal:

TO DISPLAY SYSTEM DATETo display the system date, just type date in the terminal.

KNOWING YOUR TERMINAL AND MACHINE NAMEBy typing who am I, the terminal/machine name will display with the present date and time.

CHANGING PASSWARD

If we want to change the password under Linux then you need to use password command to change password under Linux. For example to change your own password type command: Passwd root

To change password of other user, you need to use password command as follows:

passwd username You must be a root or equivalent user to change other user password. Here is the sample snapshot of changing the password of a user.

FILE DIRECTORY COMMAND

CREATING DIRECTORY

We can create a directory by using the mkdir command. For example, to create a directory named vikas:mkdir vikas

CREATING A FILE

Create a file with touch command Type the command

Touch file name

The touch command is the easiest way to create new, empty files. Now Type the command

Cat > name of file

When you have finished typing in your text, enter Ctrl+d (Press and hold down the Ctrl key and type a "d").

This stops the cat command and returns you to the system prompt.

LISTING A FILE

We can use the Ls command to list the files in any directory to which you have access. For a simple directory listing, at the Linux prompt, enter: Ls This command will list the names of all the files and directories in the current working directory. As the directory does not have any files, the screenshot below is indicating only the main directory.

DELETING A FILE

The rm command deletes files in a directory. The rm command will usually not produce an output unless you have made an error.

DELETING DIRECTORY

We need to use rmdir command to remove a directory. It will remove the directory entry specified by each dirname operand, which must refer to an empty directory. For example, to remove a directory called "cppcode", enter: rmdir cppcode

MOVING DIRECTORY

If we wish to "move" all of the files from directory into another directory, use the mv command exactly as we do for files. Again, mv works just like the copy command. Yet since subdirectories are always moved, there is no recursive -r option.

For example, here we rename of the /development/prog/backup directory to development/prog/backup:

COPYING A FILE The Linux command to "copy" files is cp. The cp command takes the names of two files as arguments:

cp filefrom fileto

INTRODUCTION TO VI EDITOR

The vi editor is the classic screen editing program for Linux systems and is based on a older line editor called ex. It can be used from any type of terminal because it doesnt depend on arrow and function keys. It uses standard alphabetic keys for command as well as arrow keys. There are number of enhanced version of vi exists. Some of them are nvi, vim, vile and elvis. In Linux, the vi command is a link to one of these programs. Most likely it will be vim. Most of the Linux distributions have vi and emacs text editor already installed In Linux, configuration files are written in plain English. Hence, text editors are required to make changes to these files. The editing capabilities can be invoked within vi by pressing the colon (:), entering ex command and then pressing the Return key. ex commands are still important part of vi and is sometimes called hex in Linux. Learning vi or emacs is must for every Linux or Unix user. There are some GUI based text editors available. But, there are some situations when you cant access GUI desktop. In that case, vi or emacs can only save you. The version which people use normally now a days is Vi iMproved (VIM). Vi was enhanced by Bram Moolenaar and are called vim editor. The vi editor has three modes, command mode, insert mode and command line mode. Command mode: by default, the vi editor opens in command mode. You can use commands to move cursor, delete. cut, copy, paste and save changes. Commands are case sensitive. The ESC key is used to end a command. Insert mode: Insert mode is what we work in most of the time and text is inserted into the file in this mode only. You can enter the insert mode by pressing I key. The newer vi versions will show INSERT word on the bottom line. You can also enter a (insert after), A (insert at end of line), o (open new line after current line) or O (Open line above current line) commands apart from I command. The ESC key ends insert mode and returns you to command mode. Command line mode: You can enter this mode by typing : which displays the command line entry at the bottom of the screen.

In broad sense, there are only two modes, one for editing text (i.e. Insert mode) and the other (i.e. command mode) for giving commands. To switch between the two modes you use the I and Esc keys.COMMANDS IN VI EDITOR

ADDING TEXT The following commands allow us to insert and add text. Each of these commands puts the vi editor into insert mode; thus, the key must be pressed to terminate the entry of text and to put the vi editor back into command mode.

REPLACING TEXT By pressing capital R, the text in which the cursor is placed can be replaced.

DELETING TEXT The following commands allow you to delete text.

Screenshot before deleting the inserted text:

Screenshot after deleting the inserted text by using x command.

Screenshot after deleting the inserted text by using dd command.

INTRODUCTION TO SHELL PROGRAM

The most generic sense of the term shell means any program that users employ to type commands. A shell hides the details of the underlying operating system and manages the technical details of the operating system kernel interface, which is the lowest-level, or 'inner-most' component of most operating systems. In Unix-like operating systems users typically have many choices of command-line interpreters for interactive sessions. When a user logs in to the system, a shell program is automatically executed. The login shell may be customized for each user, typically in the passwd file, and can be customized via passwd -e, or on some systems via the chsh program. In addition, a user is typically allowed to execute another shell program interactively.

The UNIX shell was unusual when it was introduced. It is both an interactive command language as well as a scripting programming language, and is used by the operating system as the facility to control (shell script) the execution of the system. Shells created for other operating systems than UNIX, often provide similar functionality.

On systems with a windowing system, some users may never use the shell directly. On UNIX systems, the shell is still the implementation language of system startup scripts, including the program that starts the windowing system, the programs that facilitate access to the Internet, and many other essential functions.A UNIX shell is a command-line interpreter or shell that provides a traditional user interface for the UNIX operating system and for Unix-like systems. Users direct the operation of the computer by entering commands as text for a command line interpreter to execute or by creating text scripts of one or more such commands.

The most influential UNIX shells have been the Bourne shell and the C shell. The Bourne shell, sh, was written by Stephen Bourne at AT&T as the original UNIX command line interpreter; it introduced the basic features common to all the UNIX shells, including piping, here documents, command substitution, variables, control structures for condition-testing and looping and filename wildcarding. The language, including the use of a reversed keyword to mark the end of a block, was influenced by ALGOL.The C shell, csh, was written by Bill Joy while a graduate student at University of California, Berkeley. The language, including the control structures and the expression grammar, was modeled on C. The C shell also introduced a large number of features for interactive work, including the history and editing mechanisms, aliases, directory stacks, tilde notation, cdpath, job control and path hashing.

Both shells have been used as coding base and model for many derivative and work-alike shells with extended feature sets.

SHELL PROGRAMS

Some of the shell programs are discussed below with the input and output screenshots:

PROGRAM FOR PERFORMING ARITHMETIC OPERATIONS

INPUT WINDOW

OUTPUT WINDOW

SHELL PROGRAM TO FIND FACTORIAL OF A GIVEN NUMBERINPUT WINDOW

OUTPUT WINDOW

SHELL PROGRAM TO FIND FIBONACCI SERIES OF A NUMBERINPUT WINDOW

OUTPUT WINDOW