Changes

Jump to: navigation, search

Tutorial5: Redirection

68 bytes added, 08:54, 25 January 2020
INVESTIGATION 2: REDIRECTION USING PIPES
# Change to the '''~/redirect''' directory and confirm that you changed to this directory.<br><br>
# Issue the following Linux command to remove all files in your ''redirect'' directory: <span style="color:blue;font-weight:bold;font-family:courier;">rm *</span><br><br>NOTE: You will be issuing a pipeline command which will use the pipe symbol "|" that will send the stdout from a command as stdin into another command.<br><br>
# Issue the follow Linux pipeline command: <span style="color:blue;font-weight:bold;font-family:courier;">ls /bin | more</span><br><br>What happened?<br><br># Issue the following Linux pipeline command: <span style="color:blue;font-weight:bold;font-family:courier;">ls /bin | who</span><br><br>What happened? Why is the result different than antipated?[[Image:pipe-diagram-1.png|thumb|right|350px|]]<br><br>'''NOTE:''' When issuing pipeline commands, commands to the right of the pipe symbol must be designed to accept stdin. Since the who command does not, an error message was displayed.<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">cp /bin/?? > listing.txt</span><br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">sort listing.txt</span><br><br>
# Issue the following Linux command to remove the listing file: <span style="color:blue;font-weight:bold;font-family:courier;">rm listing.txt</span><br><br>
# Issue the following Linux pipeline command: <span style="color:blue;font-weight:bold;font-family:courier;">ls /bin/?? | sort</span><br><br>You should notice that the output from this pipeline command is the same output from the command you issued in '''step #6'''<br><br>
# Issue the '''ls''' command.<br><br>You should notice that no files have been created. Let's get practice issuing more pipeline commands using commands (previously learned or new) to be used as filters.<br><br>
# xIssue the following Linux pipeline command
13,420
edits

Navigation menu