SlideShare una empresa de Scribd logo
1 de 12
Descargar para leer sin conexión
Laboratory Experiment III




 INPUT AND OUTPUT CONTROL
 by Alex Shaw III




 Unedited Version




April 5, 2005
TABLE OF CONTENTS

Introduction                ii

Laboratory Sheets          iii
Procedures                 iii

Data Sheets                1
Results                     1
   Basic Shell Operation    1
   Output Redirection       1
   Input Redirection        2
   Pipes                    2
   Tees                     2

Analysis                   3
Explanations                3
   Basic Shell Operation    3
   Output Redirection       3
   Input Redirection        4
   Pipes                    5
   Tees                     5
New Commands                6
References                  7




Input and Output Control     i
INTRODUCTION

                           This experiment involves working with redirection tools,
                           pipes, tees, and standard input and output. It focuses on
                           shell operations, input redirection, and output redirection.




Input and Output Control                                                              ii
1
                             LABORATORY SHEETS
LABORATORY EXPERIMENT III


                            Procedures




                                         continue on next page…




Input and Output Control                                     iii
Laboratory Sheets




Input and Output Control                       iv
2
                                                                                                      DATA SHEETS
LABORATORY EXPERIMENT III


                                                                    Results
                                                                    Below are results of the experiment, section-by-section;
Output 2-1 Results of the who command, displaying one user
currently logged-in to the system.
                                                                    additional remarks are in the Analysis section.

                                                                    A test directory (experiment3) was created to perform the
                                                                    procedures in this experiment.
                                                                    Basic Shell Operation
Output 2-2 Results of the date command.                             Using telnet and keyboard input, who (Output 2-1), ls -l,
                                                                    and date (Output 2-2) produced its output to the screen.
                                                                    Output Redirection
                                                                    After issuing the who > users, ls -l > list, and date > now
                                                                    commands, the ls -l (Output 2-3) command does not
Output 2-3 Results of the ls -l command.
                                                                    display the files—users, list, and day. Instead, it displays
                                                                    the files—users, list, and now, in ascending order.1

                                                                    Results of cat users, cat list, and cat now are show in
Output 2-4 Results of the cat users command.                        Output 2-4, Output 2-5, and Output 2-6.1

                                                                    The echo I am happy (Output 2-7) command issues
                                                                    output directly to the monitor. On the other hand,
                                                                    echo "I am happy" > xyz does not appear on the monitor.1

                                                                    The difference between cat testcase (Output 2-8) and
Output 2-5 Results of the cat list command.                         cat testcase > mycase are discussed in the Analysis
                                                                    section.




Output 2-6 Results of the cat now command.




Output 2-7 Results of the echo I am happy command.




Output 2-8 Results of the cat testcase command after creating the
testcase file with vi.
                                                                    1
                                                                        See the Analysis section for an in-depth explanation and additional information.



Input and Output Control                                                                                                                              1
Data Sheets




                                                                      Input Redirection1
                                                                      The wc -l users (Output 2-9) command displays the
                                                                      number of lines in the users file.
Output 2-9 Results of the wc -l users command.
                                                                      The wc -l < users (Output 2-10) command sends the
                                                                      number of lines in the users file to the wc -l command,
                                                                      which in turn displays 'only' the line count.

                                                                      The wc -l testcase (Output 2-11) command displays the
                                                                      number of lines in the testcase file.
Output 2-10 Results of the wc -l < users command.
                                                                      The wc -l < mycase2 (Output 2-12)command sends the
                                                                      number of lines in the mycase file to the wc -l command,
                                                                      which in turn displays 'only' the line count.
                                                                      Pipes1

Output 2-11 Results of the wc -l testcase command.                    Results of who | wc -l are shown in Output 2-13. It
                                                                      routes the results of who to wc -l, which in turn displays
                                                                      the number of lines generated by who.

                                                                      The who | sort > orderusers | wc -l1 displays results
                                                                      shown in Output 2-14.
Output 2-12 Results of the wc -l < mycase command.                    Tees
                                                                      The command
                                                                      who|grep ba(or bb)|tee classmates|wc -l>matenumber
                                                                      generates an error (Output 2-15)1.

Output 2-13 Results of the who | wc -l command.




Output 2-14 Results of the who | sort > orderusers | wc -l command.




Output 2-15 Results of the
who|grep ba(or bb)|tee classmates|wc -l>matenumber command.




                                                                      1
                                                                          See the Analysis section for more details.
                                                                      2
                                                                          The mycase file was created earlier with the cat testcase > mycase command.



Input and Output Control                                                                                                                           2
3
                                                                                ANALYSIS
LABORATORY EXPERIMENT III


                                               Explanations
                                               This section discusses any discoveries, including new
Output 3-1 Results of the cat users command.
                                               commands, and solutions used to resolve any errors
                                               encountered during the experiment.

                                               The steps below refer to the step of the particular section
                                               found on the lab sheets.
                                               Basic Shell Operation
Output 3-2 Results of the cat list command.
                                               Discovery—Step 1
                                               On the lab sheet, it appears as if who>users, ls-l>list, and
                                               date>now contain no spaces. After performing these
                                               commands, with and without spaces, it is determined that
                                               spaces are required between commands and options.
Output 3-3 Results of the cat now command.     However, spaces are not required between commands and
                                               delimiters, or delimiters and options. Therefore,
                                               who>users and date>now function using both methods;
                                               ls -l>list, on the other hand, requires a space between the
                                               ls command and the -l option.
                                               Output Redirection
                                               Error—Step 2
                                               After issuing who>users, ls -l>list, and date>now in
                                               Step 1, the question "Do you see the files users, list, and
                                               day?" after issuing the ls -l command was asked. The day
                                               file did not appear in the list. Perhaps day could had been
                                               mistaken for now.
                                               Explanation—Step 3
                                               The users file contains users who were logged in at the
                                               time the command who>users was issued (Output 3-1).

                                               The list file contains information on the directory
                                               contents obtained from the ls -l command (Output 3-2).

                                               The now file contains the day, month, time, region, and
                                               year, obtained from the date>now command (Output 3-3).

                                               Output from the cat command performed on the users,
                                               list, and now files did not send information to the monitor
                                               because the > delimiter was used.

                                               The > delimiter functions as an output redirection tool. It
                                               transfers the results of a command to a file.




Input and Output Control                                                                                     3
Analysis



                                                                    Explanation—Step 5
                                                                    The echo I am happy command sends output directly to
                                                                    the monitor (Output 3-4).

Output 3-4 Results of the echo I am happy command.                  The echo "I am happy">xyz command sends output to
                                                                    the xyz file.
                                                                    Below is a comparison between echo and cat as it
                                                                    pertains to the experiment:
                                                                    echo                                     cat
                                                                    Sends information to the                 Displays the contents of a file
Output 3-5 Results of the cat testcase command after creating the   monitor directly from                    to the screen
testcase file with vi.                                              keyboard input

                                                                    Can redirect output to a file            Can redirect output to a file

                                                                    Cannot accept input                      Can accept input redirection
                                                                    redirection

                                                                    Explanation—Step 8
Output 3-6 Results of the cat mycase command after issuing a
cat testcase > mycase command.
                                                                    The cat testcase command displays the contents of testcase
                                                                    (Output 3-5).
                                                                    The cat testcase>mycase command redirects output from
                                                                    cat testcase to the mycase (Output 3-6) file. It
                                                                    overwrites mycase if it exists; otherwise, it creates
                                                                    mycase. Thus, mycase contains the same information as
                                                                    testcase.

                                                                    The main difference between the two is that the first
                                                                    command outputs to the monitor and the second to a file.
                                                                    Input Redirection
                                                                    Explanation—Step 5
                                                                    The table below represents examples of input redirection:
                                                                    Command1               Explanation
                                                                    wc -l users            Displays the line count of the users file

                                                                    wc -l < users          Executes wc -l based on input redirection
                                                                                           from the users file, not the keyboard

                                                                    wc -l testcase         Displays the line count of the testcase file

                                                                    wc -l < mycase Executes wc -l based on input redirection
                                                                                   from the mycase file, not the keyboard

                                                                    The < delimiter represents input redirection. Instead of
                                                                    using the keyboard for input, the command receives its
                                                                    input from a file.

                                                                    1
                                                                        The results of these commands are on page 2.



Input and Output Control                                                                                                                       4
Analysis




                                                                     Pipes
                                                                     Explanation—Step 1
Output 3-7 Results of the who | sort > orderusers | wc -l command.   In who | wc -l, the results of who is transferred to wc -l,
                                                                     which in turn displays the numbers of lines generated by
                                                                     who.

                                                                     The | delimiter delivers the results of one command to be
                                                                     processed by another command.

Output 3-8 Results of cat orderusers after issuing the               Error—Step 3
who | sort > orderusers command.
                                                                     The command who | sort > orderusers | wc -l produces 0
                                                                     as a result (Output 3-7). However, this is an error because
                                                                     who | sort > orderusers returns the results shown in
                                                                     Output 3-8 and wc -l orderusers returns results shown in
                                                                     Output 3-9. Therefore, both results combined should sort
                                                                     orderusers in ascending order and display its line count.
Output 3-9 Results of the wc -l orderusers command.
                                                                     Pipes normally work with commands. The first pipe—
                                                                     who to sort works fine; however, the last pipe attempts to
                                                                     take the sorted orderusers file and pipe it to the wc -l
                                                                     command. To fix the problem, orderusers must be
                                                                     redirected into sort, then sort can be piped with wc -l
Output 3-10 Results of the who | sort < orderusers | wc -lcommand.
                                                                     because the pipes are generated between two commands.

                                                                     The correct syntax to achieve the desired result is,
                                                                     who | sort < orderusers | wc -l (Output 3-10).
                                                                     Error—Step 4
                                                                     Although an error message does not appear, the intended
                                                                     purpose of the who | sort > orderusers | wc -l>analyze is
                                                                     to transfer the results in Output 3-10 to the analyze file.
                                                                     The same solution is applied as in Step 3.

                                                                     The correct syntax to achieve the desired result is,
                                                                     who | sort < orderusers | wc -l>analyze.
                                                                     Tees
                                                                     Error—Step 2
                                                                     The who|grep ba(or bb)|tee classmates|wc -l>matenumber
                                                                     command makes an attempt to search for the string 'ba' or
                                                                     'bb' in the resulting who command. It then pipes the result
                                                                     in the classmates file. Finally, the tee results are piped to
                                                                     wc -l, which in turn stores the line count of classmates to
                                                                     matenumber.
                                                                     The correct syntax to achieve the desired result is,
                                                                     who|grep -E "ba|bb"|tee classmates|wc -l>matenumber1


                                                                     1
                                                                         Unix Manual Page for grep: http://www.scit.wlv.ac.uk/cgi-bin/mansec?1+grep



Input and Output Control                                                                                                                              5
Analysis




                           New Commands1
                           During the experiment, sort, grep, and tee were introduced.
                           Below is a brief explanation and syntax of each command:
                           Command Syntax                                   Explanation
                           sort         sort [option]… [file]…              Writes sorted
                                                                            information to standard
                                                                            output

                           grep         grep [option]… pattern [file]… Search for pattern in
                                                                       each file or standard
                                                                       input

                           tee          tee [option]… [file]…               Copy standard input to
                                                                            each file, and to the
                                                                            standard output




                           1
                               The syntax and explanation for each command is found using the help
                               option in the Bourne Again Shell. Example: tee --help



Input and Output Control                                                                              6
Analysis




                           References
                           1.   Sarwar, Syed Mansoor, Robert Koretsky, Syed
                                Aqeel Sarwar. Linux: The Textbook. Boston:
                                Addison Wesley Longman Inc., 2002.




Input and Output Control                                                        7

Más contenido relacionado

Destacado

android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
Layouts in android
Layouts in androidLayouts in android
Layouts in androidDurai S
 
Android networking in Hindi
Android networking in Hindi Android networking in Hindi
Android networking in Hindi Vipin sharma
 
Learn java in hindi
Learn java in hindiLearn java in hindi
Learn java in hindiVipin sharma
 
Android ui layout
Android ui layoutAndroid ui layout
Android ui layoutKrazy Koder
 
Operating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / OutputOperating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / OutputPeter Tröger
 
3 definition of operating systems
3 definition of operating systems3 definition of operating systems
3 definition of operating systemsmyrajendra
 
resource management
  resource management  resource management
resource managementAshish Kumar
 
Input output and storage devices activity
Input output and storage devices activityInput output and storage devices activity
Input output and storage devices activityshidabahri
 
Auditing In Computer Environment Presentation
Auditing In Computer Environment PresentationAuditing In Computer Environment Presentation
Auditing In Computer Environment PresentationEMAC Consulting Group
 
Functions Of Operating Systems
Functions Of Operating SystemsFunctions Of Operating Systems
Functions Of Operating SystemsAkshay Kurup
 
Operating system and its function
Operating system and its functionOperating system and its function
Operating system and its functionNikhi Jain
 
Operating system.ppt (1)
Operating system.ppt (1)Operating system.ppt (1)
Operating system.ppt (1)Vaibhav Bajaj
 
Operating system overview concepts ppt
Operating system overview concepts pptOperating system overview concepts ppt
Operating system overview concepts pptRajendraPrasad Alladi
 

Destacado (20)

android layouts
android layoutsandroid layouts
android layouts
 
Android Ui
Android UiAndroid Ui
Android Ui
 
Layouts in android
Layouts in androidLayouts in android
Layouts in android
 
Resume1
Resume1Resume1
Resume1
 
Android networking in Hindi
Android networking in Hindi Android networking in Hindi
Android networking in Hindi
 
10. resource management
10. resource management10. resource management
10. resource management
 
Learn java in hindi
Learn java in hindiLearn java in hindi
Learn java in hindi
 
Android ui layout
Android ui layoutAndroid ui layout
Android ui layout
 
Operating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / OutputOperating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / Output
 
3 definition of operating systems
3 definition of operating systems3 definition of operating systems
3 definition of operating systems
 
Android Lesson 2
Android Lesson 2Android Lesson 2
Android Lesson 2
 
resource management
  resource management  resource management
resource management
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Input output and storage devices activity
Input output and storage devices activityInput output and storage devices activity
Input output and storage devices activity
 
Auditing In Computer Environment Presentation
Auditing In Computer Environment PresentationAuditing In Computer Environment Presentation
Auditing In Computer Environment Presentation
 
Functions Of Operating Systems
Functions Of Operating SystemsFunctions Of Operating Systems
Functions Of Operating Systems
 
Operating system and its function
Operating system and its functionOperating system and its function
Operating system and its function
 
Operating system.ppt (1)
Operating system.ppt (1)Operating system.ppt (1)
Operating system.ppt (1)
 
Audit presentation
Audit presentationAudit presentation
Audit presentation
 
Operating system overview concepts ppt
Operating system overview concepts pptOperating system overview concepts ppt
Operating system overview concepts ppt
 

Similar a Input and Output Control

Shell Scripting With Arguments
Shell Scripting With ArgumentsShell Scripting With Arguments
Shell Scripting With ArgumentsTechronology Inc.
 
Shell Scripting With Arguments
Shell Scripting With ArgumentsShell Scripting With Arguments
Shell Scripting With ArgumentsAlex Shaw III
 
Olive Introduction for TOI
Olive Introduction for TOIOlive Introduction for TOI
Olive Introduction for TOIJohnson Liu
 
Printing And Metacharacters
Printing And MetacharactersPrinting And Metacharacters
Printing And MetacharactersAlex Shaw III
 
LAB3Lab 3 Answer Sheet(1).docxLiberty UniversityCSIS331La.docx
LAB3Lab 3 Answer Sheet(1).docxLiberty UniversityCSIS331La.docxLAB3Lab 3 Answer Sheet(1).docxLiberty UniversityCSIS331La.docx
LAB3Lab 3 Answer Sheet(1).docxLiberty UniversityCSIS331La.docxcroysierkathey
 
“Automation Testing for Embedded Systems”
“Automation Testing for Embedded Systems” “Automation Testing for Embedded Systems”
“Automation Testing for Embedded Systems” GlobalLogic Ukraine
 
Objectives- The objective of this Lab is to learn Laver 3 networking w.pdf
Objectives- The objective of this Lab is to learn Laver 3 networking w.pdfObjectives- The objective of this Lab is to learn Laver 3 networking w.pdf
Objectives- The objective of this Lab is to learn Laver 3 networking w.pdfacrylicBangles
 
ECET 380 Entire Course NEW
ECET 380 Entire Course NEWECET 380 Entire Course NEW
ECET 380 Entire Course NEWshyamuopuop
 
Licão 08 system redirects
Licão 08 system redirectsLicão 08 system redirects
Licão 08 system redirectsAcácio Oliveira
 
GEC21_DataPlanePerformanceCharacterization
GEC21_DataPlanePerformanceCharacterizationGEC21_DataPlanePerformanceCharacterization
GEC21_DataPlanePerformanceCharacterizationLong Tran
 
Micro c lab2(led patterns)
Micro c lab2(led patterns)Micro c lab2(led patterns)
Micro c lab2(led patterns)Mashood
 
Composing and Executing Parallel Data Flow Graphs wth Shell Pipes
Composing and Executing Parallel Data Flow Graphs wth Shell PipesComposing and Executing Parallel Data Flow Graphs wth Shell Pipes
Composing and Executing Parallel Data Flow Graphs wth Shell PipesVinoth Chandar
 
Algorithm-RepetitionSentinellNestedLoop_Solution.pptx
Algorithm-RepetitionSentinellNestedLoop_Solution.pptxAlgorithm-RepetitionSentinellNestedLoop_Solution.pptx
Algorithm-RepetitionSentinellNestedLoop_Solution.pptxAliaaAqilah3
 
Dynamic Analysis (EVO 2008)
Dynamic Analysis (EVO 2008)Dynamic Analysis (EVO 2008)
Dynamic Analysis (EVO 2008)Tudor Girba
 
Good news, everybody! Guile 2.2 performance notes (FOSDEM 2016)
Good news, everybody! Guile 2.2 performance notes (FOSDEM 2016)Good news, everybody! Guile 2.2 performance notes (FOSDEM 2016)
Good news, everybody! Guile 2.2 performance notes (FOSDEM 2016)Igalia
 
Ecet 340 Teaching Effectively--tutorialrank.com
Ecet 340 Teaching Effectively--tutorialrank.comEcet 340 Teaching Effectively--tutorialrank.com
Ecet 340 Teaching Effectively--tutorialrank.comSoaps97
 

Similar a Input and Output Control (20)

Shell Scripting With Arguments
Shell Scripting With ArgumentsShell Scripting With Arguments
Shell Scripting With Arguments
 
Shell Scripting With Arguments
Shell Scripting With ArgumentsShell Scripting With Arguments
Shell Scripting With Arguments
 
Olive Introduction for TOI
Olive Introduction for TOIOlive Introduction for TOI
Olive Introduction for TOI
 
Printing and Metacharacters
Printing and MetacharactersPrinting and Metacharacters
Printing and Metacharacters
 
Printing And Metacharacters
Printing And MetacharactersPrinting And Metacharacters
Printing And Metacharacters
 
LAB3Lab 3 Answer Sheet(1).docxLiberty UniversityCSIS331La.docx
LAB3Lab 3 Answer Sheet(1).docxLiberty UniversityCSIS331La.docxLAB3Lab 3 Answer Sheet(1).docxLiberty UniversityCSIS331La.docx
LAB3Lab 3 Answer Sheet(1).docxLiberty UniversityCSIS331La.docx
 
“Automation Testing for Embedded Systems”
“Automation Testing for Embedded Systems” “Automation Testing for Embedded Systems”
“Automation Testing for Embedded Systems”
 
Objectives- The objective of this Lab is to learn Laver 3 networking w.pdf
Objectives- The objective of this Lab is to learn Laver 3 networking w.pdfObjectives- The objective of this Lab is to learn Laver 3 networking w.pdf
Objectives- The objective of this Lab is to learn Laver 3 networking w.pdf
 
ECET 380 Entire Course NEW
ECET 380 Entire Course NEWECET 380 Entire Course NEW
ECET 380 Entire Course NEW
 
Ccnp labs
Ccnp labsCcnp labs
Ccnp labs
 
Licão 08 system redirects
Licão 08 system redirectsLicão 08 system redirects
Licão 08 system redirects
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
GEC21_DataPlanePerformanceCharacterization
GEC21_DataPlanePerformanceCharacterizationGEC21_DataPlanePerformanceCharacterization
GEC21_DataPlanePerformanceCharacterization
 
Micro c lab2(led patterns)
Micro c lab2(led patterns)Micro c lab2(led patterns)
Micro c lab2(led patterns)
 
Composing and Executing Parallel Data Flow Graphs wth Shell Pipes
Composing and Executing Parallel Data Flow Graphs wth Shell PipesComposing and Executing Parallel Data Flow Graphs wth Shell Pipes
Composing and Executing Parallel Data Flow Graphs wth Shell Pipes
 
Algorithm-RepetitionSentinellNestedLoop_Solution.pptx
Algorithm-RepetitionSentinellNestedLoop_Solution.pptxAlgorithm-RepetitionSentinellNestedLoop_Solution.pptx
Algorithm-RepetitionSentinellNestedLoop_Solution.pptx
 
Dynamic Analysis (EVO 2008)
Dynamic Analysis (EVO 2008)Dynamic Analysis (EVO 2008)
Dynamic Analysis (EVO 2008)
 
Good news, everybody! Guile 2.2 performance notes (FOSDEM 2016)
Good news, everybody! Guile 2.2 performance notes (FOSDEM 2016)Good news, everybody! Guile 2.2 performance notes (FOSDEM 2016)
Good news, everybody! Guile 2.2 performance notes (FOSDEM 2016)
 
Multisim8
Multisim8Multisim8
Multisim8
 
Ecet 340 Teaching Effectively--tutorialrank.com
Ecet 340 Teaching Effectively--tutorialrank.comEcet 340 Teaching Effectively--tutorialrank.com
Ecet 340 Teaching Effectively--tutorialrank.com
 

Más de Techronology Inc.

Using Google Analytics in T-Trendset 1.1
Using Google Analytics in T-Trendset 1.1Using Google Analytics in T-Trendset 1.1
Using Google Analytics in T-Trendset 1.1Techronology Inc.
 
Tutorial—In-cell Dropdown List with Challenge
Tutorial—In-cell Dropdown List with ChallengeTutorial—In-cell Dropdown List with Challenge
Tutorial—In-cell Dropdown List with ChallengeTechronology Inc.
 

Más de Techronology Inc. (7)

Using Google Analytics in T-Trendset 1.1
Using Google Analytics in T-Trendset 1.1Using Google Analytics in T-Trendset 1.1
Using Google Analytics in T-Trendset 1.1
 
Overview of T-Trendset 1.1
Overview of T-Trendset 1.1Overview of T-Trendset 1.1
Overview of T-Trendset 1.1
 
Dynamic Chart Switcher
Dynamic Chart SwitcherDynamic Chart Switcher
Dynamic Chart Switcher
 
Tutorial—In-cell Dropdown List with Challenge
Tutorial—In-cell Dropdown List with ChallengeTutorial—In-cell Dropdown List with Challenge
Tutorial—In-cell Dropdown List with Challenge
 
Linux Directory Structure
Linux Directory StructureLinux Directory Structure
Linux Directory Structure
 
Vi And Linux Environment
Vi And Linux EnvironmentVi And Linux Environment
Vi And Linux Environment
 
The Elevator
The ElevatorThe Elevator
The Elevator
 

Último

VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Alexander Turgeon
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
The Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementThe Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementNuwan Dias
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 

Último (20)

VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
The Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementThe Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API Management
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 

Input and Output Control

  • 1. Laboratory Experiment III INPUT AND OUTPUT CONTROL by Alex Shaw III Unedited Version April 5, 2005
  • 2. TABLE OF CONTENTS Introduction ii Laboratory Sheets iii Procedures iii Data Sheets 1 Results 1 Basic Shell Operation 1 Output Redirection 1 Input Redirection 2 Pipes 2 Tees 2 Analysis 3 Explanations 3 Basic Shell Operation 3 Output Redirection 3 Input Redirection 4 Pipes 5 Tees 5 New Commands 6 References 7 Input and Output Control i
  • 3. INTRODUCTION This experiment involves working with redirection tools, pipes, tees, and standard input and output. It focuses on shell operations, input redirection, and output redirection. Input and Output Control ii
  • 4. 1 LABORATORY SHEETS LABORATORY EXPERIMENT III Procedures continue on next page… Input and Output Control iii
  • 5. Laboratory Sheets Input and Output Control iv
  • 6. 2 DATA SHEETS LABORATORY EXPERIMENT III Results Below are results of the experiment, section-by-section; Output 2-1 Results of the who command, displaying one user currently logged-in to the system. additional remarks are in the Analysis section. A test directory (experiment3) was created to perform the procedures in this experiment. Basic Shell Operation Output 2-2 Results of the date command. Using telnet and keyboard input, who (Output 2-1), ls -l, and date (Output 2-2) produced its output to the screen. Output Redirection After issuing the who > users, ls -l > list, and date > now commands, the ls -l (Output 2-3) command does not Output 2-3 Results of the ls -l command. display the files—users, list, and day. Instead, it displays the files—users, list, and now, in ascending order.1 Results of cat users, cat list, and cat now are show in Output 2-4 Results of the cat users command. Output 2-4, Output 2-5, and Output 2-6.1 The echo I am happy (Output 2-7) command issues output directly to the monitor. On the other hand, echo "I am happy" > xyz does not appear on the monitor.1 The difference between cat testcase (Output 2-8) and Output 2-5 Results of the cat list command. cat testcase > mycase are discussed in the Analysis section. Output 2-6 Results of the cat now command. Output 2-7 Results of the echo I am happy command. Output 2-8 Results of the cat testcase command after creating the testcase file with vi. 1 See the Analysis section for an in-depth explanation and additional information. Input and Output Control 1
  • 7. Data Sheets Input Redirection1 The wc -l users (Output 2-9) command displays the number of lines in the users file. Output 2-9 Results of the wc -l users command. The wc -l < users (Output 2-10) command sends the number of lines in the users file to the wc -l command, which in turn displays 'only' the line count. The wc -l testcase (Output 2-11) command displays the number of lines in the testcase file. Output 2-10 Results of the wc -l < users command. The wc -l < mycase2 (Output 2-12)command sends the number of lines in the mycase file to the wc -l command, which in turn displays 'only' the line count. Pipes1 Output 2-11 Results of the wc -l testcase command. Results of who | wc -l are shown in Output 2-13. It routes the results of who to wc -l, which in turn displays the number of lines generated by who. The who | sort > orderusers | wc -l1 displays results shown in Output 2-14. Output 2-12 Results of the wc -l < mycase command. Tees The command who|grep ba(or bb)|tee classmates|wc -l>matenumber generates an error (Output 2-15)1. Output 2-13 Results of the who | wc -l command. Output 2-14 Results of the who | sort > orderusers | wc -l command. Output 2-15 Results of the who|grep ba(or bb)|tee classmates|wc -l>matenumber command. 1 See the Analysis section for more details. 2 The mycase file was created earlier with the cat testcase > mycase command. Input and Output Control 2
  • 8. 3 ANALYSIS LABORATORY EXPERIMENT III Explanations This section discusses any discoveries, including new Output 3-1 Results of the cat users command. commands, and solutions used to resolve any errors encountered during the experiment. The steps below refer to the step of the particular section found on the lab sheets. Basic Shell Operation Output 3-2 Results of the cat list command. Discovery—Step 1 On the lab sheet, it appears as if who>users, ls-l>list, and date>now contain no spaces. After performing these commands, with and without spaces, it is determined that spaces are required between commands and options. Output 3-3 Results of the cat now command. However, spaces are not required between commands and delimiters, or delimiters and options. Therefore, who>users and date>now function using both methods; ls -l>list, on the other hand, requires a space between the ls command and the -l option. Output Redirection Error—Step 2 After issuing who>users, ls -l>list, and date>now in Step 1, the question "Do you see the files users, list, and day?" after issuing the ls -l command was asked. The day file did not appear in the list. Perhaps day could had been mistaken for now. Explanation—Step 3 The users file contains users who were logged in at the time the command who>users was issued (Output 3-1). The list file contains information on the directory contents obtained from the ls -l command (Output 3-2). The now file contains the day, month, time, region, and year, obtained from the date>now command (Output 3-3). Output from the cat command performed on the users, list, and now files did not send information to the monitor because the > delimiter was used. The > delimiter functions as an output redirection tool. It transfers the results of a command to a file. Input and Output Control 3
  • 9. Analysis Explanation—Step 5 The echo I am happy command sends output directly to the monitor (Output 3-4). Output 3-4 Results of the echo I am happy command. The echo "I am happy">xyz command sends output to the xyz file. Below is a comparison between echo and cat as it pertains to the experiment: echo cat Sends information to the Displays the contents of a file Output 3-5 Results of the cat testcase command after creating the monitor directly from to the screen testcase file with vi. keyboard input Can redirect output to a file Can redirect output to a file Cannot accept input Can accept input redirection redirection Explanation—Step 8 Output 3-6 Results of the cat mycase command after issuing a cat testcase > mycase command. The cat testcase command displays the contents of testcase (Output 3-5). The cat testcase>mycase command redirects output from cat testcase to the mycase (Output 3-6) file. It overwrites mycase if it exists; otherwise, it creates mycase. Thus, mycase contains the same information as testcase. The main difference between the two is that the first command outputs to the monitor and the second to a file. Input Redirection Explanation—Step 5 The table below represents examples of input redirection: Command1 Explanation wc -l users Displays the line count of the users file wc -l < users Executes wc -l based on input redirection from the users file, not the keyboard wc -l testcase Displays the line count of the testcase file wc -l < mycase Executes wc -l based on input redirection from the mycase file, not the keyboard The < delimiter represents input redirection. Instead of using the keyboard for input, the command receives its input from a file. 1 The results of these commands are on page 2. Input and Output Control 4
  • 10. Analysis Pipes Explanation—Step 1 Output 3-7 Results of the who | sort > orderusers | wc -l command. In who | wc -l, the results of who is transferred to wc -l, which in turn displays the numbers of lines generated by who. The | delimiter delivers the results of one command to be processed by another command. Output 3-8 Results of cat orderusers after issuing the Error—Step 3 who | sort > orderusers command. The command who | sort > orderusers | wc -l produces 0 as a result (Output 3-7). However, this is an error because who | sort > orderusers returns the results shown in Output 3-8 and wc -l orderusers returns results shown in Output 3-9. Therefore, both results combined should sort orderusers in ascending order and display its line count. Output 3-9 Results of the wc -l orderusers command. Pipes normally work with commands. The first pipe— who to sort works fine; however, the last pipe attempts to take the sorted orderusers file and pipe it to the wc -l command. To fix the problem, orderusers must be redirected into sort, then sort can be piped with wc -l Output 3-10 Results of the who | sort < orderusers | wc -lcommand. because the pipes are generated between two commands. The correct syntax to achieve the desired result is, who | sort < orderusers | wc -l (Output 3-10). Error—Step 4 Although an error message does not appear, the intended purpose of the who | sort > orderusers | wc -l>analyze is to transfer the results in Output 3-10 to the analyze file. The same solution is applied as in Step 3. The correct syntax to achieve the desired result is, who | sort < orderusers | wc -l>analyze. Tees Error—Step 2 The who|grep ba(or bb)|tee classmates|wc -l>matenumber command makes an attempt to search for the string 'ba' or 'bb' in the resulting who command. It then pipes the result in the classmates file. Finally, the tee results are piped to wc -l, which in turn stores the line count of classmates to matenumber. The correct syntax to achieve the desired result is, who|grep -E "ba|bb"|tee classmates|wc -l>matenumber1 1 Unix Manual Page for grep: http://www.scit.wlv.ac.uk/cgi-bin/mansec?1+grep Input and Output Control 5
  • 11. Analysis New Commands1 During the experiment, sort, grep, and tee were introduced. Below is a brief explanation and syntax of each command: Command Syntax Explanation sort sort [option]… [file]… Writes sorted information to standard output grep grep [option]… pattern [file]… Search for pattern in each file or standard input tee tee [option]… [file]… Copy standard input to each file, and to the standard output 1 The syntax and explanation for each command is found using the help option in the Bourne Again Shell. Example: tee --help Input and Output Control 6
  • 12. Analysis References 1. Sarwar, Syed Mansoor, Robert Koretsky, Syed Aqeel Sarwar. Linux: The Textbook. Boston: Addison Wesley Longman Inc., 2002. Input and Output Control 7