Sie sind auf Seite 1von 18

What is O.S.

An operating system OS is a software that acts as an interface between the user and the computer hardware Function of OS 1. User Interface 2. Memory Management 3. Process Management 4. Device Management Program: - A set of instructions. Process:- An instruction under execution. The tasks of an operating system include management of hardware, memory, processes and applications. An operating system consists of a software kernel and a number of tools, and can be considered a platform for applications. To manage the hardware, the operating system uses interrupts and device drivers. A monolithic kernel like Linux can dynamically load these in memory as modules. A computers memory comes in different speeds and prices, the faster, the more expensive. Ordered from fastest to slowest >registers inside the CPU > cache on the CPU > RAM modules > hard disks. An operating system may start paging, using a part of the hard disk as memory storage. A process is compiled source code that is currently running on the computer. Only one process at a time can run on a CPU or processor. The operating system will provide multitasking features by giving every process a small amount of time (about 50ms max) to run on the CPU, before interrupting it, and giving control to the next process. For us humans, applications seem to run at the same time. When more than one CPU is present in the system, the operating system can support multiprocessing. This really enables applications to run simultaneously.

History of Linux REDHAT CERTIFICATION


1. RHCT RED HAT CERTIFIED TECHNICIAN (RH-033 AND RH-131 OR 133) 2. RHCE RED HAT CERTIFIED ENNGINEER (RH-033, RH-133 AND RH253) 3. RHCSS RED HAT CERTIFIED SECURITY SPECIALIST (RHCE, RHS333, RH423,RHS429) 4. RHCDS 5. RHCA 6. RHCVA Difference between Linux and Windows: Linux is a open source operating system. People can change codes and add programs to Linux OS which help use your computer better. Linux user can edit its OS and design new OS. 2. Lots of flavors in Linux. 3. Linux is customizable but Windows is not. 4. Linux is freely available for desktop or home use but Windows is expensive. For server use, Linux is cheap compared to Windows. 5. Linux has high security. You have to log on to Linux with a userid and password. You can login as root or as normal user. The root has full privilege. 6. Linux has a reputation for fewer bugs than Windows. 7. Windows must boot from a primary partition. Linux can boot from either a primary partition or a logical partition inside an extended partition. Windows must boot from the first hard disk. Linux can boot from any hard disk in the computer
1.

Windows uses a hidden file for its swap file. Typically this file resides in the same partition as the OS (advanced users can opt to put the file in another partition). Linux uses a dedicated partition for its swap file. 9. Windows file names are not case sensitive. Linux file names are. For example "abc" and "aBC" are different files in Linux, whereas in Windows it would refer to the same file. 10. Windows and Linux have different concepts for their file hierarchy. Windows uses a volume-based file hierarchy while Linux uses a unified scheme. Windows uses letters of the alphabet to represent different devices and different hard disk partitions. eg: c: , d: , e: etc.. while in linux " / " is the main directory. 11. In Linux each user will have a home directory and all his files will be save under it while in windows the user saves his files anywhere in the drive. This makes difficult to have backup for his contents. In Linux its easy to have backups.
8.

Basic File System Hierarchy Standard Directories


/ (slash) the root directory, the top-level directory in the FHS. All other directories are subdirectories of root, which is always mounted on some partition. /bin/ Essential command line utilities. Should not be mounted Separately; otherwise, it could be difficult to get to these utilities When using a rescue disk. /boot/ Includes Linux startup files, including the Linux kernel. The default, 100MB, is usually sufficient for a typical modular kernel and additional kernels installation /dev/ Hardware and software device drivers for everything from floppy drives to terminals. Do not mount this directory on a separate partition.

/etc/ Most basic configuration files. /home/ Home directories for almost every user. /lib/ Program libraries for the kernel and various command line utilities. Do not mount this directory on a separate partition. /media/ The mount point for removable media, including floppy drives, DVDs, and Zip disks. /misc/ The standard mount point for local directories mounted via the automounter. /mnt/ A legacy mount point; formerly used for removable media. /net/ The standard mount point for network directories mounted via the automounter.(exsame as a map drive in windows) /opt/ Common location for third-party application files. /proc/ Currently running kernel-related processes, including device assignments such as IRQ ports, I/O addresses, and DMA channels, as well as kernel configuration settings such as IP forwarding. /root/ The home directory of the root user. /sbin System administration commands. Don't mount this directory separately. /selinux Currently configured settings associated with Security Enhanced Linux.

/smb The standard mount point for remote shared Microsoft network directories mounted via the automounter. /srv Commonly used by various network servers on non-Red Hat distributions. /tftpboot Included if the TFTP server is installed. /tmp Temporary files. By default, Red Hat Enterprise Linux deletes all files in this directory periodically. /usr Small programs accessible to all users. Includes many system administration commands and utilities. /var Variable data, including log files and printer spools.

Hard Disk Partitioning on Red Hat Linux If you are using PATA (IDE) hard disk your partition name like this hda primary master hard disk hdb primary slave hard disk hdc secondary master hard disk hdd secondary slave hard disk If you are using SATA or SCSI hard disk ..Your partition name like this sda primary master hard disk sdb primary slave hard disk sdc secondary master hard disk sdd secondary slave hard disk

You can create partition in your hard disk as below: # 1+1 (1 primary + 1 extended partition) # 3+1 (3 primary + 1 extended partition) # 4+0 (4 primary + 0 extended partition) What is Kernel? The kernel is the essential center of a computer operating system, the core that provides basic services for all other parts of the operating system. What is shell? Shell is the outermost part of an operating system that interacts with user commands. Types of Shell? 1. Bash shell:Developed for the GNU project, the standard and default shell for red hat linux. 2. Borne shell:Original shell for UNIX developed by Bill Joy at UC Berkeley. 3. C shell:Command, history and job control 4. Korn shell:Written by David Korn feature like Csh command completion and history 5. The Enhance C Shell:Command-line editing and more sophisticated completion

RUN LEVELS
init init init init init init 0 1 2 3 4 5 shutdown the system and halt single user mode multi user without networking multi user with networking but no graphics reserve or unused multi user with networking and graphics

init 6 reboot the system CONSOLES Text-mode login at virtual console Multiple non-GUI logins are possible Default consoles are in text mode Available through CTRL-ALT-F[1-6] Graphical login Graphical console comes through CTRL-ALT-F7 or startx Two desktop environments 1. GNOME (GNU Network Object Modules Environment) Default desktop environment for Red Hat Linux Easy to use and have panel and set of GUI tools You can download free source code from www.gnome.org 2. KDE (K Desktop Environment) KDE provides an alternative desktop environment with full set of integrated network and internet applications. Along with GNOME features, It also includes Konsole : Highly configurable graphical terminal. Konqueror : A file manager and web browser. Kmail : A graphical email client. Kdevelop : Integrated development.

BASIC COMMANDS :
pwd present working directory display he absolute path of current directory ls List the Files and Directories within the current directory. ls ls ls ls -l -a -i -h list file with permission list hidden files list files and inode numbers list file size n human readable format

ls -R

list all directory store in that container

mkdir To create a directory e.g. mkdir iiht (create a directory name iiht) mkdir -p india/Gujarat/surat mkdir -p india/{Gujarat/{surat,baroda},Maharashtra/ {Mumbai,pune}} rmdir To remove a directory cd Change directory cd .. cd cd / cat This command use to view and create files cat > iiht.txt this command will create text file name iiht.txt cat iiht.txt this command will show content of file iiht.txt cat >> iiht.txt this command will append content to iiht.txt cat file1.txt > file2.txt this command will copy content of file1 into file2 cat file1.txt file2.txt this command will only show content together of both file cat file1.txt file2.txt > file3.txt this command will copy content from both file and paste it into file3.txt tac

one level up directory (parent directory) to previous working directory to / (slash) directory

Opposite from cat command

Touch To change time stamp of file, if file is not exist it will be create man e.g. man ls

--help info

e.g. e.g.

ls --help

man options

cp

1 2 3 4 5 6 7 8

user commands system calls library calls special files file formats games miscellaneous administrative commands

Copy file and directory -v verbos -a archive -r recursive -I interactive e.g. cp -vra /etc /tmp rm To remove files and directories -r recursive -f forcefully e.g. rm -rf /india su Switch user e.g. whoami e.g who am i useradd This command use for creating a user When you create a one new user four files will modified /etc/passwd (user database) /etc/shadow (password and password age) /etc/group (group password)

/etc/gshadow (secondary group information) Template user file will be copy from /etc/login.defs Template user directory will be copy from /etc/skel Structure of /etc/passwd file 1. User login name 2. Password store location (default x) 3. Numeric user id (root=0 ,user>500) 4. Group id 5. Description of user(optional) 6. User home directory 7. Login shell for user (default /bin/bash) e.g. useradd test1 -d specify home directory of user -s shell -p password -g primary group assign to user -G secondary group assign to user -m create home directory to user -M do not create home directory usermod user modify option will user same as useradd userdel to delete a user e.g. userdel -r test1 This syntax will delete user test1 with his home directory Default permission for file and directory: File default permission: 666 Directory default permission: 777 Base on UMASK Root 0022 No root user 0002

Permission precedence: If UID matches, user permission will apply Otherwise, if GID matches, group permission will apply If neither match,other permission will apply Permission types: r: permission to read the file or list a directorys content w: permission to write to a file or create and remove files from a directory x: permission to execute a program or change into a directory and do a long listing of the directory -: no permission (in place of r,w or x) To view a permission use ls -l Changing file ownership chown -R student dir1 (where -R for recursive and to entire directory) (student new owner of the directory) (dir1 A directory) Changing a permission: (symbolic method) chmod -R (mode) (file name) (where mode is .) (u, g or o for user,group or other) (+ or for grant or deny) (r, w or x for read, write and execute) e.g. chmod -R ugo+r dir1 chmod u+w,go-w file1

changing permission: (numeric method) 4 for read 2 for write 1 for execute

e.g. chmod 664 file

CH-06 USING THE BASH SHELL


Scripts types Perl,python,vb,java,shell Only linux use perl, python and shell every script start with shebang value #! Location of command #! /usr/bin/perl Variales: - It never be a number - Always start with alphabets - No space between variablename and variable value - System variables start always in caps - e.g. PWD,UID,USER,HOSTNAME,HISTSIZE,PATH,SHELL - you can see all other variables using set and env command echo: print the value of variable * show all value ls *.* ls *.txt ? matches only single character ls ?b (in this listing only result show which first character can be anything but only two character names) [ ] either this or that. ls [a,b]? (first either a or b and two character name second will be anything.) {} ls file{1,2} = file1,file2 $ use to fetch value from variable

cat > script1.sh echo My pc name is `hostname` where hostname is command ..

cat > script2.sh echo my pc name is $HOSTNAME run script from original location using sh script1.sh take two variables for maths expressation. Example>1 a=20 b=10 c=expr $a + $b echo your answer for total sum is $c d=expr $a \* $b echo your answer for multiplication Example>2 Echo enter your name Read n1 Echo your name is $n1 Example>3 to print 1 to 10 numbers using loop For ((i=1;i<=10;i++) Do Echo $i done Example>4 For ((i=1;i<=5;i++) Do Useradd a$i Passwd -d a$i Done Example>5 For ((i=1;i<=5;i++) Do Useradd a$i Echo Admin123 | passwd a$i stdin done

Example>6 Enter the number of user you want to create Read n1 For ((i=1;i<=$n1;i++)) Do Echo enter the name of the user $i Read name Useradd $name Passwd $name done

CH-07 STANDARD I/O AND PIPES


Standard input (stdin) keyboard Standard output (stdout) terminal windows Standard error (stderr) terminal windows Find Find Find Find > 2> &> < /etc /etc /etc /etc redirect stdout to file redirect stderr to file redirect all output to file send input to command -name -name -name -name passwd passwd > find.out passwd 2> /dev/null passwd > find.out 2> find.err

tee store various stage into file cat /etc/passwd | tee stage1 | sort | tee stage2 uniq -c | tee stage3 | sort -r | tee stage4 | less cat /etc/passwd | cut -d: -f7 | sort | uniq in this command first cat command will give input to next command then cut command will -d: (delimiter) -f7 (number 7) only show column number 7 then this output will give as a next

commands input which sort ascending, now output will give to input as a next command .. uniq command will take only uniq word of that result head this command will show content of any files first 10 line as output you can use -n (n=1,2,3,) e.g. head /etc/passwd head -3 /etc/passwd tail this command will show content of any files last 10 lines as output you can use e.g. tail /etc/passwd tail -3 /etc/passwd

sort this command will show sorting of line by default it will be in ascending mode you can use -r to view reverse means descending e.g. cat /etc/passwd | sort cat /etc/passwd | sort -r -g use for general numbers lower to higher -m use for month sort list Uniq report and omitted repeated line e.g. cat /etc/passwd | cut -d: -f7 | sort | uinq

wc print the number of newline, words and bytes in file e.g. cat /etc/passwd |wc cat /etc/passwd |wc -l (print numbers of lines) cat /etc/passwd |wc -w (print numbers of words)

cat /etc/passwd |wc -c characters/bytes) diff

(print numbers of

find difference between two files patch use to patching the difference between two file. -b create a backup copy of file -R restore a copy of backup taken during patch aspell check spelling of any file look Example : look exer and enter Sed Stream editor Performs search/replace operations Use i.bak to back-up and alter source file e.g. sed s/iiht/IIHT/g iiht s =search find iiht and replace with IIHT g=globally in iiht named file but its temporary if you want to save that changes you have to use I with g option e.g. sed s/iiht/IIHT/ig iiht e.g. sed 10,17s/iiht/IIHT/g iiht this command will use to search your query between 10 to 17 lines -e option indicate that a search and replace pattern is forthcoming and can be used several times -f option will use for large numbers of edits,or to save edits for the future,place them in a file Some useful characters for copmlex searches: ^ line begins with e.g. grep ^root /etc/passwd

$ line end with e.g grep /bin/bash$ /etc/passwd [a,b,c] a character that is a,b or c [^a,b,c] a character that is not a,b or c CH-09 VIM AN ADVANCED TEXT EDITOR Three modes 1. Command mode (default) move cursor, cut/paste and change mode 2. Insert mode: modify text 3. Ex mode: save, quit, etc Esc exit current mode EscEsc always returns to command mode Common write/quit commands :w writes (save) the file to disk :wq writes and quits :q! quits,even if changes are lost right arrow moves right one character 5,right arrow moves right file character Move by character: arrow keys,h,j,k,l move by word: w=forward,b=backward move by sentence: ),( move by paragraph: },{ jump to line X: XG jump to end: G

Das könnte Ihnen auch gefallen