- The Galois Group
- The Graduate Program
- Other Advice
- Student-run Seminars
- Technical Tutorials
- About Davis
- External Links
This tutorial is intended to be a practical and brisk tutorial of many of the basics of using Linux for people who have never used it before. Setting up a website, compiling LaTeX, firing up MatLAB, and other typical tasks math grads would want from the department computers are covered quickly.
By using the related tools mentioned here, you can do things such as modify your webpage, retrieve/send files, turn LaTeX files into PDFs, and all other tasks you can do on the department computers from where ever you have internet access!
If you are using one of the Ubuntu computers in the computer lab or in your office, there is nothing special you have to do. Just open the “terminal” application and you are ready to start typing unix commands.
If you are on your own computer, you first need to connect to the math's computers. Just as you need a web browser (like Firefox) to connect to a web server (like www.gmail.com), you need an SSH client to connect to an SSH server. To connect, you need your username, password, and a SSH client.
Some good SSH clients include
The first thing you should do is watch this youtube video that covers the core set of unix commands that a Linux user would use almost every day. Then search online/youtube for “basic unix commands” and work through the examples. An important set of basic unix commands you should look up include
Once you successfully connect to a terminal, you are given a prompt where you can type commands. This section is devoted to introducing some everyday commands. In what follows, when in doubt, Linux is typically case-sensitive!
Like on your own computer, Linux has a folder (sometimes called a directory) structure. Any folder can contain any number of files. A folder can also have any number of folders called subfolders (and these folders can in turn have the same kind of content). When you log in, you are brought to your what is called your “home directory”. Your home directory is a subfolder of some other folder (called its parent directory).
Some special directories have special symbols. The current directory is given the symbol
the parent directory of the current directory is given the symbol
and your home directory is given the tilde symbol
To see what directory you're in at a given moment, you can type
and press Enter. This tells you your “present working directory”. You can see a listing of the contents in the present directory by typing the command
and pressing Enter.
To move to a different directory, use the command “cd” with an additional parameter. For example, to go to the parent directory of the current directory, type
and press Enter. You can try this again and again to get all the way to the top-level directory, the unique directory with no parent. All along the way, you can check where you are with the command pwd
To get back to your home directory, use
or the shortcut
In your home directory, suppose you want to create a subdirectory (to store, for example, the scratch work of the rest of this tutorial). If you wish to make a directory called learnlinux in the current directory, type
. Now you can use
to get into it and
to get back.
To delete the directory learnlinux type
As a safety feature “rmdir learnlinux” only works if the folder you wish to delete has nothing in it. Now try creating two folders, one called test1 and one called test2. You can move test1 into test2 by typing
mv test1 test2
Now, test1 is a subfolder of test2. You can rename test2 to test3 by typing
mv test2 test3
To create a blank file called myfile.txt in the current directory, type
To rename the text file, type
mv myfile.txt renamed-file.txt
To delete the file, type
This is very important. You do not want other people to read, edit or delete your important files. You can recursively set permissions with chmod.
You have two basic ways of modify files. One option is to download them to your computer, edit them like normal, and then save them back to the math servers. Your other basic way to modify files is directly in the terminal using a text-based text editor. This makes sense for quick and minor edits. It also may help you keep your files in order, because you only have one version of a file floating around.
The three most-popular text editors on Linux are called “pico”, “vi”, and “emacs”. You just have to pick one and stick with it. pico is by far the easiest of the three. Later, you may want to try vi and/or emacs because they are much more powerful (though much more difficult to use). You may find that you like “gedit”, the graphical text-editor. This is nice to use in the department, and there is a way to use it via SSH (see the section on X Windows), but it may run slowly over a slow Internet connection, and for this reason alone, it may be useful to learn how to open, edit, and save a file in pico.
Search online for great tutorials on pico, vi, emacs.
See the LaTeX Tutorial.
Suppose you have a valid LaTeX file called mytheorem.tex in the present working directory. To make a PDF, you can run
If your LaTeX file is invalid, you will not reach the normal prompt and instead be given a question mark. You can type a capital X or “ctrl+c” to quit.
These commands are also useful
Basically, there is a command for everything. If you want to do something, just search the internet for “how to X unix command”.
It is so easy to just use a (S)FTP program like WinSCP or FileZilla.
You could also use unix commands to transfer files…see sftp, put and get.