×
If you belive yourself, anything is possible.
--Your friends at LectureNotes
Close

Note for LINUX PROGRAMMING - LP By Prakash Poudel

  • LINUX PROGRAMMING - LP
  • Note
  • 816 Views
  • 13 Offline Downloads
  • Uploaded 9 months ago
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1

LINUX QUICK REFERENCE NOTE Introduction The purpose of this document is to provide the reader with a fast and simple introduction to using the Linux command shell and some of its basic utilities. It is assumed that the reader has zero or very limited exposure to the Linux command prompt. This document is designed to accompany an instructor-led tutorial on this subject, and therefore some details have been left out. Explanations, practical examples, and references to DOS commands are made, where appropriate. What is Linux? Linux (often pronounced LIH-nuhks with a short "i") is a Unix-like operating system that was designed to provide personal computer users a free or very low-cost operating system comparable to traditional and usually more expensive UNIX systems. Linux has a reputation as a very efficient and fast-performing system. Linux's kernel (the central part of the operating system) was developed by Linus Torvalds at the University of Helsinki in Finland. To complete the operating system, Torvalds and other team members made use of system components developed by members of the Free Software Foundation for the GNU Project. Linux is the best-known and most-used open source operating system. As an operating system, Linux is software that sits underneath all of the other software on a computer, receiving requests from those programs and relaying these requests to the computer’s hardware. The birth of Linux On August 25, 1991, a Finn computer science student named Linus Torvalds made the following announcement to the Usenet group comp.os.minix: “Hello everybody out there using minix I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready.” Torvalds built the core of the Linux operating system, known as the kernel. A kernel alone does not make an operating system, but Stallman's GNU tools were from a project to create an operating system as well--a project that was missing a kernel to make Stallman's operating system complete. Torvalds' matching of GNU tools with the Linux kernel marked the beginning of the Linux operating system as it is known today. Where is Linux? One of the most noted properties of Linux is where it can be used. Linux, which began its existence as a server OS and has become useful as a desktop OS, can also be used on all of these devices. “From wristwatches to supercomputers,” is the popular description of Linux' capabilities. The Applications and distributions of Linux Linux application developers have a larger set of choices to develop their application. This allows more flexibility to build an application, but it does mean a developer will need to decide which Linux components to use. Torvalds still manages the development of the Linux kernel, but commercial and private developers contribute other software to make the whole Linux operating system. Distributions are maintained by private individuals and commercial entities. There are, at last count, over 350 distinct distributions of Linux. Linux communities come in two basic forms: developer and user communities. © Er. Prakash Poudel Jigyasu “Prepare Linux Today for Tomorrow” Page 1

Text from page-2

LINUX QUICK REFERENCE NOTE Developer communities can volunteer to maintain and support whole distributions, such as the Debian or Gentoo Projects. Novell and Red hat also support community-driven versions of their products, openSUSE and Fedora, respectively. Other developer communities focus on different applications and environments that run on Linux, such as Firefox, OpenOffice.org, GNOME, and KDE. History of Linux Late 1960's - Unix is developed and released in 1970's which was created by the Ken Thompson and Dennis Ritchie. It is widely adopted in business and academic circles. In 1983 - a programmer Richard Stallman creates the GNU Project. It is an attempt at creating a Unix type operating system but composed of entirely free software. In 1987 - Another programmer Andrew S. Tanenbaum creates Minix, a Unix like operating system for Academic use. In 1991 - a Finnish student Linus Torvalds creates a non-commercial version of Minix and calls it Linux. The Linu is from Linus and the x is from the 'ix' part of Minix. On 25 August, 1991, Linus posted his famous message on the MINIX Newsgroup about the development of Linux. No announcement was ever made for Linux Version 0.01. On October 5, 1991, Linus announced the first “official” version of Linux, version 0.02. The primary focus was kernel development; none of the issues of user support, documentation, distribution, and so on had even been addressed. Today, the situation is quite different—the real excitement in the Linux world deals with graphical user environments, easy-to-install distribution packages, and high-level applications such as graphics utilities and productivity suites. Why use Linux? 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. It’s free. It's a lot more secure and a lot less prone to viruses and hackers than Microsoft Windows. You can do 99% of what you can do on Windows on Linux. Linux has the support of a worldwide community of developers who contribute to the source code, security fixes and system enhancements. Every Linux distribution offers regular updates of its packages and sources several times per year and security fixes as needed. Linux systems rarely crash, and when they do, the whole system normally does not go down. Linux typically does not slow down over time. Linux can breathe new life into old computers. Linux comes in all sizes and flavors, which offers a wide variety from which to choose the distro which will best suit our needs. All Linux software is available on the Internet, so we never lose it. What is Open Source? The term "open source" refers to something that can be modified and shared because its design is publicly accessible. Open source code is typically created as a collaborative effort in which programmers improve upon the code and share the changes within the community. Open Source is a certification mark owned by the Open Source Initiative (OSI). What is Open Source Software? Open source software is software whose source code is available for modification or enhancement by anyone. © Er. Prakash Poudel Jigyasu “Prepare Linux Today for Tomorrow” Page 2

Text from page-3

LINUX QUICK REFERENCE NOTE Open Source Software vs. Other software Some software has source code that cannot be modified by anyone but the person, team, or organization; that created it and maintains exclusive control over it. This kind of software is frequently called "proprietary software" or "closed source" software, because its source code is the property of its original authors, who are the only ones legally allowed to copy or modify it. Microsoft Word and Adobe Photoshop are examples of proprietary software. Open source software is different. Its authors make its source code available to others who would like to view that code, copy it, learn from it, alter it, or share it. LibreOffice and the GNU Image Manipulation Program are examples of open source software. Culture of free Software “Free software” means software that respects users' freedom and community. Roughly, it means that the users have the freedom to run, copy, distribute, study, change and improve the software. Thus, “free software” is a matter of liberty, not price. To understand the concept, you should think of “free” as in “free speech,” not as in “free beer”. A program is free software if the program's users have the four essential freedoms:  The freedom to run the program as your wish, for any purpose (freedom 0).  The freedom to study how the program works and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.  The freedom to redistribute copies so you can help your neighbor (freedom 2).  The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. What is a command shell? A shell is an environment in which we can run our commands, programs, and shell scripts. There are different flavors of shells, just as there are different flavors of operating systems. Each flavor of shell has its own set of recognized commands and functions.  A program that interprets commands  Allows a user to execute commands by typing them manually at a terminal, or automatically in programs called shell scripts.  A shell is not an operating system. It is a way to interface with the operating system and run commands. Shell Prompt The prompt, $, which is called command prompt, is issued by the shell. While the prompt is displayed, you can type a command. The shell reads your input after you press Enter. It determines the command you want executed by looking at the first word of your input. Shell Types There are many “shells” in both Linux and Unix. Two kinds of these numerous shells are: 1. The Bourne shell. If you are using a Bourne-type shell, the default prompt is the $ character. 2. The C shell (csh)  C shell is the UNIX shell created by Bill Joy at the University of California as an alternative to UNIX's original shell, the Bourne shell .  If you are using a C-type shell, the default prompt is the % character. The C shell program name is csh.  The C shell was invented for programmers who prefer a syntax similar to that of the C programming language. © Er. Prakash Poudel Jigyasu “Prepare Linux Today for Tomorrow” Page 3

Text from page-4

LINUX QUICK REFERENCE NOTE  The other popular member of the C shell family is called tcsh (for Tab C shell) and is an extended version of C shell. Some of tcsh's added features are: enhanced history substitution , spelling correction, and word completion There are again various subcategories for Bourne Shell which are listed as follows:  Bourne shell ( sh)  Korn shell ( ksh)  The Korn shell is the UNIX shell (command execution program, often called a command interpreter ) that was developed by David Korn of Bell Labs as a comprehensive combined version of other major UNIX shells.  Incorporating all the features of C shell ( csh ) and Tab C-shell ( tcsh ) with the script language features similar to that of the Bourne shell , the Korn shell is considered the most efficient shell.  The Korn shell is considered a member of the Bourne shell family and uses as its shell prompt (character displayed to indicate readiness for user input) the $ symbol.  Because it is the easiest shell to use, inexperienced users usually prefer the Korn shell  Korn shell is developed many years before the emergence of the BASH shell. Because it is older than BASH, it has less resources, and it also attracts limited computer users.  Bourne Again shell ( bash)  POSIX shell ( sh) What is BASH?       BASH = Bourne Again SHell Bash is a shell written as a free replacement to the standard Bourne Shell (/bin/sh) Originally written by Steve Bourne for UNIX systems. It has all of the features of the original Bourne Shell, plus additions that make it easier to program with and use from the command line. Since it is Free Software, it has been adopted as the default shell on most Linux systems. Bash is a newer shell compared to the KSH shell. Bash also acts as an extension of the Korn shell. How is BASH different from the DOS command prompt? Case Sensitivity: In Linux/UNIX, commands and filenames are case sensitive, meaning that typing “EXIT” instead of the proper “exit” is a mistake. “\”vs.“/”: In DOS, the forward-slash “/” is the command argument delimiter, While the backslash “\” is a directory separator. In Linux/UNIX, the “/” is the directory separator, and the “\” is an escape character. Filenames: The DOS world uses the “eight dot three” filename convention, meaning that all files followed a format that allowed up to 8 characters in the filename, followed by a period (“dot”), followed by an option extension, up to 3 characters long (e.g. FILENAME.TXT). In UNIX/Linux, there is no such thing as a file extension. Periods can be placed at any part of the filename, and “extensions” may be interpreted differently by all programs, or not at all. © Er. Prakash Poudel Jigyasu “Prepare Linux Today for Tomorrow” Page 4

Lecture Notes