SlideShare a Scribd company logo
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.
Assignment OS LAB 2022
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.
Ad

More Related Content

What's hot (20)

Pointe driving
Pointe drivingPointe driving
Pointe driving
Black and White indst.
 
Vaping and the Smoking Ordinance
Vaping and the Smoking OrdinanceVaping and the Smoking Ordinance
Vaping and the Smoking Ordinance
City of College Station
 
Smart Walking Stick for Visually Challenged People
Smart Walking Stick for Visually Challenged PeopleSmart Walking Stick for Visually Challenged People
Smart Walking Stick for Visually Challenged People
Associate Professor in VSB Coimbatore
 
smart helmet
smart helmetsmart helmet
smart helmet
Venkata Krishna
 
Overspeeding
OverspeedingOverspeeding
Overspeeding
Dixon Dennis
 
Chemistry IP cbse 12
Chemistry IP cbse 12 Chemistry IP cbse 12
Chemistry IP cbse 12
D. j Vicky
 
Distracted Driving
Distracted DrivingDistracted Driving
Distracted Driving
zaib nisa
 
Automotive Security (Connected Vehicle Security Issues)
Automotive Security (Connected Vehicle Security Issues)Automotive Security (Connected Vehicle Security Issues)
Automotive Security (Connected Vehicle Security Issues)
Priyanka Aash
 
Smart healmet
Smart healmetSmart healmet
Smart healmet
Manikotesh
 
Motorcycle safety tips
Motorcycle safety tipsMotorcycle safety tips
Motorcycle safety tips
Kyle Larson
 
Smoking kills
Smoking killsSmoking kills
Smoking kills
my study
 
Road safety
Road safetyRoad safety
Road safety
Anshumaan Tiwari
 
Road safety ppt
Road safety pptRoad safety ppt
Road safety ppt
Ajeet Kumar
 
Smoking Powerpoint Presentation
Smoking Powerpoint PresentationSmoking Powerpoint Presentation
Smoking Powerpoint Presentation
nmccabe
 
Road safety csw
Road safety   cswRoad safety   csw
Road safety csw
Anadi Anant
 
John deere 4310 compact utility tractor service repair manual
John deere 4310 compact utility tractor service repair manualJohn deere 4310 compact utility tractor service repair manual
John deere 4310 compact utility tractor service repair manual
fusfejskekem
 
Water civilisation_mp
Water civilisation_mpWater civilisation_mp
Water civilisation_mp
manjuprakashpatil
 
Do’s and Don’ts on Safe Driving
Do’s and Don’ts on Safe DrivingDo’s and Don’ts on Safe Driving
Do’s and Don’ts on Safe Driving
Ntsi Corp
 
Smoking Facts
Smoking FactsSmoking Facts
Smoking Facts
VR M
 
Smoking and health
Smoking and healthSmoking and health
Smoking and health
Thanushan Balasingam
 
Chemistry IP cbse 12
Chemistry IP cbse 12 Chemistry IP cbse 12
Chemistry IP cbse 12
D. j Vicky
 
Distracted Driving
Distracted DrivingDistracted Driving
Distracted Driving
zaib nisa
 
Automotive Security (Connected Vehicle Security Issues)
Automotive Security (Connected Vehicle Security Issues)Automotive Security (Connected Vehicle Security Issues)
Automotive Security (Connected Vehicle Security Issues)
Priyanka Aash
 
Motorcycle safety tips
Motorcycle safety tipsMotorcycle safety tips
Motorcycle safety tips
Kyle Larson
 
Smoking kills
Smoking killsSmoking kills
Smoking kills
my study
 
Smoking Powerpoint Presentation
Smoking Powerpoint PresentationSmoking Powerpoint Presentation
Smoking Powerpoint Presentation
nmccabe
 
John deere 4310 compact utility tractor service repair manual
John deere 4310 compact utility tractor service repair manualJohn deere 4310 compact utility tractor service repair manual
John deere 4310 compact utility tractor service repair manual
fusfejskekem
 
Do’s and Don’ts on Safe Driving
Do’s and Don’ts on Safe DrivingDo’s and Don’ts on Safe Driving
Do’s and Don’ts on Safe Driving
Ntsi Corp
 
Smoking Facts
Smoking FactsSmoking Facts
Smoking Facts
VR M
 

Similar to Assignment OS LAB 2022 (20)

The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformatics
BITS
 
Karkha unix shell scritping
Karkha unix shell scritpingKarkha unix shell scritping
Karkha unix shell scritping
chockit88
 
Shell_Scripting.ppt
Shell_Scripting.pptShell_Scripting.ppt
Shell_Scripting.ppt
KiranMantri
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
poornima sugumaran
 
linux-lecture4.ppt
linux-lecture4.pptlinux-lecture4.ppt
linux-lecture4.ppt
LuigysToro
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
Reka
 
18 LINUX OS.pptx Linux command is basic isma
18 LINUX OS.pptx Linux command is basic isma18 LINUX OS.pptx Linux command is basic isma
18 LINUX OS.pptx Linux command is basic isma
perweeng31
 
linux-lecture4.pptuyhbjhbiibihbiuhbbihbi
linux-lecture4.pptuyhbjhbiibihbiuhbbihbilinux-lecture4.pptuyhbjhbiibihbiuhbbihbi
linux-lecture4.pptuyhbjhbiibihbiuhbbihbi
YajnadattaPattanayak
 
Linux basic
Linux basicLinux basic
Linux basic
Pragyagupta37
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
poornima sugumaran
 
Directories description
Directories descriptionDirectories description
Directories description
Dr.M.Karthika parthasarathy
 
Linux commands and file structure
Linux commands and file structureLinux commands and file structure
Linux commands and file structure
Sreenatha Reddy K R
 
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEMTERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
pssafvan97
 
Linux
LinuxLinux
Linux
Rathan Raj
 
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
CesleySCruz
 
OS-Module 2 Linux Programming Important topics
OS-Module 2 Linux Programming Important topicsOS-Module 2 Linux Programming Important topics
OS-Module 2 Linux Programming Important topics
JithinS34
 
Linux week 2
Linux week 2Linux week 2
Linux week 2
Vinoth Sn
 
Linux
LinuxLinux
Linux
nazeer pasha
 
Linux Systems Programming: File Handling
Linux Systems Programming: File HandlingLinux Systems Programming: File Handling
Linux Systems Programming: File Handling
RashidFaridChishti
 
Linux Cheat Sheet.pdf
Linux Cheat Sheet.pdfLinux Cheat Sheet.pdf
Linux Cheat Sheet.pdf
roschahacker
 
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformatics
BITS
 
Karkha unix shell scritping
Karkha unix shell scritpingKarkha unix shell scritping
Karkha unix shell scritping
chockit88
 
Shell_Scripting.ppt
Shell_Scripting.pptShell_Scripting.ppt
Shell_Scripting.ppt
KiranMantri
 
linux-lecture4.ppt
linux-lecture4.pptlinux-lecture4.ppt
linux-lecture4.ppt
LuigysToro
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
Reka
 
18 LINUX OS.pptx Linux command is basic isma
18 LINUX OS.pptx Linux command is basic isma18 LINUX OS.pptx Linux command is basic isma
18 LINUX OS.pptx Linux command is basic isma
perweeng31
 
linux-lecture4.pptuyhbjhbiibihbiuhbbihbi
linux-lecture4.pptuyhbjhbiibihbiuhbbihbilinux-lecture4.pptuyhbjhbiibihbiuhbbihbi
linux-lecture4.pptuyhbjhbiibihbiuhbbihbi
YajnadattaPattanayak
 
Linux commands and file structure
Linux commands and file structureLinux commands and file structure
Linux commands and file structure
Sreenatha Reddy K R
 
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEMTERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
TERMINAL COMMANDS IN LINUX TERMINAL USED TO INTERACT WITH SYSTEM
pssafvan97
 
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
CesleySCruz
 
OS-Module 2 Linux Programming Important topics
OS-Module 2 Linux Programming Important topicsOS-Module 2 Linux Programming Important topics
OS-Module 2 Linux Programming Important topics
JithinS34
 
Linux week 2
Linux week 2Linux week 2
Linux week 2
Vinoth Sn
 
Linux Systems Programming: File Handling
Linux Systems Programming: File HandlingLinux Systems Programming: File Handling
Linux Systems Programming: File Handling
RashidFaridChishti
 
Linux Cheat Sheet.pdf
Linux Cheat Sheet.pdfLinux Cheat Sheet.pdf
Linux Cheat Sheet.pdf
roschahacker
 
Ad

Recently uploaded (20)

Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)
6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)
6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)
ijflsjournal087
 
Modeling the Influence of Environmental Factors on Concrete Evaporation Rate
Modeling the Influence of Environmental Factors on Concrete Evaporation RateModeling the Influence of Environmental Factors on Concrete Evaporation Rate
Modeling the Influence of Environmental Factors on Concrete Evaporation Rate
Journal of Soft Computing in Civil Engineering
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink DisplayHow to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
CircuitDigest
 
Using the Artificial Neural Network to Predict the Axial Strength and Strain ...
Using the Artificial Neural Network to Predict the Axial Strength and Strain ...Using the Artificial Neural Network to Predict the Axial Strength and Strain ...
Using the Artificial Neural Network to Predict the Axial Strength and Strain ...
Journal of Soft Computing in Civil Engineering
 
Construction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil EngineeringConstruction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil Engineering
Lavish Kashyap
 
Artificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptxArtificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptx
rakshanatarajan005
 
Personal Protective Efsgfgsffquipment.ppt
Personal Protective Efsgfgsffquipment.pptPersonal Protective Efsgfgsffquipment.ppt
Personal Protective Efsgfgsffquipment.ppt
ganjangbegu579
 
Evonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdfEvonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdf
szhang13
 
SICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introductionSICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introduction
fabienklr
 
Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025
Antonin Danalet
 
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
ajayrm685
 
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
Guru Nanak Technical Institutions
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software ApplicationsJacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia
 
Uses of drones in civil construction.pdf
Uses of drones in civil construction.pdfUses of drones in civil construction.pdf
Uses of drones in civil construction.pdf
surajsen1729
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt
rakshaiya16
 
Autodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User InterfaceAutodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User Interface
Atif Razi
 
Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)
6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)
6th International Conference on Big Data, Machine Learning and IoT (BMLI 2025)
ijflsjournal087
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink DisplayHow to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
CircuitDigest
 
Construction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil EngineeringConstruction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil Engineering
Lavish Kashyap
 
Artificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptxArtificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptx
rakshanatarajan005
 
Personal Protective Efsgfgsffquipment.ppt
Personal Protective Efsgfgsffquipment.pptPersonal Protective Efsgfgsffquipment.ppt
Personal Protective Efsgfgsffquipment.ppt
ganjangbegu579
 
Evonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdfEvonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdf
szhang13
 
SICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introductionSICPA: Fabien Keller - background introduction
SICPA: Fabien Keller - background introduction
fabienklr
 
Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025
Antonin Danalet
 
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
ajayrm685
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software ApplicationsJacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia
 
Uses of drones in civil construction.pdf
Uses of drones in civil construction.pdfUses of drones in civil construction.pdf
Uses of drones in civil construction.pdf
surajsen1729
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt
rakshaiya16
 
Autodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User InterfaceAutodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User Interface
Atif Razi
 
Ad

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.
  • 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.
  翻译: