1. Welcome to Computing
Resources
Installing a Linux Virtual Machine (VM)
If you have Linux running on your laptop you don't need to follow this step. You are already a pro. Otherwise follow these instructions. They are for Windows, but should work similarly on the Mac. If you are using Mac you can also take a look at these instructions.
You can then make your way to the command line, where the real fun begins.
Navigating the command line
Here are a number of useful links:
- This tutorial from the University of Surrey is a good introduction. Read up to chapter 4, and leave the rest for later.
- An Introduction to Linux Virtual Workshop. This tutorial is slightly more advanced, and has a good introduction to file permissions and redirection.
- Learn enough command line to be dangerous is a introduction that is careful in explaining the basic terms. Self-stated goal: Indeed, this tutorial doesn’t even assume you know what a command line is, so if you’re confused about the title, you’re still in the right place.
More advanced tutorials
These might be overkill to start with, but we list them here as references you may want to check out later.
- LinuxCommand.org. Very comprehensive into, though perhaps a bit dense.
- A Practical Guide to Linux Commands Editors and Shell Programming. This is an actual book, covering a lot of different topics.
- Shell workshop A series of slides and code examples for how to use the shell. Perhaps a bit dry, but very useful.
- Basic Linux Navigation and File Management. More general and basic intro.
- Linux Driver's Ed Self-stated goal: To transform an intelligent, motivated person with zero linux experience into a capable linux user without inducing tears, drawing blood or triggering frustration-fueled outbursts of profanity.
Install python
There are Ubuntu-specific instructions provided in this form answer. You will get a lot of your most useful information from forum answers like this one. Follow these instructions up to make && sudo make install
You can then use pip
, which comes with Python to install IPython, an interactive environment you can use for playing around (pip install "ipython[notebook]"
). You can then play around with the awesome ipython notebook computational environment. We also have a public server. Don't keep any files on the public server though, it will periodically be purged.
Homework
These are exercises to be finished by next week's class. Please submit homework to Valentin as a pdf, using proper English, and proper formatting of code blocks. You are encouraged to write your responses in Markdown a mini-language that allows for easy conversion of plain text to HTML with proper code highlighting. It is super-useful (the content of this site is written in Markdown). For writing in Markdown (and also for general programming) we recommend the excellent Atom editor, which has installable packages that can convert Markdown to a variety of other formats, such such pdf (e.g., markdown-pdf, which is installable via Preferences -> Install). Of course, there are numerous other tools.
Due date
The homework is due on Thursday 24th of September at 7:30am. Please hand it to Valentin via e-mail, slack or in person till then.
These are the most important linux commands you should know for sure. Describe what each one does in your own words
ls
cd
mkdir
cp
rm
ln
cat
man
less
Which shortcuts refer to (a) the current directory (b) to the directory above the current one (c) the home folder?
What is the difference between a folder and a directory?
How do you remove an empty directory? What if it is not empty? Give examples.
How would you find out more about a command? (List three options)
What are links? How might they be useful?
How would you differentiate a directory from an ordinary file on the command line. How about a link?
Let's say you are working in one directory in your filesystem (e.g.,
/usr/local/dir1/dir2/xyzdir345
), then switch to another one (cd /usr/local/foo
). Now you want to go back to the previous directory, but don't want to type out the full path name. How can you do it quickly?Create two directories (let's call them A and B). Go into A and create a (soft-)link to B. Go into that link. Where are you now? Go back to the original directory and delete B. What happend to the link in A?
Can you describe the difference between a hard-link and a soft-link? Compare your result from 9. with creating a hard-link to a normal file and deleting the original.
What are pipes and how are they useful? Give a couple of examples using the commands in Question 1.
Execute the command
dmesg
(if you are using Mac OSX and not Linux you might have to usesudo dmesg
). How would you see only the last 50 lines. How about the first 50 lines? How would you save the output as a file? How would you search the output for a keyword? Since the command is creating a lot of output is there a way to read the output at your own pace?Why do you think using the command line might be useful? What surprised you?
Class communication
Please use Slack rather than email for class communication. You can use it to discuss problems amongst your classmates or to contact the instructors (using @sasha or @valentin to bring questions to our specific attention). We'll make channels for each of the lessons, and you can use them for discussion. You can sign up for the course Slack team using your oist.jp email account at here.