Open main menu

CDOT Wiki β

Changes

Tutorial5: Redirection

1,481 bytes removed, 20:35, 4 September 2023
no edit summary
{{Admon/caution|DO NOT USE THIS VERSION OF THE LAB. This page will no longer be updated.|'''New version here:''' https://seneca-ictoer.github.io/ULI101/A-Tutorials/tutorial5<br />'''Andrew's students please go here:''' http://wiki.littlesvr.ca/wiki/OPS145_Lab_5}}=USING REDIRECTIONSREDIRECTION: STANDARD INPUT / STANDARD OUTPUT / STANDARD ERROR=
<br>
===Main Objectives of this Practice Tutorial===
:* xUnderstand and use the '''cut''', '''tr''', and '''wc''' Linux commands
:* xDefine the terms '''Standard Input''' (''stdin''), '''Standard Output''' (''stdout''), and '''Standard Error''' (''stderr'')
:* xUnderstand and use the '''>''', '''>>''', '''2>''', '''2>>''' symbols with Linux commands
:* xUnderstand the purpose of the the '''/dev/null''' file and the '''Here Document'''
:* xDefine the term '''pipeline command''' and explain how a pipeline command functions
:* xDefine the term '''filter''' and how it relates to pipeline commands
:* xUse the '''semicolon''' ";" and '''grouping''' "( )" symbols to issue multiple Unix / Linux commands on a single line :* Use the '''backslash''' "\" symbol to spread-out long Unix/Linux commands over multiple lines<br>
===Tutorial Reference Material===
|colspan="2" style="font-size:16px;font-weight:bold;border-bottom: thin solid black;border-spacing:0px;"|Course Notes<br>
|colspan="2" style="font-size:16px;font-weight:bold;border-bottom: thin solid black;border-spacing:0px;padding-left:15px;"|Linux Command/Shortcut Reference<br>
|colspan="1" style="font-size:16px;font-weight:bold;border-bottom: thin solid black;border-spacing:0px;padding-left:15px;"|YouTube Videos<br>
|- valign="top" style="padding-left:15px;"
|colspan="2" |Course Notes'''Slides:'''<ul><li>Week 5 Lecture 1 Notes:<br>[https://ictwiki.cdot.senecacollege.ca/~uli101/notesslides/Week01ULI101-5.1.pdf PDF] | [https://ictwiki.cdot.senecacollege.ca/~uli101/notesslides/Week01ULI101-5.1.pptx PPTX]</li></ulli>TutorialsWeek 5 Lecture 2 Notes:<ul><libr>[https://wiki.cdot.senecacollege.ca/uli101/slides/ULI101-5.2.pdf PDF] | [HOWTOhttps: Access Your Matrix Account]//wiki.cdot.senecacollege.ca/uli101/slides/ULI101-5.2.pptx PPTX]<br></li><li/ul>  | style="padding-left:15px;" |'''Redirection:'''* [http://www.linfo.org/standard_input.html Standard Input (stdin)]* [http://czegelwww.comlinfo.org/senecastandard_output.html Standard Output (stdout)]* [http:/uli101/lectureswww.linfo.org/Lecture1standard_error.html Les Czegel's Week 1 Notes Standard Error (HTMLstderr)]* [http://www.linfo.org/pipe.html Pipeline Commands]</libr><br>'''Multiple Commands:'''* [https:/ul/www.javatpoint.com/linux-semicolon Semicolon]<br>Windows SSH client Software* [https://www.gnu.org/software/bash/manual/html_node/Command-Grouping.html Grouping ( )]<ulbr><br>| style="padding-left:15px;"|'''Redirection Filters:'''* [http://man7.org/linux/man-pages/man1/more.1.html more] , [http://man7.org/linux/man-pages/man1/less.1.html less]<libr>* [http://wwwman7.org/linux/man-pages/man1/head.sfsu1.eduhtml head] , [http:/ftp/winman7.org/sshlinux/SSHSecureShellClientman-3pages/man1/tail.21.9html tail]* [http://man7.exe SSHorg/linux/man-pages/SFTPman1/sort.1.html sort]<br>* [http://man7.org/linux/man-pages/man1/li>uniq.1.html uniq]<libr>* [http://thelinuxcommand.earthorg/lc3_man_pages/grep1.lihtml grep]<br>* [http://%7Esgtathamman7.org/puttylinux/latestman-pages/x86man1/puttycut.1.exe Puttyhtml cut]<br>* [http://linuxcommand.org/lilc3_man_pages/tr1.html tr]<br>* [http://man7.org/linux/man-pages/man1/wc.1.html wc]<libr>* [httpshttp://wwwman7.bitvise.comorg/linux/sshman-clientpages/man1/tee.1.html tee]<br> |colspan="1" style="padding-download Bitvise SSH Client]left:15px;" width="30%"|'''Brauer Instructional Videos:'''</liul><li>[https://mobaxtermwww.mobatekyoutube.netcom/downloadwatch?v=ocU34PcYn2U&list=PLU1b1f-home2Oe90TuYfifnWulINjMv_Wr16N&index=4 Reading/Writing to Files<br>(echo, stdin, stdout, stderr, >, >>, 2>, cat, more, less, man, date, diff, diff -edition.html MovaXtermy, find, wc])<br></li></ul>|} = KEY CONCEPTS = ===Additional File Manipulation Commands=== Before proceeding, let's look at some additional commands used to manipulate content of text files.
Refer to the table below regarding these text file manipulation commands:
<br><br>
[[Image:manipulation-commands.png|left|700px|]]
<br><br><br><br><br><br><br><br><br>
| style="padding-left:15px;" |Logging Out of Matrix Server*[https://ss64.com/bash/logout.html logout , exit]<br>*[https://www.quora.com/What-is-the-difference-between-typing-Ctrl+C-and-Ctrl+D-in-the-Linux-terminal &lt;ctrl&gt;&lt;d&gt;]<br>Account Access*[http://man7.org/linux/man-pages/man1/passwd.1.html passwd]<br>Shell Command Line Editing*[https://www.ostechnix.com/list-useful-bash-keyboard-shortcuts/ Bash Shell Shortcut Keys]<br>| style="padding-left:15px;"|General Linux Commands*[http://man7.org/linux/man-pages/man1/pwd.1.html pwd]<br>*[http://man7.org/linux/man-pages/man1/cd.1p.html cd]<br>*[http://man7.org/linux/man-pages/man1/ls.1p.html ls]<br>*[http://man7.org/linux/man-pages/man1/cal.1.html cal]<br>*[http://man7.org/linux/man-pages/man1/date.1.html date]<br>*[http://man7.org/linux/man-pages/man1/who.1.html who] =Redirection (Standard Input, [http://man7.org/linux/man-pages/man1/w.1.html w]<br>*[http://man7.org/linux/man-pages/man1/whoami.1.html whoami Standard Output,who am i]<br>*[http://man7.org/linux/man-pages/man1/clear.1.html clear , &lt;ctrl&gt;&lt;l&gt;]<br>Standard Error)===
<i>'''Redirection''' can be defined as changing the way from where commands read input to where commands sends output.<br>You can redirect input and output of a command.</i>
Reference: https://www.javatpoint.com/linux-input-output-redirection
|colspan="1" style="padding-left:15px;" width="30%"|Brauer Instructional Videos:<ul><li>[https[Image://wwwstdin-symbol.youtube.compng|thumb|right|250px|The '''standard input''' ('''stdin''') symbol that describes where a Unix/watch?v=BEH6i_BKOBo&list=PLU1b1f-2Oe90TuYfifnWulINjMv_Wr16N&index=2&t=0s Connecting to Matrix Using SSH Client, Starting the Assignments, and Running UBUNTU Within Windows 10Linux command receives '''input''']]'''Standard input''' ('''stdin''') is a term which describes from where a command receives '''input'''.<br>This would apply only to Unix/Linux commands that accept stdin input<br></li><li>[https://www.youtube.com/watch?v=3wZmZOKLllk&list=PLU1b1f-2Oe90TuYfifnWulINjMv_Wr16N&index=2 Linux File System(like ''cat'', ''more'', ''less'', ''sort'', ''grep'', ''head'', ''tail'', Basic Navigation (ls''tr'', cd''cut'', pwd''wc'', treeetc.), Absolute and Relative Paths].</li></ulbr>
|}''Examples:''
<span style= KEY CONCEPTS ="font-family:courier;font-weight:bold">tr 'a-z' 'A-Z' < words.txt<br>cat < abc.txt<br>sort < xyz.txt</span>
<table align===Purpose "right"><tr><td>[[Image:stdout-symbol-1.png|thumb|right|250px|The '''standard out''' ('''stdout''') symbol with one greater than sign '''overwrites''' existing file content with command output]]</td><td>[[Image:stdout-symbol-2.png|thumb|right|250px|The '''standard output''' ('''stdout''') symbol with two greater than signs '''add''' command's output to '''bottom''' of Having existing file's contents.]]</td></tr></table>'''Standard output''' ('''stdout''') describes where a command sends its '''output'''.<br>In the examples below, output from a Matrix Account===command is sent to the '''monitor''', unless it is sent to a '''text file'''.
While attending Seneca College, you will be using many different computer systems to perform various operations.
Some of these servers include:
{|width="100%" cellspacing="0"''Examples:''
|-| <span style="paddingfont-leftfamily:0pxcourier;widthfont-weight:10%bold" |'''my>ls -l<br>ls -l > detailed-listing.senecacollegetxt<br>ls /bin >> output.ca'''| style="padding-left:15px;width:65%" |Learning Content Management System (Student Grades / Notes txt</ Online Quizzes)span>
|-
| style="padding-left:0px;width:10%" |'''ict.senecacollege.ca'''
| style="padding-left:15px;width:65%" |Main ICT Webserver
|-| style<table align="paddingright"><tr><td>[[Image:stderr-leftsymbol-1.png|thumb|right|250px|The '''standard error''' ('''sterr''') symbol with one greater than sign '''overwrites''' existing file content with command's '''error message'''.]]</td><td>[[Image:0px;width:10%" stderr-symbol-2.png|thumb|right|250px|The '''standard error'wiki'' ('''stderr''') symbol with two greater than signs '''add''' command's error message to '''bottom''' of existing file's contents.cdot]]</td></tr></table>'''Standard Error''' ('''stderr''') describes where a command sends it's error messages.senecacollege.caIn the examples below we issue the pwd in capitals on purpose to generate an error message, which can be redirected to a '''text file'''| style="padding-left:15px;width:65%" |Course WIKIs for Seneca College Students.
|-
| style="padding-left:0px;width:10%" |'''matrix.senecacollege.ca'''
| style="padding-left:15px;width:65%" |Linux Account for Student Practice and Assignment submission
|}''Examples:''
<span style="font-family:courier;font-weight:bold">PWD<br>PWD 2> error-message.txt<br>PWD 2 >> error-messages.txt<br>PWD 2> /dev/null</span>
<br><br>
[[Image:cli-prompt.png|thumb|right|120px|A '''shell''' is an interface ====The / interpreter to allow a user to communicate with the Linux computer system. ]]Although you need to study concepts throughout this course, you will also need to learn to '''issue and memorize simple as well as more advanced Linux commands'''. This requires that you practice issuing Linux commands on a frequent basis to become more comfortable when working the Unix and '''Linux command-line environments'''.dev/null File====
Just like with other operating systems like MS Windows, it is important to learn how to '''open a command prompt in order to issue commands to perform common tasks'''. In Unix/Linux, a '''shell''' is simply an interface / interpreter to allow a user to communicate with the Linux computer system (server). Linux shells have evolved (improved) over a period of time. You will be using the '''Bash Shell''' which is considered to be user-friendly. By understanding how to issue Linux commands, you can create a file consisting of Linux commands and programming techniques called a '''shell script''' (learned later in this course) to automate tasks to make you a more productive user and administrator.
===Layout of The '''/dev/null''' file (sometimes called the Matrix Server===[[Image:matrix-layout.png|thumb|right|350px|The Matrix server consists of several Virtual Computers all connected together to form a '''clusterbit bucket''' or '''black hole'''. A cluster ) is a special system file<br>that '''cost effectivediscard''' all alternative data written into it. This is useful to larger serversdiscard unwanted command output. ]]
The Matrix server consists of '''several Virtual Computers connected together''' to form a '''cluster'''. A cluster is a '''cost effective''' alternative to buying larger servers.
All registered students in this course should have an account on the Matrix server.You will be using this account for the following reasons''Examples:''
<span style="font-family:* Issuing '''Linux commands''':* Becoming productive using the Linux '''command prompt''' ('''shell'''):* Performing '''Linux Practice Tutorials''':* Performing '''Linux Assignments''' ('''3''')courier;font-weight:* Practice Issuing '''Linux Command Review Questions'''bold;">LS 2> /dev/null<br>ls > /dev/null<br>find / -name "tempfile" 2> /dev/null</span> <br><br>
In the next investigation, you will learn how to '''connect''' to and '''login''' to your Matrix server account both at a '''college lab workstation''' and from a remote computer such as your '''home computer''' or your '''laptop computer'''.<br><br>====The Here Document====
=INVESTIGATION 1: ACCESSING YOUR MATRIX LINUX ACCOUNT=
[[Image:Here Document.png|thumb|right|175px|The '''Here Document''' allows a user to redirect stdin from <u>within<br/u>the command itself.]]In this sectionLinux, you will learn how the '''Here Document''' allows a user to access your Matrix Linux account by two different methods:redirect stdin from within the command itself.
:* From a <u>workstation</u> '''within''' a '''Seneca College lab'''Example:* From your <u>own</u> computer '''within''' or '''outside''' '''Seneca College''' <br><br>
<span style===Part 1"font-family: Access your Matrix Account from a Seneca College Lab ===[[Imagecourier;font-weight:apps-anywhere-main-window.png|thumb|right|250px|'''MyApps''' ('''AppsAnywhere''') Main Window ]]You will learn how to connect to your Matrix Linux account from a workstation in your computer labs at Seneca college.bold">cat <<+<br>Line 1<br>Line 2<br>Line 3<br>+<br><br>
This would be useful if you do not have a notebook computer and are required to use one of the workstations available in your Seneca computer lab.===Pipeline Commands===
[[Image:pipe-diagram-1.png|thumb|right|450px|A '''MyAppspipeline command''' (sends a command's '''standard output''' directly to '''AppsAnywherestandard input'''of other command(s) is an application streaming service that lets you install software on any Seneca PC on demandwithout having to create temporary files. Any software application on the MyApps menu can be used on computers in classrooms, labs, and the Computing Commons]]'''Pipeline Command:''' Having commands send their '''standard output''' <u>directly</u> to '''standard input''' of other commands WITHOUT having to use '''temporary''' files.
Reference: https://insidePipes that are used in a '''pipeline command''' are represented by the '''pipe''' "|" symbol.senecacollege.ca/its/software/myapps/<br>
A few simple commands can be '''combined''' to form a more <u>powerful</u> command line.<br>
You will now use MyApps on your Windows workstation in your Seneca lab room to launch an application<br>to allow you to connect and login to your Matrix server account.
[[Image:apps-anywhere.png|thumb|right|250px|Several SSH applications will appear. We will use the application called '''SSH Client''' for this practice tutorial. ]]
Commands to the '''right''' of the pipe symbol are referred to as '''filters'''. They are referred to as ''filters'' since those commands are used to '''modify''' the stdout of the <u>previous command</u>. Many commands can be "piped" together, but these commands (filters) must be chained in a specific order, depending on what you wish to accomplish
'''Perform the Following Steps:'''
# Start your workstation in your lab and login to your Seneca Windows account.<br><br># Make certain that the '''MyApps''' window is open. This window should have opened shortly after you logged into your Windows workstation. If the application windows is not open, click on the '''MyApps'Examples:'' icon on the desktop to launch).<br><br>[[Image:ssh-main-window.png|thumb|right|150px|SSH Client Application Window ]]# Click on the '''Search Apps''' area located in the top right corner of the MyApps window and type the word: <span style="colorfont-family:bluecourier;font-weight:bold">ssh</span><br><br># Several SSH applications will appear. <br><br>'''NOTE:''' All of these applications allow you to connect to your Matrix account.<br>We will use the application called '''SSH Secure Shell Client''' for this practice tutorial.<br><br># Launch the '''SSH Secure Shell Client''' application icon to launch this program.<br><br>[[Image:quick-connectls -window.png|thumb|right|150pxal |Quick Connect Dialog Box ]]'''NOTE:''' Prior to launching the application, you can add this to your '''favourites''' which will make it fastermore<br>to access this application in the future.<br><br> # The main SSH Client window will appear. Click on the '''Quick Connect''' button.<br><br>'''NOTE:''' The Connect dialog box allows the user to specify the '''server name''' and your '''account name'''<br>to allow you to connect to the server.<br><br># Click on the textbox labelled Hostnanme and enter the text: <span style="color:blue;fontls | sort -weight:bold">matrix</span><br><br>'''NOTE:''' You can use the hostname '''matrix''' since you are located <u>inside</u> Seneca's network.<br>If you where located <u>outside</u> Seneca's network, then you would need to enter the full domain name: '''matrix.senecac.on.ca'''r<br>ls | sort | more<br>[[Image:sharels -publicl | cut -key.png|thumb|right|150px|Dialog Box to Share Public Key on Remote Server ]]# When connecting securely for the '''first time''', a dialog box will appear to share a d"public key" with your Matrix account in order to make your interaction between your workstation and the remote Linux server secure within the network (i.e. encrypted to prevent unauthorized access by other users)<br><br>'''FYI:''' To make communications over a network secure, a computer generates '''two keys''': a '''private key''' that is kept on the computer, and a '''public key''', which can be shared with other computers. Transmissions from your computer uses the private key to encrypt (scramble) transmission to the remote computer, which in turn, uses the public key to decrypt (unscramble) the transmission. Likewise, the remote computer uses the public key to encrypt (scramble) transmissions and your computer uses the private key to decrypt (unscramble) those transmissions.<br><br>[[Image:ssh-password-prompt.png|thumb|right|150pxf2 |Password Dialog Box ]]# Click the '''Yes'tr '' button to share your public key.<br><br># Next, a dialog box will appear prompting you for your Matrix account password in order to gain entry to your Matrix account. Your Matrix password is identical to your Seneca password. As you type the password, the text will be blocked-out or hidden to prevent others from viewing the screen to obtain your password[[Image:ssh-authentication-response.png|thumb|right|150px|Authentication Response Dialog Box ]]<br><br># Enter your password and click z'''OK''' or press '''ENTER'''<br>A-z"<br>[[Image:ssh-login-error.pngls |thumb|right|150pxgrep Linux |SSH Login Error ]]# Click '''OK''' or press '''ENTER''' at the '''Authentication Response''' dialog box.<br><br>'''NOTE:''' If you encounter an '''error message''', this can occur for several reasons:<ol><li>You mis-spelled the '''name of the server'''</li><li>You mishead -spelled your Matrix '''username''' (same username that you connect to my.senecacollege.ca)</li><li>You have '''CAPS LOCK''' on by mistake (your username should be '''lowercase''' only).</li><li>You mis-spelled your '''password''' (same password that you connect to my.senecacollege.ca)</li></ol><br>If you encountered an error logging in, issue the same steps to connect to your Matrix account,5<br>but carefully check your server name, username and your password. If you continue to experience the same problems,<br>you can go to the computer help desk in the learning commons to get help.<br><br>[[Image:sshhead -shell7 filename | tail -window.png|thumb|right|150px|Matrix Shell Command Line Interface ]]#If you entered your password correctly, the main SSH Linux shell should appear where you enter Linux commands.<br><br>The '''Matrix''' server has been configured to allow users to '''only interact with the Linux OS by issuing commands'''. There are various reasons for this, but the main 2 reasons are to '''force students to learn how to issue Linux commands''' as well as '''limitations to remote access to a graphical Linux server''' due to large number of users (students).<br><br/span>Later in the course, your instructor may demonstrate other ways of accessing '''graphical versions of Linux''', and how to launch a shell terminal.<br><br>[[Image:ssh-settings-window.png|thumb|right|150px|SSH Settings Dialog Box ]]
You can '''configure''' the SSH application to adjust elements such as the '''window size''' and '''text font type''' and text '''font size'''. We will be showing you how to configure your SSH Secure Shell Client, but the other applications can allow you to configure their settings.<br><br>====The tee Command====
'''Perform the Following Steps:'''
# Click on the [[Image:tee-diagram-1.png|thumb|right|250px|The '''Edittee''' menu item, and then select utility can be used to '''Settingssplit''' the flow of information. For example to save in the Edit drop-down menua file as well as display on a screen.<br><br>(Image licensed under [https://creativecommons.org/licenses/by-sa/3.0/ cc])]]# To change the size of your shell window, under the The ''Global Settings'' section, click '''Appearancetee''' utility can be used to <bru>split<br/u># Change the flow of ''window size'standard output''' both horizontal and vertical to larger values.<br><br># To change the font size, under the between a '''text file'Global Settings'' section, click and the '''Fontterminal screen'''.<br><br># Select a larger The '''font sizetee'' and click 'option ''OK'-a'''<br><br># You now should notice that you have customized your SSH shell terminal. You can use the settings screen be used to add content to also change your background and text colours if you are interested in doing so.<br><br># To exit your Matrix session, type the following command and press ENTER: <span style="color:blue;font-weight:bold">exit</span><br><br>'''NOTE:bottom''' You should notice that the colour of the text changes slightly when disconnected and you are unable to issue Linux commands from that window.<br><br># After you have disconnected from your account, close the SSH Secure Shell Client application window.an existing file<br><br># It is recommended as opposed to repeat these steps with connecting to your Matrix account from a Seneca lab workstation until you become comfortable with ''overwriting'' the processfile's previous contents.<br><br>
In The reason for the name "'''tee'''" is that the splitting of the next section, you will learn how to connect to your Matrix server account from flow of information resembles a different computer<br>(for example: your laptop computer at Seneca College or your computer at home)capital T.<br><br>
===Part 2: Access your Matrix Account From your own computer within or outside the Seneca College Network ===
You will learn how to connect to your Matrix Linux account from your own computer whether it be a '''laptop''' computer or your '''home computer'Examples:''<span style="font-family:courier;font-weight:bold">ls | tee unsorted.txt | sort<br>ls | grep Linux | tee matched.txt | more<br>ls | head -5 | tee -a listing.txt</span><br><br>
This would ===Multiple Commands Using Semicolon, Grouping, and Backquotes=== Besides piping, there are other ways that multiple commands may be useful if you want to access your Matrix Linux account on your own computer to practice Linux placed in one line:<br>commands or perform your assignment outside of the scheduled classmay be separated by '''semi-timecolons'''.<br>
We will be learning to use a different SSH application called "'''Putty'''". In this way, you will be exposed to a few SSH applications to help you decide which SSH application you are most comfortable.
:'''Perform the following steps:'''# Click on the following link to download the Putty executable file:<br>http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe[[Image:putty-application-icon.png|thumb|right|70px|Putty Application Icon ]]<br><br>'''NOTE:''' If you are interested in downloading and installing other SSH applications (including the<br>SSH Secure Shell Client application used in part 1), refer to week 1 links in the ULI101 Weekly Schedule.<br><br># The putty executable file does <u>not</u> install the Putty program: Instead, run this program, by opening a file manager, moving to the '''Downloads''' directory and double-clicking on the '''putty.exe''' file.<br><br>[[Image:putty-configuration-window.png|thumb|right|250px|Putty Configuration Window ]]# The Putty configuration window will appear.<br><br>You can '''configure''' the SSH application to adjust elements such as the '''window size''' and '''text font type''' and text '''font size'''. We will be showing you how to configure your SSH Secure Shell Client, but the other applications can allow you to configure their settings.<br><br># To change the size of your shell window, click '''Window'''<br><br># Change the '''rows''' and '''columns''' to larger values.<br><br># To change the font size, under the ''Window'' section, click '''Appearance'''<br><br># In the left window under '''Font Settings''', click the '''Change''' button.<br><br># Select a larger ''font size'' and click '''Apply'''<br><br># You will return to the Putty Configuration window.<br><br># To login to your Matrix Linux account, click on '''Sessions'''<br><br># In the Host Name sectionand enter the textExample: <span style="color:blue;font-weight:bold">matrix</span><br><br>'''NOTE:''' You can use the hostname '''matrix''' since you are located <u>inside</u> Seneca's network.<br>If you where located <u>outside</u> Seneca's network, then you would need to enter the full domain name: '''matrix.senecac.on.ca'''<br><br>[[Image:putty-login-window.png|thumb|right|350px|Login to Matrix Server ]]# Click on the '''Open''' button and the Putty session window should appear.<br><br># Enter your '''username''' when prompted.<br><br># Enter your '''password''' when prompted.<br><br>[[Image:putty-public-key.png|thumb|right|250px|Dialog Box to Share Public Key on Remote Server ]]# When connecting securely from the putty application for the '''first time''', a dialog box will appear to share a "public key" with your Matrix account in order to make your interaction between your workstation and the remote Linux server secure within the network (i.e. encrypted to prevent unauthorized access by other users)<br><br># Click the '''Yes''' button to share your public key.<br><br>'''NOTE:''' If you encounter an '''error message''', this can occur for several reasons:<ol><li>You mis-spelled the '''name of the server'''</li><li>You mis-spelled your Matrix '''username''' (same username that you connect to my.senecacollege.ca)</li><li>You have '''CAPS LOCK''' on by mistake (your username should be '''lowercase''' only).</li><li>You mis-spelled your '''password''' (same password that you connect to my.senecacollege.ca)</li></ol><br>If you encountered an error logging in, issue the same steps to connect to your Matrix account,<br>but carefully check your server name, username and your password. If you continue to experience the same problems,<br>you can go to the computer help desk in the learning commons to get help.<br><br>[[Image:putty-shell-window.png|thumb|right|250px|Putty Shell Command Line Interface ]]# If you followed the login sequence correctly, the Putty Shell window will appear where you can issue Linux commands.<br><br># To exit your Matrix session, type the following command and press ENTER: <span style="color:blue;font-weight:bold">exit</span><br><br>'''NOTE:''' You should notice that the Putty application window will disappear.<br><br># It is recommended to repeat these steps with connecting to your Matrix account from a Seneca lab workstation until you become comfortable with the process.<br><br>
In the next investigation, you will learn how to issue Linux commands and how to setup and perform the first two sections of the online ULI101 assignment #1.<brspan style="font-family:courier;font-weight:bold">sleep 5; ls<br/span>
=INVESTIGATION 2: USING THE LINUX SHELL / ONLINE ASSIGNMENTS =
<br>In this section, you will learn how to use the Linux ShellMultiple commands can also be '''grouped''' by using parentheses. Topics in the section include:
:* Learn the '''Linux command structure''' (arguments and options)
:* Learn how to get '''help''' for Linux commands with manpages ('''man''' command).
:* Learn '''Basic Shell Editing'''
:* Learn how to perform '''online assignments'''.
:* Perform the '''first two sections of online assignment #1'''.<br><br>
===Part 1''Example: Using the Linux Shell ===''
The Bash shell in Matrix allows you <span style="font-family:courier;font-weight:bold">(echo "Who is on:"; w) > whoson</span><br>('''''Note:''' <u>all</u> command output is sent to interact with your account by issuing commands.a file'')
Some Linux commands can be issued by entering the Linux command line without arguments (e.g. '''pwd''', '''date''', '''ls''', '''cal'''),<br>but some Linux commands can be issued with arguments (e.g. '''cal 2002''', '''cd /bin''', '''ls -la''' ).<br><br>
Commands may also be '''Linux Command Structurespread-out over multiple lines''', making it easier (for humans) to interpret a long command.<br><br>The '''\''' symbol “''quotes-out''” the meaning of the '''ENTER''' key as <u>text</u><br> (i.e. ''new-line'' as instead of ''running'' the command).
<span style="color:blue;font-weight:bold">command argument1 argument2 ... </span>
An ''Example:'argument''' can be a '''pathname''', '''text''', '''option''', etc.
For example<span style="font-family:courier;font-weight:* The '''ls''' bold">echo "This will be split over multiple \<br>lines. Note that the shell will realize \<br>that a pipe requires another command displays a listing of filenames in , so \<br>it will automatically go to the current directory* The '''ls /bin''next line" |tr ' command displays [a listing of filenames in the /bin directory (as opposed to your current directory)* The '''ls -l''' command displays a detailed listing of filenames in the current directory* The 'z]''ls [A-l /bin''Z]' command displays a details listing of files in the </bin directoryspan><br><br>
=INVESTIGATION 1: BASICS OF REDIRECTION=
<span style="color:red;">'''Getting Help with Linux CommandsATTENTION''': This online tutorial will be required to be completed by '''Friday in week 6 by midnight''' to obtain a grade of '''2%''' towards this course</span><br><br>
With the Linux OS containing over In this investigation, you will learn how to redirect '''standard input''', '''2500standard output''' commands and utilities, it is good for a '''standard error''' when issuing Unix / Linux user or sysadmin to learn about how to use commands “on-the-fly”.
The '''man''' command can provide information on how to use a command (i.e. '''usage''', '''arguments''', '''options''', '''examples''').<br>The commands are classified into sections or “volumes”.
'''Perform the Following Steps:'''
# Make certain that '''Login''' to your matrix account and issue a command to '''confirm''' you are logged into located in your Matrix account'''home''' directory.<br><br># Issue the following Linux commandto create the following directory: <span style="color:blue;font-weight:bold;font-family:courier;">man manmkdir ~/redirect</span><br>How many volume numbers are contained <br># Change to the '''~/redirect''' directory and confirm that you changed to that directory.<br><br># Use a text editor to create a file in the man pages (like your current directory called '''data.txt'''executable commandsand enter the following text displayed below:<br><br><span style="font-family:courier;font-weight:bold">This is line 1<br>This is line 2<br>This is line 3</programsspan><br><br># '''Save', ''editing changes and 'games''exit', or ''the text editor.<br><br># Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">tr 'system administrator commandsa-z''A-Z')< data.txt</span><br><br>What does this command do?<br><br># Press Issue the letter following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">qtr 'a-z' 'A-Z' < data.txt > output.txt</span> to exit <br><br>What does this command do? What are the contents of the file ''output.txt''?<br><br># Issue the man following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">tr 'a-z' 'A-Z' > output.txt < data.txt</span><br><br>What does this command do? Is there any difference in terms of this command and the previous command issued?<br><br># Issue the following Linux command : <span style="color:blue;font-weight:bold;font-family:courier;">tr 'a-z' 'A-Z' >> output.txt < data.txt</span><br><br>What happens to get help with the command: content of the '''lsoutput.txt'''file? Why?<br><br># Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">tail -2 < data.txt > output.txt</span><br><br>What does this command do? Check the contents of the '''NOTE:output.txt''' You can use file to confirm.<br><br># Issue the following shortLinux command: <span style="color:blue;font-weight:bold;font-family:courier;">tail -cut keys within 2 > output2.txt < data.txt </span><br><br>Why does this command render the same results as the previous command?<br>Try explaining how the man command to works in terms of '''stdin''' and then '''stdout'''.<br><br>help navigate throughout this utility to get help with # Issue the ls following Linux command (refer to table create a file: <span style="color:blue;font-weight:bold;font-family:courier;">cat > output3.txt </span><br><br># Enter the follow text displayed below):<br><br><table cellpaddingspan style="3font-family:courier;font-weight:bold;">This is the file output3.txt</span><br><trbr># Press <th span style="bordercolor:blue;font-weight:bold;font-bottomfamily: 1px solid blackcourier;">Keyboard Shortcutctrl-d</thspan> to exit the command.<br><th br># Issue the '''cat''' command to view the contents of the file: '''output3.txt'''<br><br># Issue the following Linux command: <span style="bordercolor:blue;font-weight:bold;font-bottomfamily: 1px solid blackcourier;">Purpose<cp ~jason.carman/uli101/th>cars .</trspan><trbr><tdbr># Issue the '''cat''' command to view the contents of the '''ENTERcars'''file.<br><br># Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">cut -c1-10 cars</tdspan><tdbr>Move down one line<br>What did this command do?<br><br># Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">cut -f5 cars > field5.txt</tdspan></trbr><trbr>What did this command do?<tdbr>Check the contents in the file '''SPACEBARfield5.txt'''to see what happened.<br><br># Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">cut -f1-3 cars > field123.txt</tdspan><br><br>What did this command do? (check file contents)<tdbr>Move one screen down<br># Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">cut -f1,5 cars > field15.txt</tdspan><br><br>What did this command do? (check file contents)<br><br># Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">wc cars >count.txt</trspan><trbr><tdbr>What information does the '''count.txt'''&ltfile contain?<br><br># Issue the following Linux command: <span style="color:blue;ctrl&gtfont-weight:bold;&lt;f&gtfont-family:courier;">wc -l cars > count1.txt</span><br><br>What information does the '''count1.txt'''file contain?</tdbr><tdbr>Move one screen up# Issue the following Linux command: </tdspan style="color:blue;font-weight:bold;font-family:courier;">wc -w cars >count2.txt</trspan><trbr><tdbr>What information does the '''/pattern/count2.txt'''file contain?</tdbr><tdbr>Search for Pattern# Issue the following Linux command: </tdspan style="color:blue;font-weight:bold;font-family:courier;">ls -l >listing.txt</trspan><trbr><tdbr>What information does the '''qlisting.txt'''file contain?</tdbr><tdbr>quit man utility# Issue the following Linux command: </tdspan style="color:blue;font-weight:bold;font-family:courier;">pwd >listing.txt</trspan></tablebr><br># Navigate through What happenned to the man utility for original contents of the file called '''lslisting.txt''' ? Why?<br><br># Issue the following Linux command and note (use 2 greater-than signs): <span style="color:blue;font-weight:bold;font-family:courier;">date >> listing.txt</span><br><br>What information does the option letters that correspond to '''listing.txt''' file contain? Why?<br><br># Issue the followingLinux command:<span style="color:blue;font-weight:bold;font-family:courier;">cat listing.txt cars > combined.txt</span><br><ulbr>What information does the '''combined.txt''' file contain? Why?<libr>Include directory entries whose names begin with <br>'''NOTE''': The '''cat''' command stands for "'''concatenate'''" which means to '''combine''' contents of multiple files into a dotsingle file.</libr>This is why the command is called "''cat''".<libr>List in long format</libr># Issue the following Linux command: <lispan style="color:blue;font-weight:bold;font-family:courier;">cat listing.txt cars murray 2>Recursively list subdirectories encounteredresult.txt</lispan><br><libr>Sort files by sizeWhat is displayed on the monitor? What information does the '''result.txt''' file contain? Why?</libr><libr>Display a slash (`# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">cat listing.txt cars murray > myoutput.txt 2> /dev/') immediately after each pathname that is a directorynull</lispan></ulbr><br># Exit What is displayed on the man utility for monitor? What happened to the ls command.error message?<br><br># Issue the ls following Linux command for each of : <span style="color:blue;font-weight:bold;font-family:courier;">cat listing.txt cars murray > myoutput.txt 2> result.txt</span><br><br>What is displayed on the monitor? what do those option letters you wrote down to see how this command differs for each option.files contain? Why?<br><br>NOTE: The '''manHere Document''' utility can be used allows you to redirect stdin from with the Linux command itself. Let'''-k''' option to help list Linux commands that match a text pattern that is contained within s get some practice using the Here Document.<br><br># Issue the help screen for a following Linux command.:<br><span style="color:blue;font-weight:bold;font-family:courier;">cat <<+<br>line 1<br>line 2<br>line 3<br>+</span><br><br>What do you notice?<br><br># Although we will not be learning about pipeline commands (using the | character) until later, try issuing Issue the following pipeline Linux command: <br><span style="color:blue;font-weight:bold;font-family:courier;">man -k copy | grep 82 <<+<br>line 1<br>line 2<br>line 3<br>+</span><br><br>What do you notice? How does this this pipeline command make it easier to obtain information regarding man differ from the previous command? Why?<br><br># If you wish to change your password, you can change it by issuing Issue the following Linux command: <br><span style="color:blue;font-weight:bold;font-family:courier;">passwdgrep 2 > line2.txt <<+<br>line 1<br>line 2<br>line 3<br>+</span><br><br>What do you notice? What option for is contained in the passwd command can be used to change user info (such as name)file '''line2.txt'''? Why?<br><br>'''HintNOTE:''' use You will now run a shell script to confirm that you properly issued Linux commands using redirection.<br><br># Issue the manpages for following Linux command to run a checking script:<br><span style="color:blue;font-weight:bold;font-family:courier;">~uli101/week5-check-1</span><br><br># If you encounter errors, make corrections and '''re-run''' the passwd commandchecking script until you receive a congratulations message, then you can proceed.<br><br># Issue the '''NOTE:ls''' You are NOT required command to change your Matrix password for this tutorialsee all of the '''temporary files''' that were created as a result of redirection. <br><br>The Matrix server problem with using these redirection symbols is that you create '''temporary text files''' that take up '''space''' on your file system.<br><br># Issue a Linux command (using '''Filename Expansion''') to '''remove''' those temporary text files in the current directory.<br><br># Issue the following Linux command to check that you removed ALL of those temporary text files:<br><span style="synchedcolor:blue;font-weight:bold;font-family:courier;" with >~uli101/week5-check-2</span><br><br># If you encounter errors, make corrections and '''re-run''' the mychecking script until you receive a congratulations message, then you can proceed.senecacollege.ca server<br><br> :In the next investigation, so it is better you will be learning how to have your Matrix password changed at the same time that you change your myseneca passwordissue '''pipeline Linux commands''' which can<br>accomplish tasks <u>without</u> creating temporary files.<br><br> =INVESTIGATION 2: REDIRECTION USING PIPELINE COMMANDS = In this investigation, you will learn to issue '''pipeline commands''' to to accomplish tasks <u>without</u> having to generate temporary files.
'''Command Line Editing'''
Learning '''shortcut keys''' in any OS terminal will allow you to be more productive as a sysadmin. You will focus on learning a few common Bash Shell keyboard shortcut keys
and learn where you can access online help for additional shortcuts (if required).
'''Perform the Following Steps:'''
# Type Confirm that you are still located in the '''~/redirect''' directory.<br><br>The '''problem''' with creating temporary files, is that they take up space on your server,<br>and should be removed. You actually did that in the previous investigation.<br><br>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<br><u>without</u> having to create temporary files.<br><br># Issue the following follow Linux '''pipeline command, but DON’T press the ENTER key''': <span style="color:blue;font-weight:bold;font-family:courier;">cd ls /bin| more</span><br><br>What happened? Press '''q''' to exit display.<br><br># Press Issue the following Linux '''pipeline command''': <span style="color:blue;font-weight:bold;font-family:courier;">ctrl-als /bin | who</span> key combination. <br><br>What happenshappened?Although this pipeline command provides output,<br>it '''does <u>not</u> work''' properly as a pipeline command 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># Press Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">alt-Fls /bin/?? > listing.txt</span> key combination (ESC+F for Mac OSx). What happens?<br><br># Press Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">ctrl-wsort listing.txt</span> shortcut. What happens?<br><br># Type Issue the following Linux commandto remove the listing file: <span style="color:blue;font-weight:bold;font-family:courier;">lsrm listing.txt</span><br><br># Press Issue the following Linux '''pipeline command''': <span style="color:blue;font-weight:bold;font-family:courier;">ctrl-els /bin/?? | sort </span> key combination and press <br><br>You should notice that the output from this pipeline command is the same output<br>from the command you issued in '''step #5'''.<br><br># Issue the following Linux '''pipeline command''': <span style="color:blue;font-weight:bold;font-family:courier;">ENTERls /bin/?? | sort | more</span><br><br>What is difference with this pipeline command as opposed to the <u>previous</u> pipeline command? Press '''q''' to exit display.<br><br># Press Issue the up arrow key'''ls''' command.<br><br>You should notice that '''no files have been created'''.<br>Let's get practice issuing more pipeline commands using commands<br>(previously learned or new) to be used as '''filters'''. What happens?<br><br># Press Issue the following Linux '''pipeline command''': <span style="color:blue;font-weight:bold;font-family:courier;">ctrlls /bin/?? | sort | head -u5</span> key combination. <br><br>What happensdid you notice?<br><br># Press Issue the following Linux '''pipeline command''': <span style="color:blue;font-weight:bold;font-family:courier;">up arrowls /bin/???? | sort | grep r | tail -2</span> key combination, and see what happens when <br><br>What did you notice? Could you press predict the output prior to issuing this pipeline command?<br><br># Issue the following Linux '''pipeline command''': <span style="color:blue;font-weight:bold;font-family:courier;">BACKSPACEls /bin/???? | sort | grep r | cut -c1-6</span> , <span style="color:blue;fontbr><br>Try to explain step-by-weight:bold"step each process in the pipeline command (including ''filters'')<br>to explain the final output from this pipeine command.<br>&lt;ctrl&gt;&lt;BACKSPACE&gt;<br># Confirm that you are still located in the '''~/spanredirect''' directory.<br><br># Issue the following Linux '''pipeline command''':<br> and <span style="color:blue;font-weight:bold;font-family:courier;">&lt;ctrl&gt;&lt;h&gt;ls /bin/???? | tee unsort.txt | sort | tee sort.txt | grep r | tee match.txt | head </span>. Why is it important <br><br># Issue the '''ls''' command to know those series view the contents of key combinationsthis redirectory.<br><br>What did you notice?<br><br># Press View the <span style="color:blue;font-weight:bold"u>ctrl-contents</u> of the '''text files''' that were created to see how the '''tee''' command<br>was used in the previous pipeline command.</spanbr><br>What was the purpose of using the '''tee''' command for this pipeline command?<br><br> key combination You will now run a shell script to clear confirm that you properly issued that Linux pipeline command<br>using the line'''tee''' command and redirection.<br><br># Press Issue the following Linux command to run a checking script:<br><span style="color:blue;font-weight:bold;font-family:courier;">ctrl~uli101/week5-check-l3</span> key combination. What happens? What is <br><br>If you encounter errors, make corrections and '''re-run''' the advantage of using this key combination checking script until you receive<br>a congratulations message, then issuing you can proceed.<br><br># Change to <u>your</u> '''home''' directory.<br><br># Remove the '''clear~/redirect''' command?directory and its contents.<br><br>
===Part 2: Performing Online Assignments ===In the next investigation, you will learn various techniques to issue '''multiple Linux commands'''<br>on the same line, or issue a '''single Linux command over multiple lines'''.<br><br>
You are required to perform '''=INVESTIGATION 3 online assignments''' during this course. This online assignment is used to teach and reinforce Linux commands are techniques as well as using Linux commands to perform tasks and tests students on their knowledge of issuing Linux commands.: ISSUING MULTIPLE UNIX/LINUX COMMANDS=
In this sectioninvestigation, you will learn to '''select the correct section''' for your online assignments, how to perform the '''first two sections''' of assignment #1, how to '''verify''' that you successfully completed both sections, and how to '''exit''' your online assignment #1issue multiple Unix / Linux commands in a single line or over multiple lines.
<br>'''Perform the following stepsFollowing Steps:'''[[Image:assign-initial-window.png|thumb|right|250px|Initial Assignment Window to Allow Student to Select Correct Course Section. ]]# In Confirm you are located in your '''home''' directory in your Matrix account, issue .<br><br># Issue the following Linux commands (using the ''semicolon'' character "''';'''" to separate <u>each</u> Linux command):<br><span style="color:blue;font-weight:bold;font-family:courier;">~uli101/assign1cal;pwd;date</span><br><br># A screen similar to Note the one displayed on output as well as the right will appear.<bru>order<br/u><span style="color:red;">'''WARNING''': You need to select the CORRECT section for the course which you belong toof what each Linux command results.<br>If you do NOT select your correct section, your assignment may not be recorded for marks!</span><br><br># Select Issue the '''letter(s)''' corresponding to the <u>correct</u> '''ULI101 section''' and '''professor''' and press following Linux commands: <span style="color:blue;font-weight:bold;font-family:courier;">ENTER(cal;pwd;date)</span><br><br># After you have selected your course section, There will be a screen that provides several important notes before proceedingWas there any difference in the output of this command as opposed to the previous command?<br><br>Let's see how grouping affects working with redirection.<br>Please take a few moments to read those notes and press <br># Issue the following Linux commands: <span style="color:blue;font-weight:bold;font-family:courier;">ENTERcal;pwd;date > output.txt</span> to proceed.<br><br>[[Image:assn-section-completion.png|thumb|right|250px|Main Assignment Window to View Which Sections Need to be Completed. ]]# The assignment main menu will then be displayed.<br><br>What happened? Where is the output for the '''NOTES:date'''command?<ulbr><li>Near Why isn't the bottom of output for the window, you will see '''"You are currently registered to"''' followed by the '''section lettercal''' and '''instructor namepwd'''. Double-check your course timetable to confirm commands are NOT contained in that this the correct section letter. If you have selected the WRONG section, type <span style="color:blue;font-weight:bold">C</span> in the menu selection area and press <span style="color:blue;font-weight:bold">ENTER</span>. You will return back to the original window to select your correct course section.file?<br><br></li><li>Near # Issue a Linux command to view the top contents of the window displays the sections to complete in the assignment. You are NOT required to complete all sections at the same time. You can check the assignment #1 link on the ULI101 main WIKI page to note the due date for assignment #1. Sections that are NOT completed will be displayed in file called '''reverse text with a blue backgroundoutput.txt'''. On the other hand, when you compete a section, then the section will appear as regular text<br>(i.e not in reverse text).<br>What do you notice?<br>[[Image:assn-completed-window.png|thumb|right|250px|Main Assignment Window to Confirm Which Sections Have or Have Not Been Completed. ]]</libr><li>If you want to verify that you have completed sections for the assignment, look for the text Let's use '''"Marks earned so far for ULI101 Assignment:"grouping''' and it will show how many sections have been completed. When it shows all sections completed, then your assignment is finished and you should receive full marks provided that you have selected your correct course section.to make modification to the previous command<br><br></li></ul># At Issue the menu assignment #1 window, enter following Linux commands: <span style="color:blue;font-weight:bold;font-family:courier;">1(cal;pwd;date) > output.txt</span> in <br><br>What did you notice?<br><br># Issue a Linux command to view the menu selection area to begin contents of the first section file called '''"Introduction to Unix Commands"output.txt'''.<br><br># When you have completed this section, you will be returned to the main window.What does ''grouping'' do when issuing multiple Linux commands (separated by a semi-colon ";") that uses redirection?<br>View the contents of this window to confirm that you completed this section.<br># Issue the following Linux pipeline command (using \ at the end of most lines):<br># When you have time this week, enter <span style="color:blue;font-family:courier;font-weight:bold">2echo "This will be split over multiple \</spanbr> in lines. Note that the menu selection area to begin the first section called '''"Basic Unix Commands"'''.shell will realize \<br>that a pipe requires another command, so \<br># When you have completed this section, you it will be returned automatically go to the main window.next line" |tr '[a-z]' '[A-Z]'<br/span>View the contents of this window to confirm that you completed this section.<br><br>'''NOTE:''' Although you are NOT allowed to use reference sheets for course evaluations, it Did the command work? What is recommended to create one for your personal use, and write down the purpose of issuing a Linux commands, their arguments and options, so your can successfully perform quizzes, midterm exam, and final exam.command in this way?<br><br># Proceed to Complete the next section Review Questions sections to perform get additional practice. Linux is about "doing"! The more practice questions you perform, the better mark you will achieve for this course and have a better foundation of issuing Linux commands to be more productive in your future courses.<br><br>
= LINUX PRACTICE QUESTIONS =
simulate a quiz:
https://ictwiki.cdot.senecacollege.ca/~murray.saululi101/uli101files/uli101_week1_practiceuli101_week5_practice.docx
Your instructor may take-up these questions during class. It is up to the student to attend classes in order to obtain the answers to the following questions. Your instructor will NOT provide these answers in any other form (eg. e-mail, etc).
 
When answering Linux command questions, refer to the following Inverted Tree Diagram. The linux directory is contained in your home directory. Assume that you just logged into your Matrix account. Directories are <u>underlined</u>.
 
[[Image:week5-dir.png|thumb|left|300px|]]
 
<br><br><br><br><br><br><br><br><br>
'''Review Questions:'''
# What is Write a single Linux command to provide a detailed listing of all files in the '''/etc''' directory, sending the output to a file called listing.txt in the “'''Linux Clusterprojects'''”? What is an advantage of using directory (append output to existing file and use a Linux cluster?relative pathname)# List Write a single Linux command to redirect the stderr from the command:<br>'''three unique server namescat a.txt b.txt c.txt''' at Seneca college and briefly explain to a file called '''error.txt''' contained in the purpose of that server“'''assignments'''” directory. (overwrite previous file’s contents and use only relative pathnames) # List the steps to connect and login to your Matrix Write a single Linux server account from a command: '''workstationcat ~/a.txt ~/b.txt ~/c.txt''' in and redirect stdout to a computer lab at Seneca Collegefile called “good.# List txt” to the steps to connect “tests” directory and login stderr to your Matrix Seneca College account on your a file called “'''laptopbad.txt''' or your ” to the “'''home computertests'''” directory. (overwrite previous contents for both files and use only relative-to-home pathnames).# List 3 unique ways Write a single Linux command to redirect the stdout from the command:<br>'''cat a.txt b.txt c.txt''' to a file called wrong.txt contained in the “'''log-outprojects''' of your Matrix account ” directory and throw-out any standard error messages so they don’t appear on the screen (not including closing the SSH window or applicationappend output to existing file and use only relative pathnames).<br><br># What is the difference between Write a single Linux '''pipeline command''' to display a detailed listing of the '''projects''' directory but pause one screen at a time to view and an argument?navigate through all of the directory contents. Use a relative-to-home pathname.# What is the purpose of Write a single Linux command '''optionpipeline command'''?# What characterto display the sorted contents (sin reverse alphabetical order) is used to of the “'''separatelinux''' commands and arguments?” directory. Use a relative pathname.# Create a Assume that the text file called “'''table.answers.txt''' listing each ” contains 10 lines. Write a single Linux pipeline command, useful options that were mentioned in the online assignment to only displays lines 5 through 8 for this file. Use only relative pathnames.#1 and Write a single Linux '''pipeline command purpose for ''' to only display the contents of the “'''assignments'''” directory whose filenames match the following pattern “'''murray'''” (both upper or lowercase). Use an absolute pathname.# Write a single Linux commands: '''pwdpipeline command''' , to display the number of characters contained in the file called “'''cd.answers.txt''' , ”. Use a relative-to-home pathname.# Write a single Linux '''lspipeline command''' , to display the number of lines contained in the file called “'''calquestions.txt''' , ”. Use a relative pathname.# Write a single Linux '''datepipeline command''' to display only the first 10 characters of each filename contained in your current directory. Also, there is will be a lot of output, so also pause at each screenful so you can navigate throughout the display contents. Use a relative pathname.# Create a '''whotable''' listing each Linux command, useful options that were mentioned in this tutorial for the following Linux commands: '''wcut''' , '''whoamitr''' , '''who am Iwc''' , and '''cleartee'''.   _________________________________________________________________________________ Author: Murray Saul License: LGPL version 3Link: https://www.gnu.org/licenses/lgpl.html _________________________________________________________________________________ 
[[Tutorial2: Unix / Linux File Management]]
[[Category:ULI101]]