Introduction to Operating System

Lab1: Getting Started with Ubuntu

Lab Overview

This lab is to install and experience with a linux system, Ubuntu in VmWare.First install VmWare software provided by TA. Open the .vmx file with Vmware,you can experience with the linux-style system.

After system starting, check whether the system works correctly. Use command lines, and try commands like ls, cd, sudo.

Note: since Operating Systems procedes before C and Data Structure, it is strongly recommended that student make sure they have GCC and corresponding work environment installed on their virtual machine.


1. Files and Directories

To see all the files in the current directory, tyep "ls" (short for list). To see what a particular file might be, type "file ", where is the file you want to query. This will display what the system thinks the file is. To make a directory, you use the command "mkdir " . Linux uses "/" character to separate directories. To center a directory, use "cd" command. To go back to parent directory, type "cd ..". Use "cd .." several times until you reach "/" (root directory). Have a look at the directories to see what kind of files they contain.
"rm" (short for remove) is used to delete files.
Note: Linux doesn't have a trashcan, when you use rm, it is gone forever! and sudo

Occasionally, you may need to perform some administrative tasks. (To see the difference between normal and administrative users, try to create a directory in the root directory.)
In order to do this, you'll have to log in as the system administrator (on linux system this is called 'root'). 'su ' command lets you log in as root from a running shell. Type 'su' and enter the root password.This can be dangerous if you forget whether you're acting as root.
On the other hand, sudo is a command to allow you to perform one task as root. But, to use sudo, your account must be entered into the sudoer file. As root, type "emacs/gedit/vi /etc/sudoers", have a look at its content.
If you are not a sudoer, edit the /etc/sudoers file so that it looks like
#User priviledge specification
root ALL=(ALL) ALL
me   ALL=(ALL) ALL

surely, instead of "me", type your username there. Save the file, and try "sudo" again.


man is the UNIX/LINUX command to bring up manual pages for commands. As an example, type "man ls" to see the full manual for "ls" command. man is helpful if you forget exactly how to use a particular command, you can type "man ".
Q:How would you bring up the manual page for "man"?

4.tar,gzip, gunzip

Sometimes, you need to collect together a bunch of files. The tar command (short for tape archive) is used to create a file that is an archive of a bunch of other files. gzip is a program to compress files. If you've ever seen .tar, .gz, or .tgz files, you've seen gzipped tar files. gunzip undoes what gzip does.
Q: How would you use tar to create an archive of the Music dirctory named mus.tar?

5. cat, less and editors

cat and less are both commands used to display text files. cat just dumps al the output to the terminal, so it's good for short files. less displays the file a page at a time, so it's good for longer files. Most unix/linux systems comes with two time-honored text editors: vi and emacs.Also there is WYSIWYG text editors like gedit.

Helpful Documents

Student Feedbacks

If you have any advice and sugguestions about the lab or the course design, please let me know.:)