vi:
vimtutor at the shell prompt.
emacs:
emacs. After starting
the editor, hit `Control-H' and then `t'.
gdb:
telnet jupiter.csc.depauw.edu (more securely, use SSH instead
of TELNET; on Windows you will need to install a client such as
PuTTY, available from
http://www.chiark.greenend.org.uk/~sgtatham/putty/). You will
need the username and password from the sheet I gave you on the first
day (and you will probably want to change the password to something more
memorable, with the passwd command).
jupiter$''. You do not type the prompt; you type what comes
after it.
jupiter$ ls
jupiter$ cp /etc/motd motd
jupiter$ ls
motd'' among any other files that you have.
jupiter$ ls -l
-l'' option specifies that you want a ``long''
listing, which shows lots more information that just the file name.
jupiter$ cat motd
jupiter$ pwd
pwd command. This is what is
called a ``path'' in unix. Unix organizes files in one big tree, where
each node of the tree has a name. The path is the sequence of nodes the
system needs to follow to get from the root of the tree to your home
directory.
jupiter$ mkdir xyz
mkdir command makes a new directory. Let's see where unix
put it.
jupiter$ ls
xyz directory is within your home directory. Directories can contain
directories as well as files! You can now put files in the xyz
directory.
jupiter$ cd xyz
xyz subdirectory.
jupiter$ pwd
xyz node has been added to the path.
jupiter$ cat motd
motd in the
current directory.
jupiter$ pico tutorial
pico, there should be a menu at the bottom of the screen.
Type the opening paragraph of this tutorial. Use the cursor keys to move
the cursor around. Use backspace to correct mistakes. When you are
finished hit `Control-O' to save the file and then `Control-X' to quit. (You
need to answer some questions that appear on the message line.) You
should now be out of pico and back at the unix prompt.
jupiter$ ls
ls command shows the file in the current directory, which is
the xyz subdirectory. So the files in your home directory do not
appear. The only file that show up at this point is the file that you
just created with the text editor.
jupiter$ cd ..
jupiter$ pwd
cd ..'',
the current directory moved from xyz to its parent, which is your
home directory. The xyz directory is a ``subdirectory'' of your home
directory. The home directory is the ``parent'' of xyz. A directory may
contain any number of subdirectories, but a directory has one and only
one parent. (Exception: the root directory, whose name is just /, has no parent.)
jupiter$ mv motd oldmessage
jupiter$ ls
motd is gone, but oldmessage is now there. It is the same
file, but with a different name.
jupiter$ mv oldmessage xyz
mv because the destination is a
directory.
jupiter$ cd xyz
jupiter$ ls
oldmessage has been moved into the xyz
subdirectory.
jupiter$ cat motd
motd in the current directory. But we know that there is a file
named motd somewhere in the tree. How do we access it?
jupiter$ cat /etc/motd
/) and list all
of the nodes in the path from the root directory to the file. In this
case the path is short, but in general there are many nodes to type.
jupiter$ cd
cd with
no arguments does exactly that.
jupiter$ ls xyz
xyz directory.
jupiter$ cat xyz/oldmessage
oldmessage file. This command
illustrates what is called a ``relative path'' name of a file. Since the
path does not begin with a slash (/), the system follows the specified
tree nodes beginning with the current directory. So the path is relative
to the current directory.
jupiter$ ls ..
..'' to access the parent
directory. This command therefore shows what is in the parent of your
home directory (probably a bunch of other people's home directories).
jupiter$ man ls
man command takes the name of a command or program as
its argument. It displays the manual page for that command or program.
In this case, you see the man page for the ls command.
When you are in the man display, use the following commands:
| space bar | advance to the next page |
| return (or enter) | advance one line |
| q | quit |
| ? | help |
man command, you can find out about other
important unix commands. What you should do now is read the man pages in
the list of must-know commands below. These give a lot more detail than
what you need to know to get started, but read the description of what
the command does and skim the rest just to see what information is
available.
man |
Manual page |
more |
Display a file one screen at a time |
ls |
List files in a directory |
cp |
Copy a file |
pwd |
Show path of current directory |
rm |
Remove (delete) a file |
rmdir |
Remove a directory |
mkdir |
Make a new directory |
passwd |
Change your login password |
chmod |
Change access permissions of a file |
date |
Show the date and time |
pico |
Text editor (vi and emacs are also popular) |
lpr |
Print a file |
talk |
Live communication with other users |
w |
Show who is logged in and what they are doing |
ps |
Show what processes you are running |
wc |
Word count utility |
g++ and make to build
programs written in C++.