Lecture 7

Review For Midterm

Eric Brauer


The Midterm will be 90 minutes long, and will cover anything in the summaries at the end of each lecture.

You should be comfortable with:

Review questions can be found at the end of Lecture 3B and Lecture 5B. The ULG also has a comprehensive midterm review that you might find useful.

Additionally, here are yet even more review questions that you might find useful:

  1. Convert the decimal number 217 to octal.

    0331

  2. What is 0xDEC in binary?

    1101 1110 1100

  3. How do you know if a file or directory is hidden? How would you list these files and directories?

    Hidden files and directories start with . and you can see them using ls -a.

  4. What find command will match all files on the filesystem that are called report2018 or report2019?

    find / -iname report201[89]

  5. How can you read from a file called cars, convert everything to upper-case, and redirect that into a file called CARS?

    cat cars | tr ‘a-z’ ‘A-Z’ > CARS

  6. Let’s say that user tstark13 has an account on the server avengers which is part of the marvel.com domain. They have a folder called suitv4 in their home directory that they want to save locally. What command will do this?

    scp -r tstark13@avengers.marvel.com:~/suitv4 ~

  7. What will this command do? find ~ -iname file?? > list-of-files 2>&1

    list all files that start with ‘file’ and end with 2 characters, and save that list to a file called list-of-files. All errors will also be saved to list-of-files.

Have a look at the contents of the file SSDexample:

Samsung 860 250 79.99
Samsung 860 500 119.99
Kingston    A400    240 52.99
WD  Blue    250 74.99
Crucial MX500   500 115.99
Kingston    UV500   240 72.99
WD  Green   240 59.90
Crucial MX600   1000    194.99
Kingston    UV500   120 44.99
Samsung 860Pro  2000    1099.99
Sandisk PLUS    480 144.99
Samsung 850 500 348.12
Crucial M500    480 733.74

Now have a look at the desired output:

WD  Green   240 59.90

What command will accomplish this?

sort SSDexample | tail -1

Have a look at this file structure:

/
├── sample_dir
│   ├── admin
│   ├── cambridge
│   │   ├── cafeteria
│   │   └── library
│   │       └── dir_practice
│   ├── faculty
│   ├── markham
│   │   ├── annex
│   │   ├── annex2
│   │   ├── building1
│   │   └── parking
│   ├── outline.doc
│   ├── oxford
│   │   ├── outline.doc
│   │   ├── programming
│   │   │   ├── report.docx
│   │   │   ├── report-final.pdf
│   │   │   └── report.pdf
│   │   ├── report
│   │   └── security
│   ├── stenton
│   │   ├── gen_ed
│   │   │   ├── cars
│   │   │   ├── cars2
│   │   │   └── link-cars
│   │   ├── lib_arts
│   │   │   ├── english.txt
│   │   │   └── match.doc
│   │   └── parking2
│   └── test
└── home
    ├── cjohnson
    └── sam
  1. What command will put you into gen_ed no matter where you are?

    cd /sample_dir/stenton/gen_ed

  2. User sam’s current location is in programming. What command will they use to move report.pdf into their home directory?

    mv report.pdf ~

  3. Your current location is in cambridge. What command will remove stenton?

    rm -r ../stenton