SlideShare a Scribd company logo
1 of 12
SUBMITTED BY: M. UBAID ASHRAF
REG. NUMBER: 20-CP-09
SUBMITTED TO: SIR ADNAN MUSTAFA
SECTION: ALPHA
SEMESTER: 4th
ASSIGNMENT NO. 1
UNIVERSITY OF ENGINEERING & TECHNOLOGY,
TAXILA
1: Display your current directory.
2: Change to the /etc directory.
3: Go to the parent directory of the current directory.
4: Go to the root directory.
5: List the contents of root directory.
6: List a long listing of the root directory.
7: Stay where you are, and list the contents of /etc
8: Stay where you are and list the contents of /bin and /sbin.
9: Stay where you are, and list the contents of ~
10:List all the files (including hiddenfiles) inyour home directory.
11:List the files in/boot in a human readable format.
12: Create a directory testdir in your home directory.
13: Change to the /etc directory, stay here and create a directory newdir inyour
home directory.
14: Display the absolute path of your home directory.
15: Create a new subdirectory called COP3353-temp in your home directory.
16: Create a new subdirectory called assign1 in COP3353-temp
a. Create a new subdirectory called assign2 in COP3353-temp.
b. Display the contents of the directory COP3353-temp
c. Delete the directory assign2
d. Display the contents of COP3353-temp
e. Change your current working directory to COP3353-temp.
f. Create a newfile calledMyFile.txtusing the touchcommand and insert
two lines into the file.
a) Thefirstlineshould bea sentencethat tells meyourfavoritemovie.
b) The second line should be a sentence that tells me your favorite
food.
After creating the file using touch command, I use gedit command
to insert two lines into the file and display the content of file using
cat command.
17:Write a shell script tocalculate asimple interest.
Code for calculating simple interest:
echo " Enter the principle value: "
read p
echo " Enter the rate of interest:"
read r
echo " Enter the time period:"
read t
i=`expr $p * $t * $r / 100`
echo " The simple interest is "
echo $i
18: What is the purpose of following commands? Discuss in detail.
 Kill:
kill command in Linux (located in /bin/kill), is a built-in command which is
used to terminate processes manually. kill command sends a signal to a
process which terminates the process.
 Grep:
The grepcommand whichstandsfor “global regularexpressionprint,”processestextline
by line andprintsanylineswhichmatchaspecifiedpattern.The grepcommandisusedto
search text or searches the given file for lines containing a match to the given strings or
words.
 Tail:
Linux tail command is used to display the last ten lines of one or more
files. Its main purpose is to read the error message. By default, it
displaysthe lastten lines of a file. Additionally, it is used to monitor the
file changes in real-time.
 Head:
The head command is a command-line utility for outputting the first
part of files given to it via standard input. It writes results to standard
output. By default, head returns the first ten lines of each file that it is
given.
 Chmod:
The Linuxcommand chmod allows you to controlexactly who is able to
read, edit, or run yourfiles. Chmod is an abbreviation forchangemode;
if you ever need to say it out loud, justpronounceit exactly as it looks:
ch'-mod.
 Touch:
It is used to create a file without any content. The file created using
touch command is empty. This command can be used when the user
doesn’t have data to store at the time of file creation.
 History:
The history command in Linux allows us to view the history of the
commands that we run in the terminal. You can set the maximum
number of entries BASH should storeas history in your . bashrc file. For
most Linux users, using the command line is a daily activity.
 Pr:
In Linux pr command is used to prepare a file for printing by adding
suitable footers,headers,and the formatted text. pr commandactually
adds 5 lines of margin both at the top and bottom of the page.
 Sudo:
Sudo stands for SuperUser DO and is used to access restricted files and
operations. By default, Linux restricts access to certain parts of the
system preventing sensitive files from being compromised.
 Lp:
In Linux, we use lp command to print the files of any mode i.e.
landscape or portrait, multiple copies or single copies and so on.
 Apt-get:
apt-get is a command-line tool which helps in handling packages in
Linux. Its main task is to retrieve the information and packages from
the authenticated sources for installation, upgrade and removal of
packages along with their dependencies.
 Tar:
The Linux 'tar' stands for tape archive, is used to create Archive and
extract the Archive files. tar command in Linux is one of the important
command which provides archiving functionality in Linux.
 Sed:
SED command in linux is for substitution or for find and replace. By
using SED you can edit files even withoutopening them, which is much
quicker way to find and replace something in file, than first opening
that file in VI Editor and then changing it. SED is a powerfultext stream
editor.
 Sort:
The sortcommand is used in Linux to print the output of a file in given
order. This command processes on your data (thecontent of the file or
output of any command) and reorders it in the specified way, which
helps us to read the data efficiently.
 Gzip:
Gzip (GNUzip)is a freeand open sourcealgorithmforfile compression.
The software is overseen by the GNU project. In this context,
compression is the deliberate reduction in sizeof data to savestorage
space or increase the data transfer rate.

More Related Content

Similar to Assignment OS LAB 2022

Similar to Assignment OS LAB 2022 (20)

Directories description
Directories descriptionDirectories description
Directories description
 
Linux commands and file structure
Linux commands and file structureLinux commands and file structure
Linux commands and file structure
 
Linux
LinuxLinux
Linux
 
Introduction to the linux command line.pdf
Introduction to the linux command line.pdfIntroduction to the linux command line.pdf
Introduction to the linux command line.pdf
 
Linux week 2
Linux week 2Linux week 2
Linux week 2
 
Linux
LinuxLinux
Linux
 
Linux Cheat Sheet.pdf
Linux Cheat Sheet.pdfLinux Cheat Sheet.pdf
Linux Cheat Sheet.pdf
 
Ppt
PptPpt
Ppt
 
Unix_QT.ppsx
Unix_QT.ppsxUnix_QT.ppsx
Unix_QT.ppsx
 
Unix_QT.ppsx
Unix_QT.ppsxUnix_QT.ppsx
Unix_QT.ppsx
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
 
Module 3 Using Linux Softwares.
Module 3 Using Linux Softwares.Module 3 Using Linux Softwares.
Module 3 Using Linux Softwares.
 
Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools
 
Introduction to linux day1
Introduction to linux day1Introduction to linux day1
Introduction to linux day1
 
Basic 50 linus command
Basic 50 linus commandBasic 50 linus command
Basic 50 linus command
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 
Linux file commands and shell scripts
Linux file commands and shell scriptsLinux file commands and shell scripts
Linux file commands and shell scripts
 
Linux Basics
Linux BasicsLinux Basics
Linux Basics
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08
 

Recently uploaded

VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIkoyaldeepu123
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture designssuser87fa0c1
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 

Recently uploaded (20)

Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AI
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture design
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 

Assignment OS LAB 2022

  • 1. SUBMITTED BY: M. UBAID ASHRAF REG. NUMBER: 20-CP-09 SUBMITTED TO: SIR ADNAN MUSTAFA SECTION: ALPHA SEMESTER: 4th ASSIGNMENT NO. 1 UNIVERSITY OF ENGINEERING & TECHNOLOGY, TAXILA
  • 2. 1: Display your current directory. 2: Change to the /etc directory. 3: Go to the parent directory of the current directory. 4: Go to the root directory. 5: List the contents of root directory. 6: List a long listing of the root directory.
  • 3. 7: Stay where you are, and list the contents of /etc
  • 4. 8: Stay where you are and list the contents of /bin and /sbin.
  • 5.
  • 6. 9: Stay where you are, and list the contents of ~ 10:List all the files (including hiddenfiles) inyour home directory. 11:List the files in/boot in a human readable format.
  • 7. 12: Create a directory testdir in your home directory. 13: Change to the /etc directory, stay here and create a directory newdir inyour home directory. 14: Display the absolute path of your home directory. 15: Create a new subdirectory called COP3353-temp in your home directory.
  • 8. 16: Create a new subdirectory called assign1 in COP3353-temp a. Create a new subdirectory called assign2 in COP3353-temp. b. Display the contents of the directory COP3353-temp c. Delete the directory assign2
  • 9. d. Display the contents of COP3353-temp e. Change your current working directory to COP3353-temp. f. Create a newfile calledMyFile.txtusing the touchcommand and insert two lines into the file. a) Thefirstlineshould bea sentencethat tells meyourfavoritemovie. b) The second line should be a sentence that tells me your favorite food. After creating the file using touch command, I use gedit command to insert two lines into the file and display the content of file using cat command. 17:Write a shell script tocalculate asimple interest. Code for calculating simple interest: echo " Enter the principle value: " read p echo " Enter the rate of interest:" read r
  • 10. echo " Enter the time period:" read t i=`expr $p * $t * $r / 100` echo " The simple interest is " echo $i 18: What is the purpose of following commands? Discuss in detail.  Kill: kill command in Linux (located in /bin/kill), is a built-in command which is used to terminate processes manually. kill command sends a signal to a process which terminates the process.  Grep: The grepcommand whichstandsfor “global regularexpressionprint,”processestextline by line andprintsanylineswhichmatchaspecifiedpattern.The grepcommandisusedto search text or searches the given file for lines containing a match to the given strings or words.  Tail: Linux tail command is used to display the last ten lines of one or more files. Its main purpose is to read the error message. By default, it displaysthe lastten lines of a file. Additionally, it is used to monitor the file changes in real-time.  Head: The head command is a command-line utility for outputting the first part of files given to it via standard input. It writes results to standard output. By default, head returns the first ten lines of each file that it is given.  Chmod: The Linuxcommand chmod allows you to controlexactly who is able to read, edit, or run yourfiles. Chmod is an abbreviation forchangemode; if you ever need to say it out loud, justpronounceit exactly as it looks: ch'-mod.  Touch: It is used to create a file without any content. The file created using touch command is empty. This command can be used when the user doesn’t have data to store at the time of file creation.  History:
  • 11. The history command in Linux allows us to view the history of the commands that we run in the terminal. You can set the maximum number of entries BASH should storeas history in your . bashrc file. For most Linux users, using the command line is a daily activity.  Pr: In Linux pr command is used to prepare a file for printing by adding suitable footers,headers,and the formatted text. pr commandactually adds 5 lines of margin both at the top and bottom of the page.  Sudo: Sudo stands for SuperUser DO and is used to access restricted files and operations. By default, Linux restricts access to certain parts of the system preventing sensitive files from being compromised.  Lp: In Linux, we use lp command to print the files of any mode i.e. landscape or portrait, multiple copies or single copies and so on.  Apt-get: apt-get is a command-line tool which helps in handling packages in Linux. Its main task is to retrieve the information and packages from the authenticated sources for installation, upgrade and removal of packages along with their dependencies.  Tar: The Linux 'tar' stands for tape archive, is used to create Archive and extract the Archive files. tar command in Linux is one of the important command which provides archiving functionality in Linux.  Sed: SED command in linux is for substitution or for find and replace. By using SED you can edit files even withoutopening them, which is much quicker way to find and replace something in file, than first opening that file in VI Editor and then changing it. SED is a powerfultext stream editor.  Sort: The sortcommand is used in Linux to print the output of a file in given order. This command processes on your data (thecontent of the file or output of any command) and reorders it in the specified way, which helps us to read the data efficiently.
  • 12.  Gzip: Gzip (GNUzip)is a freeand open sourcealgorithmforfile compression. The software is overseen by the GNU project. In this context, compression is the deliberate reduction in sizeof data to savestorage space or increase the data transfer rate.