Here I describe a set of UNIX commands that might be useful during the semester with a simple suggested scenario. I hope this page serves as a future reference: you can come back to this page when you cannot remember what the name of the command is. If you have certain operation you want to do, but cannot really find it, please come to me in Office Hours or beginning/end of the class, then we can search the web together and update this page.
As you become more and more familiar with UNIX commands and know how to combine them, you can dramatically increase your efficiency of manipulating data/documents.
You're familiar with the tree-like directory system in Windows. You have almost the same thing in UNIX.
Here, the 'Adobe' directory is placed under 'Program Files', and it's under 'C:'. Collectively, it's written as 'C:\Program Files\Adobe'. Let's find out where you are.
The 'pwd' command displays where you are.
It says that I'm on 'yun3' under 'u4' under 'skew' under 'home'. Of course you'll be on the different directory.
This is the most important command of this page. Whenever you're not sure how to use a certain command, type 'man [command]'. For example, type 'man pwd' and you'll see:
Press 'Space' to move forward, and 'b' to move backward. To quit, type 'q'.
Now you may want to move to the higher level. Type 'cd ..' Use 'pwd' to check out you're on the higher level. Use 'cd ..' again to go to the higher level.
Let's go back to your home directory. To go down, you have to specify the destination (because you're moving on tree!). Type 'cd 'u4'' to go to 'u4' directory. Take one step lower.
So far, we've been navigating in the relative fashion. That is, you specified your destination relative to your current position. You can also move with the absolute address.
You should use directories to organize your files neatly. You can make a new directory with 'mkdir' command. At the beginning of every semester, I create a new directory for that. Let's create one and move to it.
This should be the command you'll most frequently use! This command displays the list of files under this directory.
Eww… Gross? Please don't be a person like me. Keep your home directory clean.
You may also want to delete a directory (e.g. you think the given name is too lame). Here's how to do so:
In many times during the course, you'll have to download materials from web (e.g., data file for analysis, or supplementary source codes). Please download the following file from the web:
If you want to browse inside of the file, there are a lot of ways to do so, but here I pick 'less' command. Let's try it! Type 'less week2.txt'. (Tip: it's always useful to make use of 'TAB' key)
Press 'Space' to go to the next page. Press 'b' to go to the previous. You can also use cursor keys to navigate. Press 'h' to get the help menu. Press 'q' to quit. Press 'g' to go to the top. Press 'G' to go to the bottom.
Press '/' to search for certain keywords. Press 'n' to go to the next matched string. Press 'N' to go the previous matched string.