Introduction to Linux PDF
Document Details
Tags
Summary
This document provides an introduction to the Linux operating system. It discusses the history and fundamental architecture of Linux, highlighting key components like the kernel and system libraries. It also alludes to common Linux applications and concepts.
Full Transcript
“Linux at the Command Line” What is Linux? It‟s an Operating System The Most Common O/S Used by the researchers When Working on a Server or Computer Cluster Linux is a Unix clone written from scratch by Linus Torvalds with assistance from a loosely- kn...
“Linux at the Command Line” What is Linux? It‟s an Operating System The Most Common O/S Used by the researchers When Working on a Server or Computer Cluster Linux is a Unix clone written from scratch by Linus Torvalds with assistance from a loosely- knit team of hackers across the Net. Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs. Linux and Unix strive to be POSIX (Portable Operating System Interface) compliant. 64% of the world‟s servers run some variant of Unix or Linux. The Android phone and the Kindle run Linux. The *Nix Philosophy of Doug McIlroy (i) Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new features. (ii) Expect the output of every program to become the input to another, as yet unknown, program. Don't clutter output with extraneous information. Avoid stringently columnar or binary input formats. Don't insist on interactive input. (iii) Use tools in preference to unskilled help to lighten a programming task, even if you have to detour to build the tools and expect to throw some of them out after you've finished using them. a set of small Linux is an O/S core programs written by written by Linus Richard Stallman and Torvalds and others others. They are the AND GNU utilities. http://www.gnu.org/ An operating system can be described as an interface among the computer hardware and the user of any computer. It is a group of software that handles the resources of the computer hardware and facilitates basic services for computer programs. An operating system is an essential component of system software within a computer system. The primary aim of an operating system is to provide a platform where a user can run any program conveniently or efficiently. On the other hand, Linux OS is one of the famous versions of the UNIX OS. It is developed to provide a low- cost or free OS for several personal computer system users. Remarkably, it is a complete OS Including an X Window System, Emacs editor, IP/TCP, GUI (graphical user interface), etc. Linux was proposed by the Finland student Linus Torvalds in 1991. HP-UX (Hewlett Packard) 8.0 version was published. Hewlett Packard 9.0 version was published in 1992. FreeBSD 1.0 version and NetBSD8 version was released in 1993. Red Hat Linux was proposed in 1994. Caldera was detected by Ransom love and Bryan Sparks and NetBSD 1.0 version published. HP-UX 10.0 version and FreeBSD 2.0 version was released in 1995. K Desktop Environment was established by Matthias Ettrich in 1996. HP-UX 11.0 version was released in 1997. The IRIX 6.5 version, i.e., the fifth SGI UNIX generation, Free BSD 3.0 version, and Sun Solaris 7 OS was released in 1998. The Caldera System agreement with professional services division and SCO server software division was released in 2000. Linus Torvalds published the Linux version 2.4 source code in 2001. Microsoft filed the Trademark collection against Lindows.com in 2001. Lindows name was modified to Linspire in 2004. The first publication of Ubuntu was published in 2004. The openSUSE project started a free distribution from the community of Novell In 2005. Oracle published its Red Hat distribution in 2006. Dell begun laptop distribution with Ubuntu which was pre-installed on it in 2007. Linux kernel version 3.0 was released in 2011. Linux-based android of Google insisted 75% of the market share of the Smartphone, based on the number of phones exported in 2013. Ubuntu insisted on 20000000+ users in 2014. The Linux operating system's architecture mainly contains some of the components: the Kernel, System Library, Hardware layer, System, and Shell utility. 1. Kernel:- The kernel is one of the core section of an operating system. It is responsible for each of the major actions of the Linux OS. This operating system contains distinct types of modules and cooperates with underlying hardware directly. The kernel facilitates required abstraction for hiding details of low-level hardware or application programs to the system. 2. System Libraries:- These libraries can be specified as some special functions. These are applied for implementing the operating system's functionality and don't need code access rights of the modules of kernel. 3. System Utility Programs:- It is responsible for doing specialized level and individual activities. 4. Hardware layer:- Linux operating system contains a hardware layer that consists of several peripheral devices like CPU, HDD, and RAM. 5. Shell:- It is an interface among the kernel and user. It can afford the services of kernel. It can take commands through the user and runs the functions of the kernel. The shell is available in distinct types of OSes. These operating systems are categorized into two different types, which are the graphical shells and command-line shells. Network: ssh, scp, ping, telnet, nslookup, wget Shells: BASH, TCSH, alias, watch, clear, history, chsh, echo, set, setenv, xargs System Information: w, whoami, man, info, which, free, echo, date, cal, df, free, man, info Command Information: man, info Symbols: |, >, >>, &, 2>&1, ;, ~,.,.., $!, !:, ! Filters: grep, egrep, more, less, head, tail Hotkeys: , File System: ls, mkdir, cd, pwd, mv, ln, touch, cat, file, find, diff, cmp, /net//, mount, du, df, chmod, find Line Editors: awk, sed File Editors: vim, gvim, emacs –nw, emacs Process Management: ps, top, kill, killall, fg, bg SGE Cluster: qsh, qstat, qsub, qhost Hardware drivers: Most of the users of Linux face an issue while using Linux. Various companies of hardware prefer to build drivers for Mac or Windows due to they contain several users than Linux. Linux has small drivers for peripheral hardware than windows. Software alternative: Let's take the Photoshop example which is a famous tool for graphic editing. Photoshop exists for Windows; however, it is not available in Linux. Also, there are some other tools for photo editing but the Photoshop tool is more powerful as compare to others. Another example is MS office which is not present for Linux users. Learning curve: Linux isn't a very user-friendly operating system. Hence, it might be confusing for many beginners. Getting begun with Windows is efficient and easy for many beginners; however, understanding Linux working is complex. We have to understand the command line interface and finding for newer software is a little bit complex as well. When we face any issue in the OS, the searching solution is very problematic. Also, there are various experts for Mac and Windows as compare to Linux. Games: Several games are developed for Windows but unfortunately not for Linux. Because the platform of Windows is used widely. So, the developers of the games are more interested in windows. Portable: Linux OS can perform different types of hardware and the kernel of Linux supports the installation of any type of hardware environment. Open source: Linux operating system source code is available freely and for enhancing the capability of the Linux OS, several teams are performing in collaboration. Multiprogramming: Linux OS can be defined as a multiprogramming system. It means more than one application can be executed at the same time. Multi-user: Linux OS can also be defined as a multi-user system. It means more than one user can use the resources of the system such as application programs, memory, or RAM at the same time. Hierarchical file system: Linux OS affords a typical file structure where user files or system files are arranged. Security: Linux OS facilitates user security systems with the help of various features of authentication such as controlled access to specific files, password protection, or data encryption. Shell: Linux operating system facilitates a unique interpreter program. This type of program can be applied for executing commands of the operating system. It can be applied to perform various types of tasks such as call application programs and others. It is an OS that is composed of a software-based collection on Linux kernel or we can say the distribution includes the Linux Kernel. It is supporting software and libraries. We can obtain Linux-based OS by downloading any Linux distribution. These types of distributions exists for distinct types of devices such as personal computers, embedded devices, etc. Around more than 600 Linux distributions are existed and a few of the famous Linux distributions are listed as follows: Deepin OpenSUSE Fedora Solus Debian Ubuntu Elementary Linux Mint Manjaro MX Linux Linux is a billion-dollar corporation nowadays. Thousands of governments and companies are using Linux operating system across the world because of lower money, time, licensing fee, and affordability. Linux can be used within several types of electronic devices. These electronic devices are easily available for users worldwide. A few of the famous Linux-based electronic devices are listed below: Yamaha Motive Keyboard Volvo In-Car Navigation System TiVo Digital Video Recorder Sony Reader Sony Bravia Television One Laptop Per child XO2 Motorola MotoRokr EM35 phone Lenovo IdeaPad S9 HP Mini 1000 Google Android Dev Phone 1 Garmin Nuvi 860, 880, and 5000 Dell Inspiron Mini 9 and 12 The Ideal Lab Facility The Linux File System A Typical Linux File System Useful options for the “ls” command: ◦ ls -a List all file including hidden file beginning with a period “.” ◦ ls -ld * List details about a directory and not its contents ◦ ls -F Put an indicator character at the end of each name ◦ ls –l Simple long listing ◦ ls –lh Give human readable file sizes ◦ ls –lS Sort files by file size ◦ ls –lt Sort files by modification time All files and directories have a individual and a group ownership. All files and directories have read (r), write (w), and execute (x) permissions assigned as octets to the individual owner (u), the group (g) owner and all others (o) that are logged into the system. You can change permissions if you are the individual owner or a member of the group. Only root can change ownership. root The root user is the master Try ◦ cd ◦ touch myfile (create file) ◦ mkdir mydir (create directory) ◦ ls –l myfile (examine file) ◦ ls –ld mydir (examine directory) ◦ chmod g+w myfile (add group write permission) ◦ ls –l myfile ◦ chmod ugo+x myfile (add user, group and other execute permission) ◦ ls –l myfile ◦ chmod ugo+w mydir (add user, group and other write permission) ◦ ls –ld mydir ◦ chmod a-w (a=ALL, remove user, group and other write permission) File and Directory Ownership and Permissions Examining and changing file and directory permissions Syntax: BEGIN { Actions} {ACTION} # Action for every line in a file END { Actions } Try ◦ ls –l /usr ◦ ls –l /usr | awk „{print $9 “\t” $5}‟ ◦ ls –l /usr > usr.txt ◦ awk „print $9 “\t” $5}‟ usr.txt (gives same results as 2nd command line, but awk is acting on a file instead of saved output) ◦ ls –lh /lib | awk „{printf “%20s\t%s\n”,$9,$5}‟ ◦ ls –l /lib | awk „BEGIN {sum=0} {printf “%20s\t%s\n”,$9,$5; sum+=$5} END{sum/=1000000; printf “\nTotal: %d GB\n”,sum}‟ Editing Output Lines With awk Output from awk commands sed replaces one substring with another sed operates on every line in a file or processes every line piped into it sed matches patterns using regular expressions (See regular-expressions.pdf cheat sheet) Common regular expression metacharacters: ◦. – any character ◦ ? – quantified zero or one ◦ * - quantifier none or more ◦ + - quantifier one or more ◦ ^ - beginning of line ◦ $ - end of line ◦ [XxYy] – character class matching upper or lower case “X” or “”Y”