Individual Assignment 1 - Bash

Answer all bolded questions.

  1. First: Tell me about the current Linux install you are using; e.g. Raspberry Pi? A Virtual Installation? Which Distro?

  1. If you are not already in a terminal, go to one now. First, what is the name of YOUR terminal program?

Answer all of the following question using terminal tools only.

  1. What is the name of the command used to list files and folders in your current directory?

  1. What files and folders do you see?

5. Next, run the listing command, but with the "-a" flag. You don't need to name all the new/different things, but describe in a few words how this output differs from the last?

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," which you are overwhelmingly likely to have. If not, you will have to find another text editor, on your own.

Type the following:
nano test.txt
then enter.

Once inside, 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 command I covered briegly wget. First just try typing "wget" on a line by itself. That will not actually "do" anything. Next type "man wget."

6. In a sentence or two, tell me what "wget" is/does.

Okay, next, type the following:
wget "https://gutenberg.org/files/23/23-0.txt"

to get a file called 23-0.txt.

Once it's finished, first try
cat 23-0.txt

Next, try

less 23-0.txt
(hit q to get out of it)

  1. What is the difference between less and cat?

Let's rename this file to something slightly more descriptive, but still short for us. How about fd.txt?
type:
mv 23-0.txt fd.txt

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"

Try typing:
sort fd.txt

  1. Before doing anything else, describe what just happened.

Now, type

less fd.txt

  1. In your own words — is this a surprising result? Why or why not?

What if we actually wanted to "keep" the weird thing that came out when we did the sort command? We have to use a "redirect," to redirect the output of a command to something other than stdout (Standard Output)? Try this:

sort fd.txt > fdweird.txt

Now we have two files. Lets make some backups of them. Do:

cp fd.txt fd.bak
cp fdweird.txt fdweird.bak

Okay. Now: do that first command AGAIN:
sort fd.txt > fdweird.txt

  1. What happened?

Finally, do this slightly different command:
sort fd.txt >> fdweird.txt

  1. Review fdweird.txt (or perhaps try another ls -a) — what happened here?
  2. What is the difference between > and >>?

Another command we looked at is the sort command, which alphabetizes things; but lets try something a little different: As above, make a file that looks like the following. Name it numbers.txt

In it, type the following:

34
78
1001
12
30
4084

(each of these numbers, on its own line, with nothing else)

Next type
sort numbers.txt

  1. What happened? Does this look right? If not, give me the command in the format that does this "correctly."



Backlinks: FSU Courses:LIS3353