Created Wednesday 22 January 2020
I didn't get a chance to show off how the terminal works, but let's see if you are able to explore on your own. This will NOT be graded "strictly," but I do need to see reasonable effort.
This exercise is designed to give you practice with the terminal/command line environment. Some of the below answers may change based on your particular distribution.
- Which distribution are you using? Is this using Virtualbox?
- Regardless of distribution, you should have access to a terminal program. On your own, figure out how to open it and do so. What is the name of this program in the menu? Once open, see if there is something like an "about" or "help" menu, that may reveal a different name. If different, what is it?
- Okay, time to type stuff. You probably aren't seeing a *completely* blank screen, there is likely information about "who" you are and "where" you are next to a flashing cursor. Specifically, what is it telling you?
For the following questions, it may be useful or necessary to refer to the class slides - ../LIS5364-LinuxAndTheShell.pdf
- What is the command to "list" files? Run it, and list the files and folders you see. (if this is not a "fresh" install, i.e. you've used it before, feel free to describe, instead)
- Next, run the listing command, but with the "-a" flag. You don't need to relist all the files, but you are probably seeing "more stuff." In your own words, try to figure out explain the purpose and result of the difference.
Let's make a new file, called test.txt, with a command-line editor. One command that you could use for this is the “touch” command. However, you can also simply type the name of the editor, then the name of the file. Let's use "nano" —
Type the following:
then enter. (you may presume an "enter" at the end of all future commands)
This opens the "nano" program. Do the following:
- Type "This is my local test file," no quotes.
- Save/Close the file. (You can get clues how to do this at the bottom. Here, the symbol "^" means the Control Key. So to save, first try Control-X for "Exit" then follow the prompts.
List the directory again, but this time with the “-al” option.
- How many bytes is test.txt? (hint: the number you're looking for is close to the date)
Lets get a bigger file; we'll use a very powerful command I did not cover at all.
First just try typing
on a line by itself. That will not actually "do" anything, but it will tell you what it went "wrong."
- What are you "missing" according to the error wget just produced?
- What is "man" short for, here? In a sentence or two, tell me what "wget" is/does.
Okay, next, type the following:
Once it's finished, first try
9. What is the difference between less and cat, based on what you've seen here?
Let's rename this file to something slightly more descriptive, but still short for us. How about fd.txt?
mv pg23.txt fd.txt
10. quick refresher question: mv can be used to either rename or ____ a file, because on the system they are the same thing?
Okay, lets use some basic commands to play around with this file a bit. A command we did see for a second in class is "sort"
- Before doing anything else, describe what just happened.
- BIG IMPORTANT CONCEPT HERE: Did the file itself change? Try to explain why or why not?