Introduction To Command Line in Ubuntu Linux.: Lab No. 3 29/3/2023

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

LAB NO.

3 29/3/2023

Introduction to Command Line in Ubuntu Linux.


Lab outcomes:
After completing this lab, students will be able to.

• Differentiate Between Different Shells available in Linux.


• Writing basic commands in CLI.

Corresponding CLO and PLO:


• CLO-2, PLO-5 (Modern Tool Usage)

Theory:
The Command Line Interface (CLI) is a non-graphical, text-based interface to the computer
system, where the user types in a command and the computer then successfully executes it. The
Terminal is the platform or the IDE that provides the command line interface (CLI) environment
to the user. The CLI terminal accepts the commands that the user types and passes to a shell. The
shell then receives and interprets what the user has typed into the instructions that can be
executed by the OS (Operating System). If the output is produced by the specific command, then
this text is displayed in the terminal. If any of the problems with the commands are found, then
some error message is displayed.
We can open the terminal by typing Ctrl + Alt + T short-key or by right-clicking the mouse and
selecting the Open New Terminal option. The terminal window looks like given below.
SHELL is a program which provides the interface between the user and an operating system.
When the user logs in OS starts a shell for user. Kernel controls all essential computer
operations, and provides the restriction to hardware access, coordinates all executing utilities,
and manages Resources between process. Using kernel only user can access utilities provided by
operating system.
Types of Shell:
The C Shell – Denoted as csh
Bill Joy created it at the University of California at Berkeley. It incorporated features such as
aliases and command history. It includes helpful programming features like built-in arithmetic
and C-like expression syntax.

The Bourne Shell – Denoted as sh


It was written by Steve Bourne at AT&T Bell Labs. It is the original UNIX shell. It is faster and
more preferred. It lacks features for interactive use like the ability to recall previous commands.
It also lacks built-in arithmetic and logical expression handling. It is default shell for Solaris OS.
The Korn Shell - Denoted as ksh
It Was written by David Korn at AT&T Bell Labs It is a superset of the Bourne shell. So, it
supports everything in the Bourne shell. It has interactive features. It includes features like
builtin arithmetic and C-like arrays, functions, and string-manipulation facilities. It is faster than
C shell. It is compatible with script written for C shell.
Bourne-Again Shell – Denoted as bash
It is compatible to the Bourne shell. It includes features from Korn and Bourne shell.
Basic syntax of Linux Commands
A command is an instruction given by a user telling a computer to do something, such a run a
single program or a group of linked programs. Commands are generally issued by typing them in
at the command line (i.e., the all-text display mode) and then pressing the ENTER key, which
passes them to the shell.
A shell is a program that reads commands that are typed on a keyboard and then executes (i.e.,
runs) them. Shells are the most basic method for a user to interact with the system. Options and
Arguments This brings us to a very important point about how most commands work.
Commands are often followed by one or more that modify their behavior, and further, options by
one or more arguments, the items upon which the command acts. So most commands look kind
of like this:
command-name -options arguments

Most commands use options consisting of a single character preceded by a dash, for example,
“l”, but many commands, including those from the GNU Project, also support long options,
consisting of a word preceded by two dashes. Also, many commands allow multiple short
options to be strung together.
Command History
Most Linux distributions remember the last 500 commands by default. Press the down-arrow key
and the previous command disappears.

Some Basic Linux Commands:


1. Date Command: This command is used to display the current data and time.
2. Calendar Command: This command is used to display the calendar of the year or the
month of calendar year.
3. df: To see the current amount of free space on your disk drives, enter df
4. free: Likewise, to display the amount of free memory, enter the free command.
5. exit: We can end a terminal session by either closing the terminal emulator window, or
by entering the exit command at the shell prompt

6. who: It is used to display who are the users connected to our computer currently.
7. who am i Command: Display the details of the current working directory.
8. CLEAR Command: It is used to clear the screen.
9. MAN Command: It help us to know about the command and its options & working.

Tasks:
Task-1:
Run Below Commands and Write their output (Screenshots)
1- Date

2- host name

3- expr 2+2

4- bash –version

5- clear: This command clears the terminal of all commands that has been written.
6- whoami

7- host udacity.com

8- echo “you are a great programmer”

9- uname

10- history: This command displays history of all the commands that has been run in the
terminal. The screenshot displays the recent commands that I ran in my terminal and 895
shows the number of commands.
11- cal

Task-2:
In this activity, you are required to perform tasks given below:
1. Display the current date

2. Display the calendar for the current year


3. Display the calendar of 2012
4. Display the calendar of Feb 2015

Task-3:
Perform the following tasks using Linux CLI commands
1. Display the amount of free storage on your machine

2. Display the amount of free memory on your machine


3. Display the username of
the current user

4. Open the man of date and free command


Observations:
In this lab, we were introduced to Linux command-line, and we worked with some basic
commands to get the basic know-how of working with commands in the command-line interface.
Rubrics
Absent Student is Student can Student has Student has Student
unable to understand followed constructed perfectly
follow the the provided instructions the implemented a
provided laboratory to construct functional/ working
instructions instructions the working model/ logic/
properly. and familiar fundamental schematic/ circuit/ block
The student with the lab schematic/ model/ block diagram/ code
can name the environment block diagram/ and
hardware or (Trainer/ diagram/ code, and successfully
Demonstration
simulation software/ code/ model have executed the
platform, but IDE), but on the successfully lab objective
unable to cannot protoboard/ executed the in Realtime or
implement implement on trainer/ program/ run in a
anything the simulation circuit on simulation
practically or platform software. software environment
on the practically or platform and produced
software on the the desired
software results
Category Ungraded Very Poor Poor Fair Good Excellent
Percentage [0] [1-20] [21-40] [41-60] [61-80] [81-100]
Marks 0.0 0.01 - 0.20 0.21 - 0.40 0.41 - 0.60 0.61 - 0.80 0.81 - 1.0
Date Total Marks Instructor’s Signature

Report not Plagiarized Requirements Observations Appropriate Correctly


submitted content are listed and are recorded computations drawn
presented or experimental along with or numerical conclusion
Laboratory incomplete procedure is detailed analysis is with
Reports submission presented procedure performed exact results
and complete
report in all
respects
Category Ungraded Very Poor Poor Fair Good Excellent
Percentage [0] [1-20] [21-40] [41-60] [61-80] [81-100]
Marks 0.0 0.01 - 0.20 0.21 - 0.40 0.41 - 0.60 0.61 - 0.80 0.81 - 1.0
Date Total Marks Instructor’s Signature

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy