next to the section topics represent links to the O'Reilly online computer
book publishing service, to which the University subscribes. When on
the University network, you will have access to these books for intelligent
indepth topical data.| Directory Command |
Description |
| cd [directory] |
changes current directory to directory if argument not given, changes current directory to '~/' - the home directory note that directory can be the absolute path or relative to your current path (see examples) |
| cd .. |
change current directory one level up |
| mkdir DIR |
creates a directory within the current directory
named DIR |
| rmdir DIR |
removes a directory with path DIR |
| pwd |
prints the current working directory |
| cp [-R] SOURCE DEST |
copy a directory source as dest -R specifies to copy the directory recursively |
cd ~/ # go to home dir
> pwd # where am i?
/home/ivan # i'm in my home dir
> mkdir tmp # make directory in home dir name 'tmp'
> cd tmp # change current directory to 'tmp'
> pwd
/home/ivan/tmp
> ls # list files in working directory
> ls -a
. ..
> ls -a -l
drwxr-xr-x 2 ivan college 512 Oct 4 19:29 .
drwxr-xr-x 3 ivan college 512 Oct 4 19:29 ..
> mkdir tmp2 # make new directory name 'tmp2'
> ls # is it there?
tmp2 # ... yes it is
> ls -a tmp2 # show me everything in tmp2
. ..
> cd tmp2
> ls -a -l
drwxr-xr-x 2 ivan college 512 Oct 4 19:38 .
drwxr-xr-x 3 ivan college 512 Oct 4 19:38 ..
> pwd
/home/ivan/tmp/tmp2
> cd ..
> pwd
/home/ivan/tmp
> rmdir tmp3 # remove tmp3
rmdir: tmp3: No such file or directory # oops
> rmdir tmp2 # remove correct directory 'tmp2'
> ls # is it still there?
> # ... no
| ls |
list files in current working directory |
| less FILENAME |
view the file FILENAME, use the key 'q' to exit |
| more FILENAME |
view the file FILENAME, use the key 'q' to exit |
| rm FILENAME |
remove the file FILENAME |
| cp SOURCE DEST |
copy the file SOURCE as DEST |
| mv SOURCE DEST |
first copy the file SOURCE as DEST and then remove
the file DEST |
> cd ~/tmp/ # go to /home/ivan/tmp
> pwd # where am i?
An operating system is the program that controls all the other parts of a computer system - both the hardware and the software. Most importantly, it allows you to make use of the facilities provided by the system. Every computer has an operating system.
The UNIX operating system has three important features; a kernel, the shell and a filesystem.
/home/ivan/tmp
> ls -la
drwxr-xr-x 2 ivan college 512 Oct 4 19:42 .
drwxr-xr-x 3 ivan college 512 Oct 4 19:42 ..
-rw-r--r-- 1 ivan college 55 Oct 4 19:42 hello_world
> more hello_world # what's in this file?
Welcome to the MATRIX!
Thou wilt be programmed!
- neo
> less hello_world # what's in this file?
Welcome to the MATRIX!
Thou wilt be programmed!
- neo
hello_world (END) # press 'q' to exit
> cp hello_world h2 # copy 'hello_world' to 'h2'
> ls
h2 hello_world # now there are two files
> mv hello_world h3 # rename 'hello_world' with 'h3'
> ls # now what's there?
h2 h3 # two files: 'h2' & 'h3'
> rm h3 # remove h3
> ls
h2 # now there's only h2
> mv h2 ../ # move h2 one level up the directory tree
> ls # now there are no files here
> cd .. # go up one level
> ls
h2 # here's the file we moved
>
| Command | Description |
| ps |
lists the currently runnign process |
| touch |
|
| w [ -hlsuw ] [username] |
list all the users on the machine as wel last their
information |
| finger [username] | finger without username acts like 'w' with no options when a username is supplied, it prints an entry from database about the user username |
> enscript Pmaclab@oberon <file.txt>
> lpr -Pmaclab@oberon <file.ps>
> ssh the-400.cs.uchicago.edu # connect to the-400 on cs domainSSH assumes that you want to connect as the current user, but if you want to connect as someone else, you can do so:
> ssh mickey_mouse@the-400.cs.uchicago.edu # connect as mickey_mouse to the-400TELNET works in a similiar way, to find out more, use 'man telnet' and 'man ssh'
> scp ivan@harper.uchicago.edu:~/hello_world from_harper # get file hello_world from harper and put name it as from_harperNow i want to upload a directory of files to harper:
ivan@harper.uchicago.edu's password:
scp: warning: Executing scp1 compatibility.
hello_world 100% 51 0.0KB/s 00:00 # download information
> more from_harper
hi, this file resides on harper.uchicago.edu
EOF
>
> scp -r tmp harper.uchicago.edu:~/new_tmp # upload the directory tmp to harper and name it as new_tmp
# make SURE that the -r flag is present, this means to scp recursively
ivan@harper.uchicago.edu's password:
scp: warning: Executing scp1 compatibility. # some warning messg, ignore
stupid.sh 100% 85 0.0KB/s 00:00
helloworld 100% 100 0.0KB/s 00:00
helloworld2 100% 471 0.0KB/s 00:00
job_latex.tex 100% 1110 0.0KB/s 00:00
h2 100% 55 0.0KB/s 00:00
flight.tex 100% 3604 0.0KB/s 00:00
flight.tex~ 100% 885 0.0KB/s 00:00
hello_world 100% 55 0.0KB/s 00:00
>
UW PICO(tm) 4.2 New Buffer # top of the pico window4.2 Specifies the version of PICO you are using and 'New Buffer' indicates that you haven't saved the file yet. If you opened an existing file or saved the current one, it would specify the filename.
^G Get Help ^O WriteOut ^R Read File ^Y Prev Pg ^K Cut Text ^C Cur Pos
^X Exit ^J Justify ^W Where is ^V Next Pg ^U UnCut Text^T To Spell # bottom of pico windowEach commands listed at the bottom has it's own key binding. The carrot - '^' indicates that you should press the [CTRL] key as you type the letter. So for example to exit pico, you need to hold down the [CTRL] key and while holding it down, press 'X'. To enter text into the buffer, just type keys on the keyboard. When you will try to exit, prompt will ask you if you want to save changes to which you can respond with a yes - 'y', a no - 'n' or ^C to cancel the exit sequence.
to get into the editor from Unix: {vi filename}
to exit the editor
saving all changes {ZZ} or {:wq^M}
throwing away all changes {:q!^M}
when no changes have been made {:q^M}
save a file without exiting the editor {:w^M}
write the file into another file {:w filename^M}
insert text
before the cursor {i ...text... ^[}
at the beginning of the line {I ...text... ^[}
after the cursor (append) {a ...text... ^[}
at the end of the line {A ...text... ^[}
after the current line {o ...text... ^[}
before the current line {O ...text... ^[}
delete the character ...
under the cursor {x}
to the left of the cursor {X}
delete n characters {nx} or {nX} (for n a number)
make two lines into one line (Join) {J}
find a string in the file ...
searching forward {/ ...string... /^M}
searching backwards {? ...string... ?^M}
repeat the last search command {n}
repeat the last search command in the
opposite direction {N}
find the character c on this line ...
searching forward {fc}
searching backward {Fc}
repeat the last 'find character' command {;}
replace a character with character x {rx}
substitute a single character with text {s ...text... ^[}
substitute n characters with text {ns ...text... ^[}
replace characters one-by-one with text {R ...text... ^[}
undo all changes to the current line {U}
undo the last single change {u}
move forward in the file a "screenful" {^F}
move back in the file a "screenful" {^B}
move forward in the file one line {^M} or {+}
move backward in the file one line {-}
move to the beginning of the line {0}
move to the end of the line {$}
move forward one word {w}
move forward one word, ignoring punctuation {W}
move forward to the end of the next word {e}
to the end of the word, ignoring punctuation{E}
move backward one word {b}
move back one word, ignoring punctuation {B}
return to the last line modified {''}
scroll a line onto the top of the screen {^Y}
scroll a line onto the bottom of the screen {^E}
move "up" in the file a half-screen {^U}
move "down" in the file a half-screen {^D}
move the cursor to the top screen line {H}
move the cursor to the bottom screen line {L}
move the cursor to the middle line {M}
move LEFT one character position {h} or {^H}
move RIGHT one character position {l} or { }
move UP in the same column {k} or {^P}
move DOWN in the same column {j} or {^N}
mark the current position, name it x {mx}
move to the line marked/named x {'x}
move to the character position named x {`x}
move to the beginning of the file {1G}
move to the end of the file {G}
move to line 23 in the file {23G}
repaint the screen with the cursor line
at the top of the screen {z^M}
in the middle of the screen {z.}
at the bottom of the screen {z-}
All of the gory details about CVS can be found at www.cvshome.org. This document describes the bare essentials that you need to know for this class.
Make sure your directory is clean and only contains the files you want to place in the repository. Object files, executables, core files, and editor backup files should be deleted from the directory in this process.% cd myproject
% ls
Makefile
README
bar.c
foo.c
%
Now, import your directory into the CVS repository as follows:
After typing the 'cvs import' command, an editor will appear asking you to type in a log message. This message should simply be a short description of the project. After saving the message, the files will be imported into the repository.% cd myproject
% cvs import myproject yourname start
N myproject/Makefile
N myproject/README
N myproject/bar.c
N myproject/foo.c
No conflicts created by this import
%
Note : To save the log message and exit from emacs, you will have to type Control-X Control-S followed by Control-X Control-C. To save the message and exit from vi, you should type ":w" followed by ":q".
After importing a directory into CVS, you should either rename or remove the original project directory and checkout a fresh version from the repository.
Now, all of your original files should be restored in a new directory "myproject".% cvs checkout myproject
cvs checkout: Updating myproject
U myproject/Makefile
U myproject/README
U myproject/bar.c
U myproject/foo.c
Before committing the file, an editor will be started where you will be asked to enter a log message describing your changes. As a shortcut, you can also enter a change message on the command line like this:% cvs commit foo.c
Checking in foo.c;
/u1/dave/CVSROOT/myproject/foo.c,v <-- foo.c
new revision: 1.2; previous revision: 1.1
done
%
Changes made to an entire directory can be committed in the same manner. For example:% cvs commit -m "Fixed the segmentation fault error" foo.c
% cvs commit -m "Handin" myproject
This only tells CVS that a new file will be added. The addition does not take effect until you commit changes using the 'cvs commit' command.% cvs add spam.c
cvs add: scheduling file `spam.c' for addition
cvs add: use 'cvs commit' to add this file permanently
Again, this command only takes effect after you have committed your changes with the 'cvs commit' command.% rm foo.c
% cvs remove foo.c
cvs remove: scheduling `foo.c' for removal
cvs remove: use 'cvs commit' to remove this file permanently
Later on, if you ever need to go back to "version1", you can go into a clean directory and type "cvs checkout -r version1". This will check out the version of code that was tagged as "version1". This can be particularly useful if you proceed to mess something up beyond repair---you can simply restore the last tagged version and restart.% cvs tag version1 myproject
Of course, this will only work if you have been diligent about committing files to your CVS repository. Do a 'man cvs' for all of the various date specification options.% cvs checkout -D "2 days ago" myproject
% mkdir Junk
% cd Junk
% cvs checkout myproject
... list of files ...
% cd myproject
% make
... compiler junk ...
% run it
We install software that is not included in the standard debian distribution in /opt; you can access newer versions of some window managers there.
For example, to use any of the following window managers, put the associated lines in your ~/.xsession file:
#!/usr/local/bin/bashIf you do not do this, your file will not work.
#!/usr/local/bin/bash
xset b off&
fvwm2
#blackbox
> man ls
> man man
> info emacsnow you may be saying all this is useful, but what if I don't know the name of the command I want to use. what if I only know its purpose? we give you apropos.
> info info
> apropos sort
lsort (n) - Sort the elements of a list
sortm (1) - sort messages
xroger (1) - throbbing X logo, of a sort
You can list all the packages currently installed on a debian machine
with:
dpkg -l
To see all the files contained in a package:
dpkg -L PACKAGE