Answered step by step
Verified Expert Solution
Question
1 Approved Answer
0 4 Activity Chapter 5 , Lab 2 : Standard Input / Output ( 1 5 Minutes ) Learning Objectives and Outcomes In this lab
Activity Chapter Lab : Standard InputOutput
Minutes
Learning Objectives and Outcomes
In this lab you will use cat, echo, and is to learn about standard input and standard output, including usinng cat to create a short file.
Reading
Read about standard input and standard output starting on Sobell, page up to the section on noclobber on page
Procedure
"The Keyboard and Screen as Standard Input and Standard Output" in Sobell explains how to use the cat utility to read from standard
input defaults to the keyboard and write to standard output defaults to the screen
Use cat as shown in Sobell to copy a few lines standard input to standard output.
Press CONTROLD on a line by itself to terminate cat.
Use echo builtin to copy the line comets are the best as its arguments to standard output which, by default, bash directs to the screen.
The cat utility sends the contents of a file specified by its argument to standard output.
Use cat on etchosts
Using the redirect operator, redirect standard output of echo on comets are the best to a file.
Use cat to display the contents of the file that should show the message.
As demonstrated in step when you do not specify an argument for cat, cat copies standard input to standard output.
Redirect standard input to cat to come from the file you created in the previous step.
Some utilities can take input either from a file or from standard input
tip The cat utility belongs to a class of utilities that can accept input from a file given as an argument step or if you do not specify an
argument, from standard input steps and Refer to "Utilities that take input from a file or standard input" on Sobell.
Redirect the output of a ls command to a file named lsout.
Use cat to display the contents of the file lsout.
The who utility Sobell lists the users who are logged in on the system.
Use the who Append the output Sobell of the who utility to the lsout file you created in the previous step.
Use cat to display the augmented lsout file.
Use cat to redirect standard output to create a file named days the names of the days of the week in chronological order, one per line.
Remember to press CONTROLD on a line by itself to exit from cat.
Use cat to read the days file and send it to standard output, through a pipeline, to standard input of the sort Sobell utility.
The result will be a list of days in alphabetical order.
Replace sort in the preceding command with grep Sobell with an argument of uppercase T
The result will be a list of days that have an uppercase in their names in chronological order.
Create a filter Sobell by repeating the preceding command, but sending standard output of grep through a pipeline to sort.
The result will be a list of days that have an uppercase in their names in alphabetical order.
Produce a long listing of the etcusrbin and sbin directories, sending the output to a file and running the commands in the
background Sobell
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started