Tux Wars Class - 1
Table of Contents 1) Introduction to Linux and its history 2) Booting process of a linux system 3) Linux Kernel 4) What is a shell 5) Bash Shell 6) Anatomy of command 7) Let s make our own command 8) WildCards in Bash 9) Man 10) General directory structure in UNIX 11) Mounting a device 12) > IO Redirection >> 13) Permissions, Users & groups 14) Super User 2
1. Introduction Let s start with the first set of slides 3
4
History Of linux 1991. Just a hobby, won t be big and professional like GNU - Linus Torvalds 1992. Linux became open source 1996. Tux becomes the logo of linux 1997. GNOME project is born 2000. Steve jobs made an offer to Linus Torvalds to work on OS X. 2004. Ubuntu is released 2005. Linus torvalds created git 2008. Android v1.0 released And today All 500 of the world's fastest supercomputers are running Linux. 5
Flavors of Linux Let s see which linux flavor to use. 6
7
8
https://distrowatch.com/dwres.php?resource=popularity 9
2. Linux Kernel
11
3. Shells
What is a Shell? The shell is the command interpreter in an operating system such as Unix or GNU/Linux. It is a program that executes other programs. It provides user an interface to the Unix/GNU-Linux system so that the user can run different commands. 13
Types of Linux Shells The Bourne Shell ( $ ) Bourne Shell ( sh ) Korn Shell ( ksh ) Bourne Again Shell ( bash ) POSIX Shell ( sh ) The C Shell ( % ) C shell ( csh ) TENEX/TOPS C shell ( tsch ) 14
4. Bash
Interacting with Bash 1. Bash Built-ins cd echo alias exit 2. Bash Commands (executables/binaries) ls mkdir cp chmod And lot more.. https://courses.cs.washington.edu/courses/cse390a/14au/bash.html 16
5. Anatomy of a Command
utility [args]... Also called options, switches or flags 18
6. Let s make our own command
7. WildCards
WildCards in Bash What are wildcards? - A wildcard is a character that can be used as a substitute for any of a class of characters in a search, thereby greatly increasing the flexibility and efficiency of searches. Example please?? - ls *.txt 21
Okay, what other wildcards are available? Standard Wildcards ( globbing patterns )? (question mark) { } (curly brackets) touch file{1.. 10} cp { *.txt,*.pdf } ~ [ ] (square brackets) ls file[1-3] * (asterisk) rm file* 22
8. Sir, य सब त ठ क.. य द क स ह ग????
Take the chill pill!! Linux got your back : man help Info apropos (similar to man -f) 24
7. Everything is a file(descriptor)
Everything is a File "Everything is a file" - a wide range of input/output resources such as Documents Directories Hard-drives Modems Keyboards, printers and even some inter-process and network communications are simple streams of bytes exposed through the filesystem name space. 26
Different types of files in linux 1. Regular Readable Binary So on.. 2. Directories 3. Special Files Block Character Symbolic Link files Named Pipe socket 27
Why file Descriptor? - When a file is opened, a file descriptor is created. - File descriptors are also created for things like pipes and network sockets via different methods. 28
FileSystem Hierarchy Standard (FHS) 29
30
To read about FHS 3.0 refer : https://refspecs.linuxfoundation.org/fhs_3.0/fhs-3.0.pdf https://www.tecmint.com/linux-directory-structure-and-importan t-files-paths-explained/ 31
10. Mounting
Mounting a device All accessible storage/devices must have an associated location in the directory tree defined by FHS. This is unlike Windows where (in the most common syntax for file paths) there is one directory tree per storage component (drive). Mounting is the act of associating a storage device to a particular location in the directory tree. For example, when the system boots, a particular storage device. 33
Device name mount /dev/cdrom /media/movies Mount point (location where the device will be mounted) 34
11. IO Redirection, Pipes
Redirecting output to a file./a.out > output.txt : redirects output of a.out to output.txt./a.out >> output.txt : appends output of a.out to output.txt 36
PIPES ls /etc/ sort less : lists /etc directory sorts it and passes it to less pager. 37
12. User And Groups
Users in Linux A user or account of a system is uniquely identified by a numerical number called the UID (unique identification number). There are two types of users: Normal user - limited access to files Root / Superuser - can access all the files. 39
Groups in Linux Linux group is a mechanism to organise a collection of users. Like the user ID, each group is also associated with a unique ID called the GID (group ID). There are two types of groups: Primary group Supplementary group Each user is a member of exactly one primary group and zero or more supplementary groups. 40
chmod permission in octal 41
13. SUDO
43
44
SUDO Root is the super user and has the ability to do anything on a system. Therefore, in order to have protection against potential damage sudo is used in place of root. Sudo allows users and groups access to commands they normally would not be able to use. Sudo will allow a user to have administrative privileges without logging in as root. 45
Before using sudo, it may need to be installed if it is not part of your distro 46
SU vs. SU - SU : will land in the current directory SU - : will land in the root s home directory (/root) 47
thanks! Any questions? *The content in the slides was designed by Dipunj Gupta 48