Open main menu

CDOT Wiki β

Changes

Tutorial5: Redirection

315 bytes removed, 13:12, 3 February 2021
INVESTIGATION 2: REDIRECTION USING PIPELINE COMMANDS
'''Perform the Following Steps:'''
# Confirm that you are still located in the '''~/redirect''' directory.<br><br># Issue the '''ls''' command to view the contents of your '''~/redirect''' directory.<br><br>The '''problem''' with creating temporary files, is that they take up space on your server,<br>and should be removed.<br><br># Issue You actually did that in the following Linux command to remove all temporary files in your ''redirect'' directory: <span style="color:blue;font-weight:bold;font-family:courier;">rm ~/redirect/*</span><br>and confirm that you have removed those files for that directoryprevious investigation.<br><br>'''NOTE:''' You will be issuing a '''pipeline command''' which will use the pipe symbol "|"<br>that will send the stdout from a command as stdin into another command without having to create temporary files.<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? This won't work since the '''who''' command is<br>'''NOT''' designed to accept standard input.[[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 <u>accept</u> '''standard input'''. Since the ''who'' command does not, you did NOT see the contents of the '''/bin''' directory but only information relating to the ''who'' command. Therefore, the '''order''' of which you build your pipeline command and the '''type of command''' that is used as a ''filter'' is extremely important!<br><br>
13,420
edits