Los Prasen

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

BBIT

IT DEPARTMENT
SUBJECT NAME: Linux Operating System (LOS) SUBJECT CODE: 4331602
STUDENT NAME: SUTHAR PRASEN Enrollment No:236040316094

SEMESTER: 3rd
R1: Accuracy & Documentation

R2: ENGAGEMENT OF STUDENT

R3: REGULARITY OF STUDENT

S. Date Sign R1 R2 R3 TOTAL


Practical Outcomes
No. (4) (3) (3) (10)
(Pros)
Install & test different types of Operating
1
System & compare itsfeatures.
Compare following process scheduling
algorithm.
2 a) First come first serve
b) Round Robin
c) SJF and SRTN
3 Test and execute Linux process commands:
top, PS, kill.
Test and run basic Linux commands to
perform following task:
a) Display the calendar for the month in
4 which you born.
b) Display the calendar for the year
2030.
c) Display the date and time of your
system.
d) Display the date of your system in
mm/dd/yyyy formatfor e.g.
07/14/2030.
Test and execute Linux file and directory
commands toperform following task:
a) Display help for pwd command.
5
b) Write a Linux command to clear your
screen.
c) Display the history of previously
executed command.
Test and execute Linux Super User
command to performfollowing task:
a) Display the user id of the
currently logged-in user ofyour
6 system.
b) Display host name of your system.
c) Write a Linux command to display
the history of loginsinto the system.
d) Write a Linux command to display the
server name.
e) Execute the linux command : who, w
,last
Test and execute Linux editing file
commands to performfollowing task:
7 a) Write a shell script to (i) create user
defined directory (ii) rename it and (iii)
remove the directory.
b) Write a shell script to create a blank
file with name“MyCollege.txt” and write
at least 10 lines. Display the content of
file.
c) Write a shell script to read two
different file names from the command
line and copy the content of first file
into second file and display suitable
message on standard output.
d) Write a shell script to search your name
from a file and display suitable message.
Test and execute wc command.
a) Write a shell script to accept the
string “diploma in information
technology” from user in lower case
8
letter and convert it into upper case
letter. Display output with suitable
user-friendly message.
b) Create a Shell script to find numbers
of characters, words & lines of a
given input file “MyCollege.txt”
Understand and Apply Arithmetic Operators.
Write a shell script to perform arithmetic
operations:
9 a. Write a shell script to read two
numbers from users and perform
addition, subtraction, multiplication,
division and modulus operation of
two numbers and display suitable
user friendly message on standard
output for each operation.
b. Write a shell script to read five
numbers from user and find average
of five numbers.
c. Write a shell script to read radius (R)
in cm from user and find area (A) of
circle and display suitable user
friendly message on standard
output.
Understand and apply control statements
Write a shell script to perform given
operations:
a) Write a shell script to find
10 maximum number among three
numbers.
b) Write a shell script to find sum and
average of N numbers.
c) Create a shell script to reverse the
digits of a given 5- digit number. (for
e.g. , if the no. is 57429 then answer
is 92475).
236040316094 Name: SUTHAR PRASEN.R

PRACTICAL-1
Aim: Install & test different types of Operating System & compare its features.
Different types of OS are:
 Windows OS
 Disk OS
 LINUX OS
1. Windows is a graphical operating system developed by Microsoft. It allows
users to view and store files, run the software, play games, watch videos, and
provides a way to connect to the internet. It was built for both home computing
and professional works.
2. A DOS, or disk operating system, is an operating system that runs from a disk
drive. The term can also refer to a particular family of disk operating systems,
most commonly MS-DOS, an acronym for Microsoft DOS.
3. Linux is an open-source, cross-platform operating system that runs on desktops,
notebooks, tablets, and smartphones.
DOS VS WINDOWS

Sr. Key DOS WINDOWS


No.
1 Definition DOS stands for Disk Operating Windows stands for Windows
System no specific form
2 Tasking It is single tasking It is multi-tasking
nature
3 Power It consumes quite low power It consumes high power
consumption
4 Memory DOS memory requirement are Window memory
consumption quite low requirements are quite high as
compare to DOS
5 Networking DOS has no support for Windows support networking
support networking
6 Usage DOS is complex in usage, You Windows usage is user

Linux Operating System Course Code: 4331602


236040316094 Name: SUTHAR PRASEN.R

need to remember commands friendly and quite simple to


use
7 User Command line based OS GUI based OS
interface
8 Multimedia It does not support Multimedia It support multimedia like
games, videos, audios
9 Speed Command Execution is faster Windows operation are slower
as compare to DOS commands
10 Window It supports single Window at a It supports multiple Window
Support time at a time

LINUX VS WINDOWS

Sr. Key LINUX WINDOwS


No.
1 Open Source Linux is open source and free Windows is neither open
to use source nor free to use
2 Case It is case sensitive It is case insensitive
sensitivity
3 Kernel type Linux uses monolithic kernel Windows uses micro kernel
4 Efficiency More efficient in operations as Less efficient in operations.
compared to Windows
5 Path It use forward slash as path It use backword slash as path
separator separator separator
6 Security Highly secure compare to Less secure compare to Linux
windows

UNIX LINUX DOS WINDOWS MAC OS PALM OS/


POCKET PC
Multi-user Multi-user Single user Single user Single user Single user
Command line Command line Command line GUI GUI GUI
user interface user user interface
interface,
GUI
Multi-tasking Multi-tasking Single tasking Multi-tasking Multi-tasking Multi-tasking
Has several An open Replaced by The first true Easy to use Specifically

Linux Operating System Course Code: 4331602


236040316094 Name: SUTHAR PRASEN.R

versions but source MS Windows MS Windows GUI designed for


lack in software OS OS is MS PDA
interoperability Windows95

Installation of windows 11
Step 1: Check Windows 11 Compatibility
In order to upgrade to Windows 11, your computer must meet Windows 11
minimum requirements and should be running the most up-to-date Windows 10
version. If this is not the case, it may be best to consider moving to a Windows-11-
compatible device.
Microsoft’s official minimum Windows 11 system requirements include:
● CPU: 1 GHz with two or more cores on a 64-bit processor
● Memory: 4 GB
● Display: Measures 9 inches diagonally and high definition (720 p)
● Storage: 64 GB
● Graphics Card: DirectX 12 with WDDM 2.0 driver compatibility
● Security: TPM 2.0, UEFI, Secure Boot
● RAM: 4 GB
Run a windows 11 compatibility check via PC Health Check to test if your
computer, the following steps must be taken:
1. Download and open the app.
2. Accept the Microsoft license agreement terms and click on “Install.”
3. Once the application has been installed, select the “Open Windows PC
Health Check” checkbox, then click “Finish.”
4. When the tool opens, you will see your computer’s configuration on the left
and an “Introducing Windows 11” banner on top. Click on the blue “Check
Now” button tool to verify your PC’s compatibility with Windows 11.
5. If compatible, a “This PC meets Windows 11 requirements” pop-up will
appear.
Step 2: Check Windows 11 System Requirements
You must type in “Windows update” in the search bar on your computer and open
the Windows Update menu.
An important note here — even if you have checked for compatibility issues via
the PC health check feature, you may still see the following message in the menu
that your computer does not meet windows 11 minimum requirements:
“This PC doesn’t currently meet all the system requirements for Windows 11.”

Linux Operating System Course Code: 4331602


236040316094 Name: SUTHAR PRASEN.R

Don't worry. Even if Windows sometimes has a hard time synchronizing PC health
checks with Windows Update results, you can avoid falling victim to a bricked
system or loss of data.
Step 3: Backup your data
Even if the computer is salvageable, it's possible to lose all your applications after
an upgrade. You’d have to install them one by one all over again.
However annoying that may be, it's better than losing your data altogether. And
such scenarios have happened in the past with Windows systems. To avoid any
potential data loss, it’s best to backup your data before any major updates.
Step 4: Start the Windows 11 Installation
Now that you have a backup of all vital data, you can go for the Windows 11
upgrade. If the Windows Update window gives you the green light, you can
immediately start the installation.
If the incompatibility message in the Windows update menu persists, you can go
for a workaround.
As long as you’re sure you have enabled TPM 2.0 on your system, you can search
for the Windows 11 Installation Assistant and download it. Once it’s downloaded,
you can initiate the upgrade through it.
Clicking on “See all results” allows you to check each of the system requirements
The download process for Windows 11 system files can take a bit longer to
complete, but there’s a simple trick you can use to speed it up.
To do that, type “delivery optimization” in the Start menu, pull up the Settings
page, and choose the option “Allow downloads from other PCs nearby”. Those PC
don’t need to be on your HomeGroup network, but just close enough to be in range
for the download assistance.
Once download and installation are completed, you can log into your Windows 11
system.
Step 5: Try and test Windows 11
To test Windows 11 correctly, first, you must ensure you have all the latest drivers
for the system. Depending on the hardware and vital software on your PC, you’d
need to visit the official driver download pages of the developers and check for
updates.
Once all updates are done, you can go around and test Windows 11 features — the
centered main menu, different display options, try shortcut display combos, go for
the Auto HDR and see how your favorite games perform on the new setup.

Linux Operating System Course Code: 4331602


236040316094 Name: SUTHAR PRASEN.R

Installation of LINUX
1. Download the Linux distribution of your choice: If you are new to Linux, consider
trying a lightweight and easy to use distribution, such as Ubuntu or Linux Mint.
Linux distributions (known as "distros") are typically available free to download in
ISO format.
2. Boot into the Live CD or Live USB. Most computers are set to boot into the hard
drive first, which means you will need to change some settings to boot from your
newly burned CD or USB. Start by rebooting the computer.
Once the computer reboots, press the key used to enter the boot menu. The key for
your system will be displayed on the same screen as the manufacturer’s logo. Typical
keys include F12, F2, or Del.
3. Try out the Linux distribution before installing. Most Live CDs and USBs can
launch a "live environment", giving you the ability to test it out before making the
switch. You will not be able to create files, but you can navigate around the interface
and decide if it is right for you.
4. Start the installation process. If you are trying out the distro, you can launch the
installation from the application on the desktop. If you decided not to try out the
distribution, you can start the installation from the boot menu.
You will be asked to configure some basic options, such as language, keyboard
layout, and time zone.
5. Create a username and password. You will need to create login information to
install Linux. A password will be required to log into your account and perform
administrative tasks.
6. Set up the partition. Linux needs to be installed on a separate partition from any
other operating systems on your computer if you intend dual booting Linux with
another OS. A partition is a portion of the hard drive that is formatted specifically for
that operating system. You can skip this step if you do not plan on dual booting.

Linux Operating System Course Code: 4331602


236040316094 Name: SUTHAR PRASEN.R

7. Boot into Linux. Once the installation is finished, your computer will reboot. You
will see a new screen when your computer boots up called “GNU GRUB”. This boot
loader handles Linux installations. Pick your new Linux distro from the list. This
screen may not show up if you only have one operating system on your computer. If
this screen is not being presented to you automatically, then you can get it back by
hitting shift right after the manufacturer splash screen.
8. Check your hardware. Most hardware should work out of the box with your Linux
distro, though you may need to download some additional drivers to get everything
working.
9. Start using Linux. Once your installation is complete and you have verified that
your hardware is working, you are ready to start using Linux. Most distros come with
several popular programs installed, and you can download many more from their
respective file repositories.
Conclusion: From the study of practical and instalment of different types of OS, it
concluded each OS has its own characteristics and they are unique in their ways.

Linux Operating System Course Code: 4331602


236040316094 Name: SUTHAR PRASEN R

PRACTICAL-2
Aim: Compare following process scheduling algorithm.
a) First come first serve
b) Round Robin
c) SJF and SRTN
Scheduling of processes/work is done to finish the work on time. CPU
Scheduling is a process that allows one process to use the CPU while another
process is delayed (in standby) due to unavailability of any resources such as
I/O etc, thus making full use of the CPU.
The purpose of CPU Scheduling is to make the system more efficient, faster,
and fairer.
CPU scheduling is the process of deciding which process will own the CPU to
use while another process is suspended. The main function of the CPU
scheduling is to ensure that whenever the CPU remains idle, the OS has at least
selected one of the processes available in the ready-to-use line.
Objectives of Process Scheduling Algorithm:
 Utilization of CPU at maximum level. Keep CPU as busy as possible.
 Allocation of CPU should be fair.
 Throughput should be Maximum. i.e. Number of processes that complete
their execution per time unit should be maximized.
 Minimum turnaround time, i.e. time taken by a process to finish execution
should be the least.
 There should be a minimum waiting time and the process should not starve in
the ready queue.
 Minimum response time. It means that the time when a process produces the
first response should be as less as possible.
What are the different terminologies to take care of in any CPU Scheduling
algorithm?
 Arrival Time: Time at which the process arrives in the ready queue.
 Completion Time: Time at which process completes its execution.
 Burst Time: Time required by a process for CPU execution.
 Turn Around Time: Time Difference between completion time and arrival
time.
Turn Around Time = Completion Time – Arrival Time
 Waiting Time (W.T): Time Difference between turnaround time and burst
time.
Waiting Time = Turn Around Time – Burst Time

Linux Operating System Course Code: 4331602


236040316094 Name: SUTHAR PRASEN R

1. First Come First Serve (FCFS):


FCFS considered being the simplest of all operating system scheduling
algorithms. First come first serve scheduling algorithm states that the process
that requests the CPU first is allocated the CPU first and is implemented by
using FIFO queue.

2. Round robin:

Round Robin is a CPU scheduling algorithm where each process is cyclically


assigned a fixed time slot. It is the pre-emptiveversion of First come First Serve
CPU Scheduling algorithm. Round Robin CPU Algorithm generally focuses on
Time Sharing technique.

3. Shortest Job First (SJF):

Shortest job first (SJF) is a scheduling process that selects the waiting process
with the smallest execution time to execute next. This scheduling method may
or may not be pre-emptive. Significantly reduces the average waiting time for
other processes waiting to be executed. The full form of SJF is Shortest Job
First.

4. Shortest Remaining Time First:

Shortest remaining time first is the pre-emptive version of the shortest job
first which we have discussed earlier where the processor is allocated to the job
closest to completion. In SRTF, the process with the smallest amount of time
remaining until completion is selected to execute.

Linux Operating System Course Code: 4331602


236040316094 Name: SUTHAR PRASEN R

Comparison of different scheduling algorithm:


Name of Type Used Pros Cons Complexity
algorithm
FCFS Non Pre- Batch Low overhead High average Simplest
emptive wait
Round Robin Pre-emptive Interactive Fair allocation Good time Depends
slice must be upon time
selected quantum
SJF Non Pre- Batch Low average Tough to Difficult to
emptive waiting time determine understand
CPU request

Let’s learn by example:


Here 4 process are given with different id and time in miliseconds
Process ID Burst time Arrival Time
P1 8 0
P2 4 1
P3 9 2
P4 5 3

Let’s solve this with FCFS:

P1 P2 P3 P4
0 8 12 21 26

Completion time Turn Around time Waiting time


8 8 0
12 11 7
21 19 10
26 23 18
Average Waiting time=8.75ms
Average Turnaround time=15.25ms
Let’s solve this with SJF (non pre-emptive):

P1 P2 P4 P3
0 8 12 17 26

Linux Operating System Course Code: 4331602


236040316094 Name: SUTHAR PRASEN R

Completion time Turn Around time Waiting time


8 8 0
12 11 7
26 24 15
17 14 9
Average Waiting time=7.75ms
Average Turnaround time=14.25ms
Let’s solve this with SJF(pre-emptive) or SRTN:

P1 P2 P2 P2 P4 P1 P3
0 1 2 3 5 10 17 26

Completion time Turn Around time Waiting time


17 17 9
5 4 0
26 24 15
10 7 2
Average Waiting time=6.5ms
Average Turnaround time=13ms
Let’s solve this with Round Robin with time Quantum=4:

P1 P2 P3 P4 P1 P3 P4 P3
0 4 8 12 16 20 24 25 26

Completion time Turn Around time Waiting time


20 20 12
8 7 3
26 24 15
25 22 17
Average Waiting time=11.75ms
Average Turnaround time=18.25ms

Conclusion: This practical teach us how each process scheduling algorithm


works and about their benefits and drawback.

Linux Operating System Course Code: 4331602


236040316094 Name: SUTHAR PRASEN R

PRACTICAL-3
Aim: Test and execute Linux process commands: top, ps, kill.
Top command: This utility tells the user about all the running processes on the
Linux machine.

Top command display the current status of the system and a list of all running
processes with their usage information.

Syntax: top [option]

Example: $top

Output:

(Hint: Press ‘q’ on the keyboard to move out of the process display.)

From the output we can see 12 columns,

 PID: The unique process id given to each process. e.g 7893


 User: Username of the process owner. e.g root
 PR: Priority given to a processes during scheduling. e.g 18
 NI: This is the nice value of the task,. e.g -20
 VIRT: This is the amount of virtual memory used by a process. e.g 4008
 RES: The amount of physical memory used up by a process. e.g 3668
 SHR: The amount of memory shared with other processes. e.g 7932
 S: State of the process. e.g D for uninterruptible sleep, R for running, S for
sleeping, T for traced or stopped, Z zombie.
 %CPU: This represents the percentage of CPU used by a process. e.g 1.3
 %MEM: This is the RAM percentage used by a process. e.g 7.5
 TIME+: The total CPU time consumed by a process. e.g 1.06.31
 Command: Command used to activate a process. e.g console

PS command: ps command is used to list the currently running processes


and their PIDs along with some other information depends on different
options.

Linux Operating System Course Code: 4331602


236040316094 Name: SUTHAR PRASEN R

Ps stands for “Process Status”.


Syntax: ps [options]
Example: $ps

Output:

Result contains four columns of information.


Where,
PID – the unique process ID
TTY – terminal type that the user is logged into
TIME – amount of CPU in minutes and seconds that the process has been
running
CMD – name of the command that launched the process.
Note – Sometimes when we execute ps command, it shows TIME as
00:00:00. It is nothing but the total accumulated CPU utilization time for any
process and 00:00:00 indicates no CPU time has been given by the kernel till
now. In above example we found that, for bash no CPU time has been given.
This is because bash is just a parent process for different processes which
needs bash for their execution and bash itself is not utilizing any CPU time till
now.

Kill command: kill command in Linux (located in /bin/kill), is a built-in


command, which is use to terminate processes manually. kill command
sends a signal to a process that terminates the process. If the user doesn’t
specify any signal that is to be sent along with the kill command, then a
default TERM signal is sent that terminates the process.
Syntax: kill [options] PID
Example: $kill

Output:

Linux Operating System Course Code: 4331602


236040316094 Name :SUTHAR PRASEN R

PRACTICAL-4
Aim: Test and run basic Linux commands to perform following task:
a) Display the calendar for the month in which you born.
b) Display the calendar for the year 2030.
c) Display the date and time of your system.
d) Display the date of your system in mm/dd/yyyy format for e.g. 07/14/2030.

a) Display the calendar for the month in which you born.


$
Output:
Sure, let's look at the calendar for September 2005:

**September 2005**

| Su | Mo | Tu | We | Th | Fr | Sa |
|----|----|----|----|----|----|----|
| 1| 2| 3| 4| 5| 6| 7|
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | | | | | |

In September 2005, the month started on a Thursday and had 30


days.

Linux Operating System Course Code: 4331602


b) Display the calendar for the year 2030.
$
Output:
Here is the calendar for the entire year of 2030:

**January 2030**

| Su | Mo | Tu | We | Th | Fr | Sa |
|----|----|----|----|----|----|----|
| | | | | 1| 2| 3|
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |

**February 2030**

| Su | Mo | Tu | We | Th | Fr | Sa |
|----|----|----|----|----|----|----|
| | | | | | 1| 2|
| 3| 4| 5| 6| 7| 8| 9|
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | | |

**March 2030**

| Su | Mo | Tu | We | Th | Fr | Sa |
|----|----|----|----|----|----|----|
| | | | | | | 1|
| 2| 3| 4| 5| 6| 7| 8|
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 | | | | | |

**April 2030**

| Su | Mo | Tu | We | Th | Fr | Sa |
|----|----|----|----|----|----|----|
| | | | | | 1| 2|

Linux Operating System Course Code: 4331602


| 3| 4| 5| 6| 7| 8| 9|
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |

**May 2030**

| Su | Mo | Tu | We | Th | Fr | Sa |
|----|----|----|----|----|----|----|
| | | | | | | 1|
| 2| 3| 4| 5| 6| 7| 8|
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 | | | | | |

**June 2030**

| Su | Mo | Tu | We | Th | Fr | Sa |
|----|----|----|----|----|----|----|
| | | | | | | |
| 1| 2| 3| 4| 5| 6| 7|
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | | | | | |

**July 2030**

| Su | Mo | Tu | We | Th | Fr | Sa |
|----|----|----|----|----|----|----|
| | | | | | | |
| 1| 2| 3| 4| 5| 6| 7|
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 | | | | |

**August 2030**

| Su | Mo | Tu | We | Th | Fr | Sa |
|----|----|----|----|----|----|----|
| | | | | | | |

Linux Operating System Course Code: 4331602


| | | | | 1| 2| 3|
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |

**September 2030**

| Su | Mo | Tu | We | Th | Fr | Sa |
|----|----|----|----|----|----|----|
| | | | | | | |
| | | | | | | 1|
| 2| 3| 4| 5| 6| 7| 8|
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | | | | | | |

**October 2030**

| Su | Mo | Tu | We | Th | Fr | Sa |
|----|----|----|----|----|----|----|
| | | | | | | |
| | | | | 1| 2| 3|
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |

**November 2030**

| Su | Mo | Tu | We | Th | Fr | Sa |
|----|----|----|----|----|----|----|
| | | | | | | |
| | | | | | 1| 2|
| 3| 4| 5| 6| 7| 8| 9|
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |

**December 2030**

| Su | Mo | Tu | We | Th | Fr | Sa |

Linux Operating System Course Code: 4331602


|----|----|----|----|----|----|----|
| | | | | | | |
| | | | | | | 1|
| 2| 3| 4| 5| 6| 7| 8|
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 | | | | | |

c) Display the date and time of your system.


$
Output:
To display the date and time on a Windows 10 system, you can use
the Command Prompt. Here’s a quick guide:

1. **Open Command Prompt**: Press `Windows + R`, type `cmd`,


and press `Enter`.

2. **Enter the Command**: Type the following command and press


`Enter`:

```
echo %date% %time%
```

This command will print the current date and time in the format
used by your system's settings.

If you want to format the date and time to match the example you
provided (`10PM 24 JUNE 2020`), you would need to manually
adjust the output or use a script. Here’s a simple example using
PowerShell for a formatted output:

1. **Open PowerShell**: Press `Windows + X`, then choose


`Windows PowerShell` or `Windows Terminal`.

2. **Enter the Command**:

```powershell
Get-Date -Format "hh:mm tt dd MMMM yyyy"

Linux Operating System Course Code: 4331602


```

This command will output the current date and time in a format
similar to `10:00 PM 24 June 2020`.

If you need to print this information to a file, you can redirect the
output to a text file using the following command:

```powershell
Get-Date -Format "hh:mm tt dd MMMM yyyy" >
"C:\path\to\output.txt"
```

Replace `C:\path\to\output.txt` with your desired file path.

d) Display the date of your system in mm/dd/yyyy format for e.g.


07/14/2030.
$
Output:
To display the current date in `mm/dd/yyyy` format on a Windows
10 system using Command Prompt or PowerShell, you can follow
these steps:

### Using Command Prompt

1. **Open Command Prompt**: Press `Windows + R`, type `cmd`,


and press `Enter`.

2. **Enter the Command**:

```cmd
powershell -Command "Get-Date -Format 'MM/dd/yyyy'"
```

This will display the current date in `mm/dd/yyyy` format.

### Using PowerShell

1. **Open PowerShell**: Press `Windows + X`, then choose


`Windows PowerShell` or `Windows Terminal`.

Linux Operating System Course Code: 4331602


2. **Enter the Command**:

```powershell
Get-Date -Format "MM/dd/yyyy"
```

This command will output the current date in the `mm/dd/yyyy`


format.

If you need to output the date to a file, you can use:

```powershell
Get-Date -Format "MM/dd/yyyy" > "C:\path\to\output.txt"
```

Replace `C:\path\to\output.txt` with your desired file path.

This will give you the current date in the specified format.

Linux Operating System Course Code: 4331602


236040316094 Name :SUTHAR PRASEN R

PRACTICAL-5
Aim: Test and execute Linux file and directory commands to perform following
task:
a) Display help for pwd command.
b) Write a Linux command to clear your screen.
c) Display the history of previously executed command.

a) Display help for pwd command.


The help command in the Linux terminal provides information about built-in commands for
the bash shell. Built-in commands are programs that come with the bash shell version. To
get a list of all built-in commands, type help at the terminal prompt.
Here you can type help pwd to learn more about the pwd command. You can also use help -
d pwd to get a short description of the pwd command, or help -s pwd to get a short usage
synopsis.
Syntax: $ help [options]
-d output short description for each topic
-m display usage in pseudo-manpage format
-s output only a short usage synopsis for each topic matching
$ help –d pwd
Output:

b) Write a Linux command to clear your screen.


The clear command is the go-to tool for clearing the terminal screen in Linux. Despite its
effectiveness, clear does not reinitialize the terminal, which is sometimes necessary.
The clear command in Linux clears the contents of the terminal screen. It shifts the display so
that the command prompt is at the top of the screen on the first line
Syntax: $ clear
Output:

c) Display the history of previously executed command.


The history command in Linux provides a chronological list of previously executed
commands, along with corresponding command numbers. This feature allows users to
recall, reuse, and modify commands without having to retype them. The command history
is stored in a file, typically ~/.bash_history for the Bash shell.
Syntax: $ history [options]
Output:

Linux Operating System Course Code: 4331602


236040316094 Name : SUTHAR PRASEN R

PRACTICAL-6
Aim: Test and execute Linux Super User command to perform following task:
a) Display the user id of the currently logged-in user of your system.
b) Display host name of your system.
c) Write a Linux command to display the history of logins into the system.
d) Write a Linux command to display the server name.
e) Execute the linux command : who, w ,last

a) The who command displays the following information for each user currently
logged in to the system if no option is provided:
1. Login name of the users
2. Terminal line numbers
3. Login time of the users into the system
4. The remote host name of the user

Syntax: $ who

Output:

b) Display host name of your system.

hostname command in Linux is used to obtain the DNS (Domain Name


System) name and set the system’s hostname or NIS (Network Information
System) domain name. A hostname is a name given to a computer and attached to
the network. Its main purpose is to uniquely identify over a network.

The hostname command has a number of options you can use for more specific
outputs:

-a, --alias: Displays the alias name of the host.


-A, --all-fqdns: Displays every FQDN (Fully Qualified Domain Name) of the
computer.
-b, --boot: Always set a hostname.
-d, --domain: Display DNS domain name.
-f, --fqdn, --long: Display the FQDN.
-F, --file: Check a file to recover and display the hostname.
-h, --help: Print the help message as the output.
-i, --ip-address: Display the computer’s IP address.
-I, --all-ip-addresses: Display all of the computer’s network addresses.
-s, --short: Display the short version of the hostname.
-v, --verbose: Expand all output to verbose.
-y, --yp, --nis: Display the NIS domain name.

Syntax: $ hostname [option] [file]

Output:

Linux Operating System Course Code: 4331602


236040316094 Name : SUTHAR PRASEN R

c) Write a Linux command to display the history of logins into the system.
The last command shows a list of recently logged-in users, along with the times
they logged in and out. By running `last` without any options, you can see a
historical log of user logins.

Syntax: $ last
$ lastlog

Output:

d) Write a Linux command to display the server name.


The uname command in Linux is a command-line utility that displays information
about the system's kernel and other system-related information:
Kernel name: The name of the system's kernel
Hostname: The name of the system's hostname
Kernel release: The release number of the system's kernel
Kernel version: The version of the system's kernel
Machine hardware name: The name of the system's machine hardware
Processor type: The type of processor in the system

Syntax: $ hostname [option]


$ uname [option]

Output:

e) Execute the linux command : who, w ,last


Syntax: $ who
Output:

Syntax: $ w
Output:

Syntax: $ last
Output:

Linux Operating System Course Code: 4331602

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