MAIT4us
INTRODUCTION TO LINUX
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of Linux is the Linux kernel, an operating system kernel first released on 5 October 1991, by Linus Torvalds. Since the C compiler that builds Linux and the main supporting user space system tools and libraries originated in the GNU Project, initiated in 1983 by Richard Stallman, the Free Software Foundation prefers the name GNU/Linux when these tools and libraries are used.
The development of Linux is one of the most prominent examples of free and open source software collaboration: the underlying source code may be used, modified, and distributed—commercially or non-commercially—by anyone under licenses such as the GNU General Public License. Typically Linux is packaged in a format known as a Linux distribution for desktop and server use. Some popular mainstream Linux distributions include Debian (and its derivatives such as Ubuntu and Linux Mint), Fedora (and its derivatives such as the commercial Red Hat Enterprise Linux and its open equivalent CentOS), Mandriva/Mageia, open SUSE (and its commercial derivative SUSE Linux Enterprise Server), and Arch Linux. Linux distributions include the Linux kernel, supporting utilities and libraries and usually a large amount of application software to fulfill the distribution's intended use.
A distribution oriented toward desktop use will typically include the X Window System and an accompanying desktop environment such as GNOME or KDE Plasma. Applications commonly used with desktop Linux systems include the Mozilla Firefox web browser, the LibreOffice office application suite, and the GIMP image editor.
Some components of an installed Linux system are:
✓ A bootloader : for example GRUB or LILO. This is a program which is executed by the computer when it is first turned on, and loads the Linux kernel into memory.
✓ An init program :This is a process launched by the Linux kernel, and is at the root of the process tree: in other terms, all processes are launched through init. It starts processes such as system services and login prompts (whether graphical or in terminal mode)
✓ Software libraries which contain code which can be used by running processes. On Linux systems using ELF-format executable files, the dynamic linker which manages use of dynamic libraries is "ld-linux.so". The most commonly used software library on Linux systems is the GNU C Library. If the system is set up for the user to compile software themselves, header files will also be included to describe the interface of installed libraries.
✓ User interface programs such as command shells or windowing environments
ANTECEDENTS
UNIX
The Unix operating system was conceived and implemented in 1969 at AT&T's Bell Laboratories in the United States by Ken Thompson, Dennis Ritchie, Douglas McIlroy, and Joe Ossanna. It was first released in 1971 and was initially entirely written in assembly language, a common practice at the time. Later, in a key pioneering approach in 1973, Unix was re-written in the programming language C by Dennis Ritchie (with exceptions to the kernel and I/O). The availability of an operating system written in a high-level language allowed easier portability to different computer platforms. With a legal glitch forcing AT&T to license the operating system's source code to anyone who asked, Unix quickly grew and became widely adopted by academic institutions and businesses. In 1984, AT&T divested itself of Bell Labs. Free of the legal glitch requiring free licensing, Bell Labs began selling Unix as a proprietary product.
GNU
The GNU Project, started in 1983 by Richard Stallman, had the goal of creating a "complete Unix-compatible software system" composed entirely of free software. Later, in 1985, Stallman started the Free Software Foundation and wrote the GNU General Public License (GNU GPL) in 1989. By the early 1990s, many of the programs required in an operating system (such as libraries, compilers, text editors, a Unix shell, and a windowing system) were completed, although low-level elements such as device drivers, daemons, and the kernel were stalled and incomplete.
BSD
Although not released until 1992 due to legal complications, development of 386BSD, from which NetBSD, OpenBSD and FreeBSD descended, predated that of Linux.
MINIX
MINIX is an inexpensive minimal Unix-like operating system, designed for education in computer science, written by Andrew S. Tanenbaum. Starting with version 3 in 2005, MINIX became free and was redesigned for "serious" use.
Genesis
In 1991 while attending the University of Helsinki, Torvalds became curious about operating systems and frustrated by the licensing of MINIX, which limited it to educational use only. He began to work on his own operating system which eventually became the Linux kernel.
Torvalds began the development of the Linux kernel on MINIX, and applications written for MINIX were also used on Linux. Later Linux matured and further Linux development took place on Linux systems. GNU applications also replaced all MINIX components, because it was advantageous to use the freely available code from the GNU Project with the fledgling operating system. (Code licensed under the GNU GPL can be reused in other projects as long as they also are released under the same or a compatible license.) Torvalds initiated a switch from his original license, which prohibited commercial redistribution, to the GNU GPL. Developers worked to integrate GNU components with Linux to make a fully functional and free operating system.
DIFFERENCE BETWEEN LINUX, UNIX AND WINDOWS:
|OS |LINUX |UNIX |WINDOWS |
|What is it? : |Linux is an example of Open Source |Unix is an operating system that is very|Windows is the family of operating |
| |software development and Free Operating |popular in universities, companies, big |system (OS) from Microsoft, which is the|
| |System (OS). |enterprises etc. |most famous OS in the world. |
|Cost: |Linux can be freely distributed, |Different flavors of Unix have different|For desktop or home use, Windows can be |
| |downloaded freely, distributed through |cost structures according to vendors |expensive. A single copy can cost around|
| |magazines, Books etc. There are priced | |$50 to $ 450 depending on the version of|
| |versions for Linux also, but they are | |Windows. |
| |normally cheaper than Windows. | | |
|User: |Everyone. From home users to developers |Unix operating systems were developed |Everyone. From home users to developers |
| |and computer enthusiasts alike. |mainly for mainframes, servers and |and computer enthusiasts alike. |
| | |workstations except OSX, Which is | |
| | |designed for everyone. The Unix | |
| | |environment and the client-server | |
| | |program model were essential elements in| |
| | |the development of the Internet | |
|Manufacturer: |Linux kernel is developed by the |Three biggest distributions are Solaris |Microsoft created the Windows operating |
| |community. Linus Torvalds oversees |(Oracle), AIX (IBM) & HP-UX Hewlett |system, but allows other computer |
| |things. |Packard. And Apple Makes OSX, an unix |manufactures to distribute their |
| | |based os. |own computers with Windows |
| | | |pre-installed. |
|Usage: |Linux can be installed on a wide variety|The UNIX operating system is used in |On PC's servers and some phones. |
| |of computer hardware, ranging from |internet servers, workstations & PCs. | |
| |mobile phones, tablet computers and |Backbone of the majority of | |
| |video game consoles, to mainframes and |finance, infastructure and many | |
| |supercomputers. |24x365 high availability solutions. | |
|Processors: |Dozens of different kinds. |x86/x64, Sparc, Power, Itanium, PA-RISC,|Intel and AMD, but WinCE runs on some |
| | |PowerPC and many others. |additional processors. (see: WinCE) |
|Development and |Linux is developed by Open Source |Unix systems are divided into various |Windows is developed and distributed by |
|Distribution: |development i.e. through sharing and |other flavors, mostly developed by AT&T |Microsoft. |
| |collaboration of code and features |as well as various commercial vendors | |
| |through forums etc and it is distributed|and non-profit organizations. | |
| |by various vendors. | | |
|Architectures: |Originally developed for Intel's x86 |Available on PA-RISC and Itanium |x86,x64 and ARM (Windows RT) |
| |hardware, ports available for over two |machines | |
| |dozen CPU types including ARM | | |
|GUI: |Linux typically provides two GUIs, KDE |Initially Unix was a command based OS, |The Windows GUI is an integral component|
| |and Gnome. But Linux GUI is optional. |but later a GUI was created called |of the OS and it is mainly influenced by|
| | |Common Desktop Environment. Most |Apple Macintosh OS and Xerox. |
| | |distributions now ship with Gnome. | |
|File system support:|Ext2, Ext3, Ext4, Jfs, ReiserFS, Xfs, |jfs, gpfs, hfs, hfs+, ufs, xfs, zfs |FAT, FAT32, NTFS, exFAT |
| |Btrfs, FAT, FAT32, NTFS |format | |
|Text mode interface:|BASH (Bourne Again SHell) is the Linux |Originally the Bourne Shell. Now it's |Windows uses a command shell and each |
| |default shell. It can support multiple |compatible with many others including |version of Windows has a single command |
| |command interpreters. |BASH, Korn & C. |interpreter with dos-like commands, |
| | | |recently there is the addition of the |
| | | |optional PowerShell that uses more |
| | | |Unix-like commands. |
|Security: |Linux has had about 60-100 viruses |A rough estimate of UNIX viruses is |According to Dr. Nic Peeling and Dr |
| |listed till date. None of them actively |between 85 -120 viruses reported till |Julian Satchell's “Analysis of the |
| |spreading nowadays. |date. |Impact of Open Source Software” |
| | | |there have been more than 60,000 viruses|
| | | |in Windows |
|Threat detection and|In case of Linux, threat detection and |Because of the proprietary nature of the|After detecting a major threat in |
|solution: |solution is very fast, as Linux is |original Unix, users have to wait for a |Windows OS, Microsoft generally releases|
| |mainly community driven. |while, to get the proper bug fixing |a patch that can fix the problem and it |
| | |patch. But these are not as common. |can take more than 2/3 months.. |
|Inception: |Inspired by MINIX (a Unix-like system) |In 1969, it was developed by a group of |Windows first released in 1985 as MS DOS|
| |and eventually after adding many |AT&T employees at Bell Labs and Dennis | |
| |features of GUI, Drivers etc, Linus |Ritchie. It was written in “C” language | |
| |Torvalds developed the framework of the |and was designed to be a portable, | |
| |OS that became LINUX in 1992. |multi-tasking and multi-user system in a| |
| | |time-sharing configuration. | |
|Examples: |Ubuntu, Fedora, Red Hat, Debian, |OS X, Solaris, All Linux |WINDOWS 7, WINDOWS 8 |
| |Archlinux, Android etc. | | |
WELL-KNOWN LINUX DISTRIBUTIONS:
• Arch Linux, a minimalist rolling release distribution targeted at experienced Linux users, and primarily based on binary packages in the tar.gz and tar.xz format.
• Debian, a non-commercial distribution maintained by a volunteer developer community
o Canaima, is an open socio-technological project, built and developed in Venezuela, based on Debian.
o Knoppix, the first Live CD distribution to run completely from removable media without installation to a hard disk, derived from Debian
o Linux Mint Debian Edition (LMDE) is based directly on Debian's testing distribution.
o Ubuntu, a popular desktop and server distribution derived from Debian, maintained by British company Canonical Ltd.
▪ BackTrack, based on the Ubuntu operating system. Used for digital forensics and penetration testing.
▪ Trisquel, A fully free software system without proprietary software or firmware and uses Linux-libre kernel.
▪ Kubuntu, the KDE version of Ubuntu.
▪ Linux Mint, a distribution based on and compatible with Ubuntu. Supports multiple desktop environments, among others GNOME Shell fork Cinnamon and GNOME 2 forkMATE.
• Fedora, a community distribution sponsored by American company Red Hat
o Red Hat Enterprise Linux, which is a derivative of Fedora, maintained and commercially supported by Red Hat.
▪ CentOS, a distribution derived from the same sources used by Red Hat, maintained by a dedicated volunteer community of developers with both 100% Red Hat-compatible versions and an upgraded version that is not always 100% upstream compatible
▪ Oracle Enterprise Linux, which is a derivative of Red Hat Enterprise Linux, maintained and commercially supported by Oracle.
o Mandriva, a Red Hat derivative popular in several European countries and Brazil, today maintained by the French company of the same name.
▪ Mageia, a fork of Mandriva Linux created in 2010 that recently had a quick rise in popularity.
▪ PCLinuxOS, a derivative of Mandriva, grew from a group of packages into a community-spawned desktop distribution.
• Gentoo, a distribution targeted at power users, known for its FreeBSD Ports-like automated system for compiling applications from source code
Android
Whether or not Google's Android counts as a Linux distribution is a widely debated topic, with the Linux Foundation and Chris DiBona, Google's open source chief, in favour. Others, such as Google engineer Patrick Brady disagree, noting the lack of support for many GNU tools, including glibc, in Android.
SOME COMMANDS OF LINUX:
1) ls COMMAND: lists the files and directories under current working directory.
SYNTAX:
ls [OPTIONS]... [FILE]
OPTIONS:
|-l |Lists all the files, directories and their mode, Number of links, owner of the file, file size, Modified date and time and |
| |filename. |
|-t |Lists in order of last modification time. |
|-a |Lists all entries including hidden files. |
|-d |Lists directory files instead of contents. |
|-p |Puts slash at the end of each directories. |
|-u |List in order of last access time. |
|-i |Display inode information. |
|-ltr |List files order by date. |
|-lSr |List files order by file size. |
2) mkdir COMMAND: is used to create one or more directories.
SYNTAX:
mkdir [options] directories
OPTIONS:
|-m |Set the access mode for the new directories. |
|-p |Create intervening parent directories if they don't exist. |
|-v |Print help message for each directory created. |
3) find COMMAND: finds one or more files assuming that you know their approximate filenames.
SYNTAX:
find path [options]
OPTIONS:
|-name |It search for the given file, in the current directory or any other subdirectory. |
|-atime n |True if the file was accessed n days ago. The access time of directories in path is changed by find itself. |
|-ctime n |True if the file's status was changed n days ago. |
|-group gname |True if the file belongs to the group gname. If gname is numeric and does not appear in the /etc/group file, it is|
| |taken as a group ID. |
|-mtime n |True if the file's data was modified n days ago. |
|-size n[c] |True if the file is n blocks long (512 bytes per block). If n is followed by a c, the size is in bytes. |
4) mv COMMAND: is short for move. It is used to move/rename file from one directory to another. mv command is different from cp command as it completely removes the file from the source and moves to the directory specified, where cp command just copies the content from one file to another.
SYNTAX:
mv [-f] [-i] oldname newname
OPTIONS:
|-f |This will not prompt before overwriting (equivalent to --reply=yes). mv -f will move the file(s) without prompting even if it|
| |is writing over an existing target. |
|-i |Prompts before overwriting another file. |
• To Rename / Move a file:
mv file1.txt file2.txt
This command renames file1.txt as file2.txt
• To move a directory
mv hscripts tmp
In the above line mv command moves all the files, directories and sub-directories from hscripts folder/directory to tmp directory if the tmp directory already exists. If there is no tmp directory it rename's the hscripts directory as tmp directory.
• To Move multiple files/More files into another directory
mv file1.txt tmp/file2.txt newdir
This command moves the files file1.txt from the current directory and file2.txt from the tmp folder/directory to newdir.
5) rm COMMAND: is used to remove/delete the file from the directory.
SYNTAX:
rm [options..] [file | directory]
OPTIONS:
|-f |Remove all files in a directory without prompting the user. |
|-i |Interactive. With this option, rm prompts for confirmation before removing any files. |
|-r (or) -R |Recursively remove directories and subdirectories in the argument list. The directory will be emptied of files and |
| |removed. The user is normally prompted for removal of any write-protected files which the directory contains. |
6) cd COMMAND: used to change the directory.
SYNTAX:
cd [directory | ~ | ./ | ../ | - ]
• cd ..
This will change to the parent-directory from the current working directory/sub-directory.
• cd ~
This command will move to the user's home directory which is "/home/username"
7) cp COMMAND: copy files from one location to another. If the destination is an existing file, then the file is overwritten; if the destination is an existing directory, the file is copied into the directory (the directory is not overwritten).
SYNTAX:
cp [OPTIONS]... SOURCE DEST
cp [OPTIONS]... SOURCE... DIRECTORY
cp [OPTIONS]... --target-directory=DIRECTORY SOURCE...
OPTIONS:
|-a |same as -dpR. |
|--backup[=CONTROL] |make a backup of each existing destination file |
|-b |like --backup but does not accept an argument. |
|-f |if an existing destination file cannot be opened, remove it and try again. |
|-p |same as --preserve=mode,ownership,timestamps. |
|--preserve[=ATTR_LIST] |preserve the specified attributes (default: mode,ownership,timestamps) and security contexts, if |
| |possible additional attributes: links, all. |
|--no-preserve=ATTR_LIST |don't preserve the specified attribute. |
|--parents |append source path to DIRECTORY. |
• Copy two files:
cp file1 file2
The above cp command copies the content of file1.php to file2.php.
• To backup the copied file:
cp -b file1.php file2.php
Backup of file1.php will be created with '~' symbol as file2.php~.
• Copy folder and subfolders:
cp -R scripts scripts1
The above cp command copy the folder and subfolders from scripts to scripts1.
8) pwd COMMAND: pwd - Print Working Directory. pwd command prints the full filename of the current working directory.
SYNTAX:
pwd [options]
9) cat COMMAND: concatenates files and print it on the standard output.
SYNTAX:
cat [OPTIONS] [FILE]...
OPTIONS:
|-A |Show all. |
|-b |Omits line numbers for blank space in the output. |
|-e |A $ character will be printed at the end of each line prior to a new line. |
|-E |Displays a $ (dollar sign) at the end of each line. |
|-n |Line numbers for all the output lines. |
|-s |If the output has multiple empty lines it replaces it with one empty line. |
|-T |Displays the tab characters in the output. |
|-v |Non-printing characters (with the exception of tabs, new-lines and form-feeds) are printed visibly. |
• To Create a new file:
cat > file1.txt
This command creates a new file file1.txt. After typing into the file press control+d (^d) simultaneously to end the file.
• To Append data into the file:
cat >> file1.txt
To append data into the same file use append operator >> to write into the file, else the file will be overwritten (i.e., all of its contents will be erased).
• To display a file:
cat file1.txt
This command displays the data in the file.
• To concatenate several files and display:
cat file1.txt file2.txt
The above cat command will concatenate the two files (file1.txt and file2.txt) and it will display the output in the screen. Some times the output may not fit the monitor screen. In such situation you can print those files in a new file or display the file using less command.
cat file1.txt file2.txt | less
• To concatenate several files and to transfer the output to another file.
cat file1.txt file2.txt > file3.txt
In the above example the output is redirected to new file file3.txt. The cat command will create new file file3.txt and store the concatenated output into file3.txt.
10) date COMMAND: prints the date and time.
SYNTAX:
date [options] [+format] [date]
OPTIONS:
|-a |Slowly adjust the time by sss.fff seconds (fff represents fractions of a second). This adjustment can be positive or |
| |negative.Only system admin/ super user can adjust the time. |
|-s date-strin|Sets the time and date to the value specfied in the datestring. The datestr may contain the month names, timezones, 'am', |
|g |'pm', etc. |
|-u |Display (or set) the date in Greenwich Mean Time (GMT-universal time). |
Format:
|%a |Abbreviated weekday(Tue). |
|%A |Full weekday(Tuesday). |
|%b |Abbreviated month name(Jan). |
|%B |Full month name(January). |
|%c |Country-specific date and time format.. |
|%D |Date in the format %m/%d/%y. |
|%j |Julian day of year (001-366). |
|%n |Insert a new line. |
|%p |String to indicate a.m. or p.m. |
|%T |Time in the format %H:%M:%S. |
|%t |Tab space. |
|%V |Week number in year (01-52); start week on Monday. |
11) cal COMMAND: used to display the calendar.
SYNTAX:
cal [options] [month] [year]
OPTIONS:
-1 Displays single month as output.
-3 Displays prev/current/next month output.
-s Displays sunday as the first day of the week.
-m Displays Monday as the first day of the week.
-j Displays Julian dates (days one-based, numbered from January 1).
-y Displays a calendar for the current year.
12) wc COMMAND: print the number of bytes, words, and lines in files
SYNTAX:
wc [OPTION]... [FILE]...
OPTIONS:
-c, --bytes print the byte counts
-m, --chars print the character counts
-l, --lines print the newline counts
-L, --max-line-length print the length of the longest line
-w, --words print the word counts
13) vi COMMAND:
The default editor that comes with the UNIX operating system is called vi (visual editor). [Alternate editors for UNIX environments include pico and emacs, a product of GNU.]
The UNIX vi editor is a full screen editor and has two modes of operation:
• Command mode commands which cause action to be taken on the file, and
• Insert mode in which entered text is inserted into the file.
In the command mode, every character typed is a command that does something to the text file being edited; a character typed in the command mode may even cause the vi editor to enter the insert mode. In the insert mode, every character typed is added to the text in the file; pressing the (Escape) key turns off the Insert mode.
|vi filename |edit filename starting at line 1 |
|vi -r filename |recover filename that was being edited when system crashed |
| | |
|:x |quit vi, writing out modified file to file named in original invocation |
|:wq |quit vi, writing out modified file to file named in original invocation |
|:q |quit (or exit) vi |
|:q! |quit vi even though latest changes have not been saved for this vi call |
| | | |
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.