Chapter Eight Exploring the UNIX Utilities. 2 Lesson A Using the UNIX Utilities.
-
Upload
leslie-snow -
Category
Documents
-
view
234 -
download
2
Transcript of Chapter Eight Exploring the UNIX Utilities. 2 Lesson A Using the UNIX Utilities.
Chapter EightChapter Eight
Exploring the UNIX UtilitiesExploring the UNIX Utilities
22
Lesson ALesson A
Using the UNIX UtilitiesUsing the UNIX Utilities
33
ObjectivesObjectives
Understand what UNIX utilities are Understand what UNIX utilities are available and the classifications of utilitiesavailable and the classifications of utilities
Make a bootable floppy disk to boot the Make a bootable floppy disk to boot the system in case of an emergencysystem in case of an emergency
Duplicate files on a floppy diskDuplicate files on a floppy disk
44
ObjectivesObjectives
Determine hard disk usage and available Determine hard disk usage and available free spacefree space
Locate and remove unnecessary files from Locate and remove unnecessary files from the hard diskthe hard disk
Display the CPU status and internal Display the CPU status and internal memory usagememory usage
55
Understanding UNIX UtilitiesUnderstanding UNIX Utilities
UNIX utilities let you create and manage files, UNIX utilities let you create and manage files, run programs, produce reports, and generally run programs, produce reports, and generally interact with the systeminteract with the system
They also offer a full range of services that let They also offer a full range of services that let you monitor and maintain the system and you monitor and maintain the system and recover from a wide range of errorsrecover from a wide range of errors
Utility programs are vital for working through an Utility programs are vital for working through an OS and new utilities are continually being added OS and new utilities are continually being added in order to make UNIX run more efficientlyin order to make UNIX run more efficiently
66
Understanding UNIX UtilitiesUnderstanding UNIX Utilities
UNIX utilities are classified into seven major UNIX utilities are classified into seven major function areas dictated by user needs function areas dictated by user needs – File processingFile processing– System statusSystem status– NetworkingNetworking– CommunicationsCommunications– ProgrammingProgramming– Source code managementSource code management– MiscellaneousMiscellaneous
77
88
99
1010
1111
1212
1313
1414
1515
Using theUsing theFile Processing UtilitiesFile Processing Utilities
The dd command allows you to copy a file and The dd command allows you to copy a file and change the format of the destination filechange the format of the destination file
The dd command possesses a rich set of The dd command possesses a rich set of options that allow it to handle copies when other options that allow it to handle copies when other methods are inappropriatemethods are inappropriate
An advantage to using the dd command over cp An advantage to using the dd command over cp is that all users, not just the administrator, can is that all users, not just the administrator, can copy files to and from the floppy drivecopy files to and from the floppy drive
1616
Making a Bootable Floppy Making a Bootable Floppy DiskDisk
It is a good idea to make a bootable floppy disk, It is a good idea to make a bootable floppy disk, because a computer problem may prevent you because a computer problem may prevent you from starting UNIX from the systemfrom starting UNIX from the system
To make a bootable floppy disk, use four utility To make a bootable floppy disk, use four utility programs: rdev, mkfs, fdformat, ddprograms: rdev, mkfs, fdformat, dd
1717
Making a Bootable Floppy Making a Bootable Floppy DiskDisk
The rdev command queries and sets the root device, The rdev command queries and sets the root device, which is the hard disk partition that houses UNIX’s root which is the hard disk partition that houses UNIX’s root file systemfile system
The mkfs command builds a UNIX or Linux file system The mkfs command builds a UNIX or Linux file system on a device such as a floppy disk or a hard disk partitionon a device such as a floppy disk or a hard disk partition
The fdformat command formats a floppy at low levels to The fdformat command formats a floppy at low levels to ensure the media is clear of defects and is writeableensure the media is clear of defects and is writeable
Use the dd command to make a back-up copy of a Use the dd command to make a back-up copy of a floppy diskfloppy disk
1818
Making a Bootable Floppy Making a Bootable Floppy DiskDisk
The file system type determines how UNIX reads and writes information from or onto the device
1919
Making a Bootable Floppy Making a Bootable Floppy DiskDisk
After creating a bootable disk, it can be used to start the system
2020
Checking Hard Disk Checking Hard Disk UsageUsage
To maintain adequate hard disk free space, use To maintain adequate hard disk free space, use these strategies:these strategies:– Be vigilant against running dangerously low on free Be vigilant against running dangerously low on free
space by using the df commandspace by using the df command– Watch for conspicuous consumption using the du Watch for conspicuous consumption using the du
commandcommand– Follow a routine schedule for “garbage” collection and Follow a routine schedule for “garbage” collection and
removal by using the rm commandremoval by using the rm command
2121
Using the df UtilityUsing the df Utility
The df utility reports on the status of1024-byte blocks
2222
Using the df UtilityUsing the df Utility
The df –h option causes the block data to display in human-readable form
2323
Using the df UtilityUsing the df Utility
The du utility summarizes disk usage, expressed in 512-byte blocks (default) or by the number of bytes(-b option)
2424
Using the df UtilityUsing the df Utility
...the second screen resulting from using | more
2525
Removing Garbage FilesRemoving Garbage Files
Garbage files are temporary files that lose Garbage files are temporary files that lose their usefulness after several daystheir usefulness after several days
Two examples of garbage files are core Two examples of garbage files are core files (named core) and a.out filesfiles (named core) and a.out files
Use the find command to assist you in Use the find command to assist you in locating these files and the rm command locating these files and the rm command to remove themto remove them
2626
Applying System Status Applying System Status UtilitiesUtilities
System engineers primarily use the data System engineers primarily use the data related to system statusrelated to system status
One of the most effective utilities for One of the most effective utilities for auditing system performance is the top auditing system performance is the top commandcommand
The top command displays a listing of the The top command displays a listing of the most CPU-intensive tasks, such as the most CPU-intensive tasks, such as the processor state processor state
2727
Applying System Status Applying System Status UtilitiesUtilities
The top utility run without any options specified
2828
Applying System Status Applying System Status UtilitiesUtilities
To kill the top utility process, enter k and specify the PID to terminate
2929
Applying System Status Applying System Status UtilitiesUtilities
You cannot killthe top utility when run in secure mode
3030
3131
Applying System Status Applying System Status UtilitiesUtilities
The free utility displays the amount of free and used memory in the system
3232
Applying System Status Applying System Status UtilitiesUtilities
The ps command shows a list of processes associated with the current login session that are currently running
3333
Applying System Status Applying System Status UtilitiesUtilities
The ps command with the –A option shows a list of all system processes currently running
3434
Lesson BLesson B
Working with theWorking with the
Text-Formatting File Utilities Text-Formatting File Utilities
3535
ObjectivesObjectives
Check the spelling of text in a documentCheck the spelling of text in a document
Use the cmp command to compare the Use the cmp command to compare the contents of two filescontents of two files
Format text to create a man pageFormat text to create a man page
Use the groff utility to test a man page you Use the groff utility to test a man page you have createdhave created
Use the man utility to view a man page you Use the man utility to view a man page you have createdhave created
3636
Checking the SpellingChecking the Spellingof a Documentof a Document
Ispell scans a document, displays errors on the screen and suggests alternative spellings
3737
Comparing FilesComparing Files
Use the cmp utility to compare the Use the cmp utility to compare the contents of two files, and report the first contents of two files, and report the first difference between themdifference between them
The cmp command displays the character The cmp command displays the character position and line number of this differenceposition and line number of this difference
If there are no differences, the cmp If there are no differences, the cmp command displays nothingcommand displays nothing
3838
Formatting Text in UNIXFormatting Text in UNIXText formatting in UNIX involves preparing a text Text formatting in UNIX involves preparing a text file with embedded typesetting commands and file with embedded typesetting commands and then processing the marked-up text file with a then processing the marked-up text file with a computer programcomputer program
UNIX’s nroff and troff commands are often used UNIX’s nroff and troff commands are often used to process the embedded typesetting commands to process the embedded typesetting commands to format the outputto format the output
An embedded code is a special sequence of An embedded code is a special sequence of characters that is included with the regular text characters that is included with the regular text of the fileof the file
3939
Formatting Text in UNIXFormatting Text in UNIX
Linux introduced groff, which implements the features of both nroff and troff
4040
Formatting Text in UNIXFormatting Text in UNIX
Groff can be used to produce a man page that contains the standard man page sections
4141
Formatting Text in UNIXFormatting Text in UNIX
Man pages are made available to others by having a supervisor user copy it to one of the man page directories
4242
Chapter SummaryChapter Summary
UNIX utilities are classified into seven major UNIX utilities are classified into seven major functional areas dictated by user needs: file functional areas dictated by user needs: file processing, networking, communications, processing, networking, communications, system status, programming, source code, system status, programming, source code, management, and miscellaneous tasksmanagement, and miscellaneous tasks
Utility programs are distinguished from other OS Utility programs are distinguished from other OS programs, because they are add-ons and not a programs, because they are add-ons and not a part of the UNIX shells part of the UNIX shells
Because utility programs are executed by Because utility programs are executed by entering names on the command line, they are entering names on the command line, they are commonly referred to as commandscommonly referred to as commands
4343
Chapter SummaryChapter Summary
The dd command possesses a rich set of The dd command possesses a rich set of options that allow it to handle copies when options that allow it to handle copies when other copying methods failother copying methods fail
To make a bootable floppy disk, use four utility To make a bootable floppy disk, use four utility programs: rdev, mkfs, fdformat, and ddprograms: rdev, mkfs, fdformat, and dd
The rdev command queries and sets the root The rdev command queries and sets the root devicedevice
The fdformat command performs a low-level The fdformat command performs a low-level format on a floppy diskformat on a floppy disk
The mkfs utility sets up a file systemThe mkfs utility sets up a file system
4444
Chapter SummaryChapter Summary
The df utility checks and reports on free disk The df utility checks and reports on free disk spacespace
The du command checks for disk usageThe du command checks for disk usage
Use the find command to retrieve wasteful files Use the find command to retrieve wasteful files and then use the rm command to remove themand then use the rm command to remove them
The top and free utilities provide detailed views The top and free utilities provide detailed views of the “internals” of the systemof the “internals” of the system
Redirect output of the top and free commands Redirect output of the top and free commands to a disk file to use as input for a report to the to a disk file to use as input for a report to the system administratorsystem administrator
4545
Chapter SummaryChapter Summary
Run a program in the background by Run a program in the background by appending the & operator to the end of a appending the & operator to the end of a command linecommand line
The ps command displays all processes The ps command displays all processes currently runningcurrently running
The kill command terminates a specific The kill command terminates a specific processprocess
The utility that checks spelling, ispell, scans a The utility that checks spelling, ispell, scans a document for typing errorsdocument for typing errors
4646
Chapter SummaryChapter SummaryText formatting involves embedding typesetting Text formatting involves embedding typesetting commands in a file, and then processing the commands in a file, and then processing the the marked-up file with a program that the marked-up file with a program that generates commands for the output devicegenerates commands for the output device
The text containing the embedded typesetting The text containing the embedded typesetting commands is processed by a program like commands is processed by a program like nroff and troff that formats the outputnroff and troff that formats the output
Linux introduced groff, which implements the Linux introduced groff, which implements the features of both nroff anf trofffeatures of both nroff anf troff
Those who have supervisor privileges most Those who have supervisor privileges most often create man pagesoften create man pages