Unix Primer
A basic description of the unix/linux operating system that RPGnet
uses. If you use the ssh/telnet shells or ftp, or like to manipulate
your files directly on RPGnet, knowing unix is helpful. Unix is a
bit like old-style DOS.
Some basic unix commands are
- man = accesses the help files. To learn about "ls", type "man ls".
- xman = a graphical front-end to man
- ls = list files
- rm = remove files
- mv = move files (and "mv" is very easy to accidentally type as "rm"!)
- cp = copy files
- rn = read news (Usenet news) (also trn)
- mail = mail, see paragraphs below
- cd = change directory. "cd" without anything else brings you to your
Home directory (the top level). "cd .." brings you up one directory
level in the 'directory tree'. "cd ~spike" moves you to the Home
directory for spike (for example).
- ftp = File Transfer Protocol or other such technobabble. Basically, a way
to remotely log onto other machines to get or put files. Often used
as "anonymous ftp", see paragraphs below
- rlogin = Remote login, to a local computer
- telnet = remote login to a computer on the Internet
- more or less = ways to view a file one screen at a time. These two are nearly
identical, but "less" has a few more features. In general, hit the
space bar to move forward a screen and "b" to back up a screen.
- emacs or vi = most people's choice of text editors. I use emacs.
- cat = a way to look at or concaternate files. "cat " prints the
file to the screen in one big swoop. You can concaternate files
by saying "cat file1 file2 file3 >file4". See also "<" and ">"
- > = a redirection, saying "take the output of whatever command is in front
of this and dump it into the file". For example, to make a file
containing the output of the ls command, type "ls >my.directory.list".
This is not to be confused with:
- < = the other redirection, saying "take input from the file specified". Usually
used with scripts or batch jobs, this isn't used as much as ">". To
avoid confusing the two, realize the arrow points to the direction the
information goes: >into.a.file >> = okay, now we're getting tricky. This is the same as ">" but it appends
the information to the file rather than making or overwriting a file.
- !! = repeat last typed command
- !a = repeat last command that began with the letter 'a' (for example)
- alias = making aliases is a way to rename complex commands. The usage is
"alias A B", where "A" is what you want to call the command, and "B"
is the actual command. For example, if you are always doing the
command 'grep Paul /var/spool/mail/hilton', you could alias it as:
alias lookpaul "grep Paul /var/spool/mail/hilton"
(the "" are optional but recommended), and then type "paulmail" to
do this. You can make aliases permanent (i.e. present every time you
log on) by putting them in the .cshrc file (see below).
- grep = search a file for a word
- grep -i "searchterm" means ignore case of searchterm
- grep -v "searchterm" means exclude searchterm from the result
- | = called a pipe, this takes the output from everything before it and feeds
it into the command after it. So, if for some strange reason you want
to print a listing of the files you have in your directory, you now
have two methods.
- ls >my.directory.listing
port3 my.directory.listing
- ls | cat >frog.txt (no intermediate file needed)
- & = runs a command in the background. For example, if you want to use the
'xman' tool, you could type 'xman'. But, then, you can't do anything
else in the window you typed it from, even though xman isn't actually
using that window (it creates its own). So, instead, you should
run it in the background, by typing 'xman &'.
There are two files the system uses. ".cshrc" is read by the system every
time you open a new window, and includes parameters such as aliases, paths,
and other nonsense. ".login" is similar but is only read once, when you log
on. In these files, lines beginning with a "#" are commented out. At some
point, you will want to edit these files to reflect your own personal layout.
To check mail, type "elm" and use elm as your mail reader.
To send a quick and dirty message, you can use "mail". To send mail to someone
with an account on sled (for example, emma) type "mail emma". If you want to
include other people (including a copy to yourself), just add them to the list,
for example, to send mail to emma and todd and a copy to yourself,
"mail emma,todd,dwilson". To send to people with accounts elsewhere, you
need to know their complete email address. For example, to send email to bill
and yourself, use "mail bill@wizard.gsfc.nasa.gov,dwilson"
In mail, to send the message, type "." or "" at the start of a
blank line, and it is sent. If you want to cancel the email message, hit
twice. If you do this cancel (or if the system crashes while you
are writing an email), it will save the partially-completed letter in a file
called "dead.letter", in case you want to recover it. But, "dead.letter" only
saves the most recent aborted attempt.
In mail, you can include files with the email you are sending. To include
a file, type (at the beginning of a line) "~r filename" (where "filename" is
whatever the file you want to include is). If the file exists and you typed
it correctly, it will include a little line saying how big the file is. If
it says "file not found", well, we leave it to you to figure it out.
In elm, there are menus for handling such functions.
FTP is a common way to get publically available information from other machines.
"anonymous ftp" refers to the fact that people make such information available
to anyone. Use ftp to connect and log in as the user "anonymous"-- no password
is needed. "get " grabs files from there to here, and "put" does the
opposite. "ls" shows what is there, "cd" works as normal, and "help" helps.
mget and mput let you do multiple puts and gets and allows you to use
"*" as a wildcard, whereas 'put' and 'get' do not.
Back to RPG Web Services