Linux
Useful Commands
simple navigation commands: ls, cd, pwd
paths: ../relative/folder, /absolute/path
shortcuts: ~, -, ~username
showing stuff: less, cat, more, sort, grep, wc, head, tail, tee
stream manipulation: >, >>, |
help: man, help
manipulating files and dirs: cp, mv, mkdir, rm, ln
utility: alias, clear, history
cursor: ctrl-a, ctrl-e, ctrl-c, tab
process manipuation: bg, fg, ps, kill
environment: printenv, set, alias
text editors: vi
vi command mode: :wq!, i, esc, y, p, linenumber
vi search: /searchstring enter. n for next
servers: ssh user@server
networking: ping, traceroute, netstat, wget, ssh, scp
looking: locate, find, grep, diff
compression: gzip, tar
java: javac java
Assignment
You SHOULD read through the problems before you begin You MAY use the internet or any notes. You MAY NOT use your peers. You MUST submit by 3:15pm on 9/22. You WILL NOT have time to work in class on 9/22. UPDATE: because level 2 was down, you may submit by 3:15 on 9/24. Note we will be moving on in class on 9/22.
Level 1:
- Use ssh to log on to compsci.dalton.org.
- make a new folder in your home directory called homer.
- Inside that folder, make 3 new files in that directory called agamemnon, achilles, and nestor.
- Put the line “King of Mycenae, leader of the Greeks” in the agamemnon file.
- use curl to download the file http://compsci.dalton.org/~cforster/pg6130.txt.
- use grep to find out who needs to accept a “mean sacrifice”. Make a file with that name
- use grep to find out why Juno and Minerva descend. Put the answer in a file called juno.
- I’m interested in what Great Jove beheld. Put about ten lines surrounding this quote in a new file called jove.
- rename the nestor file to greatnestor.
- Add the contents of the file blue-eyed from my home folder to the end your agamemnon file. Hint, use cat and a redirect.
- add the current system uptime to the agamemnon file.
- store your history in a file called “myhistory”. Hint, use history and a redirect.
- Using vim, In ALL CAPS, annotate “myhistory” to reference the numbers on this sheet.
- use tar to make a tarball called “MYNAME.tar” of all of the files in your directory—replace MYNAME with your name (for example, mine would be cforster.tar)
- copy your tarball to /home/cforster/submissions
Level 2:
Somebody who doesn’t work at Dalton anymore has become a secret spy!
- Figure out who the spy is by checking login times for inactive users
- Look in that user’s folder to figure out what server you need access to.
- Run the java program in that folder to get a password for that server
- Log on to the hacker server
- Write a shell script that creates a log of any system information you can.
- Make cron job to generate that file
Level 3:
A good project to take your new linux knowledge further is to spin up your own virtual machine instance and build a small server. Amazon web services (aws) is the most popular server platform on the internet today, it is used by many large companies including netflix, dropbox, etc. Make a free-tier aws linux-based instance (I recommend ubuntu) then use it to make a simple chatterbot program. The interaction can be as simple as you like, and you should be able to find many example programs and tutorials on the internet. This is a hard challenge, but would be an excellent demonstration of a mastery of both linux and java networking.
Grading
Base: 70 points Level 1: 1.33 points each Level 2: 1 point each Level 3: graded as appropriate