$24
Objective :
Lab 1 is intended to provide an introduction to Linux. The objective of this lab is to make students familiar with the Linux command-line environment and develop the skills of shell scripting. This lab serves as a platform for the subsequent labs related to system calls, process management, file management, and memory management.
Tutorial
Tutorial 1: Log in to the system(credentials in the board), open the Terminal and type the following on the login prompt :
echo hello world
The wordhello worldwould get displayed as an output on the terminal. The echocommand displays a line of text, type man echoto read what an echo command does.
Linux provides on-line manuals for different commands through an interface called man.
To know about man type the following on the terminal: man manand read the description that is displayed.
For all commands, we will use the syntax
man <command name
Type echo $SHELL
This prints /bin/bash
bash is the name of the login shell that is currently in use
Study the following Unix/Linux general-purpose utility commands using their man pages and execute them on the terminal :
man, who, cat, cd, cp, ps, ls, mv, rm, mkdir, rmdir, echo, date, time, kill, chmod, chown, pwd, cal
Tutorial 2: Study the following Linux commands: sed, grep and awk
Use the grep command to find how many lines of a word in the given word. The filename and the word are provided as inputs.
Tutorial 3: Shell scripting
Write a shell script to display “HELLO WORLD” on the terminal :
Open an editor
Type echo HELLO WORLD
save the file with .sh extension ( say test.sh)
close the editor
At the terminal, type sh test.sh
Expected output at the prompt: HELLO WORLD
References:
http://profile.iiita.ac.in/bibhas.ghoshal/lab_files/abs-guide.pdf http://profile.iiita.ac.in/bibhas.ghoshal/lab_files/Tutorial_shell_scripting