Open main menu

CDOT Wiki β

Changes

INVESTIGATION 3: QUOTING SPECIAL CHARACTERS
= INVESTIGATION 3: QUOTING SPECIAL CHARACTERS =
In this section, you will learn 3 three unique methods to quote special characters so they behave only like text.
:'''Perform the Following Steps:'''
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">echo hello there</span><br><br>'''NOTE:''' the '''echo''' command is used to display text onto your terminal.<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">echo * hello *</span><br><br>What happened? What is shown in addition to the text "hello". Why do you think those filenames are also being displayed?<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">echo \* hello\*</span><br><br>What do you notice? What does the \ character do?<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">echo "* hello *"</span><br><br>Is there a difference between this command and the previous command?<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">echo '* hello *'</span><br><br>Is there any difference between this command and the two previous commands?<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">echo $USER</span><br><br>'''NOTE''': '''USER ''' is an environment variable that stores the current user's login name. The '''$ ''' character immediately followed by the environment name causes it to expand to the value that the variable contains. Therefore the echo command displays the current login name of the user.<br><br>
# Issue the following Linux command (using single quotes): <span style="color:blue;font-weight:bold;font-family:courier;">echo '$USER'</span><br><br>What happened? Why is the output display like this?<br><br>
# Issue the following Linux command (using double quotes): <span style="color:blue;font-weight:bold;font-family:courier;">echo "$USER"</span><br><br>What happened? Why?<br><br>
# Let's use quoting special characters for a couple of other commands. Move to the '''lesson2''' directory. Confirm that you are currently located in the ''lesson2'' directory.<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">cp /bin/ls .</span><br><br>
# Issue the '''ls''' command to verify that there are copied files in your lesson2 directory.<br><br>'''NOTE: ''' Although it is NOT RECOMMENDED to create a filename using a special character (remember that file naming rule?), we will create an empty file called "*"<br><br>
# Issue the following Linux command (using single quotes): <span style="color:blue;font-weight:bold;font-family:courier;">touch '*'</span><br><br>
# Issue the '''ls''' command. Do you now see a file called "*" in addition to the other copied files?<br><br>
# Issue the following Linux command to remove the file called "*": <span style="color:blue;font-weight:bold;font-family:courier;">rm *</span><br><br>
# Issue the '''ls''' command to view the files in your current directory. What happened?!? <br>Why is it dangerous to use special characters when creating filenames?<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">cp /bin/ls .</span><br><br>
# Issue the following Linux command (using single quotes): <span style="color:blue;font-weight:bold;font-family:courier;">touch '*'</span><br><br>
# Issue the following Linux command (using single quotes): <span style="color:blue;font-weight:bold;font-family:courier;">rm '*'<br><br>
# Issue the '''ls''' command to confirm that the file called "*" has been in your current directory. What happened this time?<br><br>
# After you complete the Review Questions sections to get additional practice, then work on your '''online assignment 1 ''' and complete the '''remaining''' sections 3 to 6 labelled: '''Directory Management''' , '''Practice Commands To Create A Directory Structure''' , '''Create A Directory Structure''' and '''Practice Specifying Path Names'''. When you have completed these remaining sections, and you main menu indicates you have completed 6 out of 6 sections, then you will have successfully completed your assignment #1.<br><br>
= LINUX PRACTICE QUESTIONS =
13,420
edits