Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

0 4 Activity Chapter 5 , Lab 2 : Standard Input / Output ( 1 5 Minutes ) Learning Objectives and Outcomes In this lab

04 Activity Chapter 5, Lab 2: Standard Input/Output
(15 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 133, up to the section on noclobber on page 139.
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 CONTROL-D 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 /etc/hosts
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 1, 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 2) or, if you do not specify an
argument, from standard input (steps 1 and 3). Refer to "Utilities that take input from a file or standard input" on Sobell.
Redirect the output of a ls -l command to a file named ls.out.
Use cat to display the contents of the file ls.out.
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 ls.out file you created in the previous step.
Use cat to display the augmented ls.out 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 CONTROL-D 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 T 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 T in their names in alphabetical order.
Produce a long listing of the /etc,/usr/bin, and /sbin directories, sending the output to a file and running the commands in the
background (Sobell).
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

How would your friends describe you?

Answered: 1 week ago