1,576
edits
Changes
→Linux Command Structure
==Linux Command Structure==
The Bash shell in Matrix allows you to interact with your Matrix account Linux by issuing typing commands.
'''The General basic Linux Command Structure command structure is as follows:'''<br><span style="font-family:courier;color:blue;font-weight:bold">command argument1 argument2 ... </span>
'''What is an argument?''' An argument is used to change the default behaviour of a command. Arguments come in three major forms: # A command '''option'''.#* Example: <code>-l</code># A '''file pathname'''.#* Example: <code>/etc</code># A series of characters (i.e. '''text''') that the command can use.#* Example: <code>"Hello, world."</code> An '''argument''' is <u>must be separated</u> from a command (or and from other arguments) by whitespace (a '''SPACE''', '''MULTIPLE SPACES''' or a '''TAB''').<br><br>
'''Perform the Following Steps:'''
# Make certain Confirm that you are logged into your Matrix account.<br><br># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">pwd</span><br><br>#* '''Explanation:''' The output from this Linux command basically shows your '''current location''' in on the Matrix server(otherwise known as your '''p'''resent '''w'''orking '''d'''irectory).<br>This represents a '''directory pathname''' to your home directory. We will discuss ''pathnames'' later in this course.<br><br># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">ls</span><br><br>#* '''Question:''' What do you notice?<br><br>#* '''Answer:''' If there were are any files in your home directory, just only their file names would be are displayed.<br><br># Issue Change your directory location by issuing the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">cd /binetc</span><br><br># Issue the following Linux command to confirm your changed current location: <span style="font-family:courier;color:blue;font-weight:bold">pwd</span>#* '''Result:''' Your Linux session should display <brcode>/etc/<br/code>when running this command. If your output is different, retrace your steps to make sure you haven't skipped anything or had a typo in a command.# Issue the following Linux commandagain: <span style="font-family:courier;color:blue;font-weight:bold">ls</span><br><br>#* '''Question:''' What do you notice?<br><br>How is this different from the last time you ran it?# Issue Re-run the following Linux ls command using an '''option''': <span style="font-family:courier;color:blue;font-weight:bold">ls -l</span><br><br>#* '''Question:''' What do you notice?<br><br>#* '''Answer:''' The '''-l''' option combined with the '''ls''' command provides displays a '''detailed''' ("''long''") listing of the same files , providing you with more information on a separate line for about each file.<br><br>This is called metadata (data about data), and includes information such as last modified date, file size, ownership and permissions.# Issue the following Linux command to return Return to your home directory: <span style="font-family:courier;color:blue;font-weight:bold">cd</span><br><br># Issue the following Linux command Now confirm you've changed back to confirm your current locationhome directory: <span style="font-family:courier;color:blue;font-weight:bold">pwd</span>#* '''Result:''' The shell should display <brcode>/home/''yourusername''<br/code># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">ls /bin</span><br><br> # Issue the following Linux command to confirm your current location: <span style="font-family:courier;color:blue;font-weight:bold">pwd</span><br><br>#* '''Question:''' What do you notice?<br><br>#* '''Question:''' What makes this command with that argument useful if you are current located in your home directory?<br><br># Issue a Linux command that you have already learned to change to your '''home''' directory<br>and to '''confirm''' that you have returned to your home directory.<br><br># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">clear</span><br><br>#* '''Question:''' What do you notice? How would Why is this command be helpful?<br>#* '''FYITip:''' The short-cut shortcut keys to clear the screen for the Bash shell isare: <span style="font-family:courier;color:font-weight:bold">ctrl-l</span><br><br># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">who</span><br><br>#* '''Question:''' What information does this command show?<br><br>#* '''Answer:''' This command lists users that are logged into the same Matrix Linux server as yourself.<br>#* '''NOTE:''' Remember that the Matrix Linux cluster contains several servers, so it does not (or nodes). It won't display<br>all users that are logged onto those other machines within that into the cluster!<br><br>, only the ones on the same node as you. # Issue the following Linux command: <span style="color:blue;font-weight:bold">whoami</span><br><br>#* '''Question:''' What does this command display? #* '''Question:''' What do you think is the purpose of this command?<br><br># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">cal</span><br><br>#* '''Question:''' What is the purpose of does this commanddo?<br><br># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">cal 20212035</span><br><br>What #* '''Question:''' How and why is the purpose of this command using this argumentoutput different?<br><br># Issue the following Linux command: <span style="font-family:courier;color:blue;font-weight:bold">cal 2 20212035</span><br><br>#* '''Question:''' What is the purpose do each of this command using those two these numbers do?#* '''numbersQuestion:''' as What do you think would happen if you reversed the order of those arguments?<br><br>(i.e. cal 2035 2)
==Getting Help with Linux Commands==