Linux Shell Scripting Tutorial

Linux Shell Scripting Tutorial

This tutorial Linux is designed for beginners only and This tutorial explains the basics of shell programming by showing some examples of shell programs. Its not help or manual for the shell. While reading this tutorial you can find manual quite useful ( type man bash at $ prompt to see manual pages). Manual contains all necessary information you need, but it won’t have that much examples, which makes idea more clear. For that reason, this tutorial contains examples rather than all the features of shell. I assumes you have at least working knowledge of Linux i.e. basic commands like how to create, copy, remove files/directories etc or how to use editor like vi or mcedit and login to your system. Before Starting Linux Shell Script Programming you must know Kernel is hart of Linux O/S. It manages resource of Linux O/S. Resources means facilities available in Linux. For eg. Facility to store data, print data on printer, memory, file management etc . Kernel decides who will use this resource, for how long and when. It runs your programs (or set up to execute binary files) It’s Memory resident portion of Linux. It performance following task :-Computer understand the language of 0’s and 1’s called binary language, In early days of computing, instruction are provided using binary language, which is difficult for all of us, to read and write. So in O/s there is special program called Shell. Shell accepts your instruction or commands in English and translate it into computers native binary language.It’s environment provided for user interaction. Shell is an command language interpreter that executes commands read from the standard input device (keyboard) or from a file. Linux may use one of the following most popular shells (In MS-DOS, Shell name is COMMAND.COM which is also used for same purpose, but it’s not as powerful as our Linux Shells are!) Any of the above shell reads command from user (via Keyboard or Mouse) and tells Linux O/s what users want. If we are giving commands from keyboard it is called command line interface ( Usually in-front of $ prompt, This prompt is depend upon your shell and Environment that you set or by your System Administrator,therefore you may get different prompt ).NOTE: To find your shell type following command$ echo $SHELL.

NOTE that following commands are for New users or for Beginners only. The purpose is if you use this command you will be more familiar with your shell and secondly, you need some of these command in your Shell script. If you want to get more information or help for this command try following commands For e.g. To see help or options related with date command try$ date –helpor To see help or options related with ls command (Here you will screen by screen help, since help of ls command is quite big that can’t fit on single screen ) NOTE: This command set permission for file called  ‘myscript’ as User (Person who creates that file or directory) has execute    permission (u+x) Group of file owner can write to this file as well as execute  this file (g+wx) Others canonly execute file but can not modify it, Since we have not given w (write permission) to them. (o+x).Process is any kind of program or task carried out by your PC. For e.g. $ ls -lR , is command or a request to list files in a directory and all subdirectory in your current directory. It is a process. A process is program (command given by user) to perform some Job. In Linux when you start process, it gives a number (called PID or process-id), PID starts from 0 to 65535. Linux is multi-user, multitasking o/s. It means you can run more than two process simultaneously if you wish. For e.g.. To find how many files do you have on your system you may give command like$ ls / -R | wc -lThis command will take lot of time to search all files on your system. So you can run such command in Background or simultaneously by giving command like$ ls / -R | wc -l &The ampersand (&) at the end of command tells shells start command (ls / -R | wc -l) and run it in background takes next command immediately. An instance of running command is called process and the number printed by shell is called process-id (PID), this PID can be use to refer specific running process.

Cours gratuitTélécharger le cours complet

Télécharger aussi :

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *