PREVIOUS Emacs |
NOTE: square brackets ([]
) around an argument mean that it is
optional. Angle brackets (<>
) mean that it is necessary.
Command |
Description |
Common Options |
chmod <level> <file> |
Changes the permissions of file to level . See Linux Hints below or
man page for description of levels |
|
cp [options] <src> <dest> |
Copies src to dest . |
-r - recursive (for directories) |
du [options] [directory] |
Lists size of files in directory . If no directory is
specified, lists current dir. |
|
ls [options] [directory] |
Lists contents of directory . If no dir is specified,
lists current dir. |
-l - "long" lists owner, permissions, size, last
modified-a - "all" includes files beginning with '.' (Options
can be combined, like "ls -al " |
mkdir <dir> |
Creates dir . |
|
mv <src> <dest> |
Renames src to dest . |
|
rm [options] <file> |
Deletes file . |
-r - recursive (for directories) |
rmdir <dir> |
Deletes dir , if it is empty. |
|
touch <file> |
If file does not exist, creates an
empty file of that name. If file does exist,
does not affect it. |
Command | Description | Common Options |
finger [name or account or @machine] |
If no argument is given, lists users of your machine. If a
name or account is given (or piece thereof) lists information for any
accounts matching string. If @machine is given, lists all users of
machine . |
|
grep <pattern> <file> |
Displays all lines in file containing pattern .
(Surround multi-word patterns with quotation marks.) |
-i - ignore case-r - recurse
into directories (without this, only looks at files in current dir)-v - invert (display lines not matching the pattern. useful
if you are chaining multiple searches together with '|'
(See Linux Hints below) |
less <file> |
Displays file in a shell. Allows you to scroll backwards
and forwards through file, and to search by pressing '/.' |
|
lpr [options] <file> |
Prints file. Defaults to cis dispatch window. |
-P<printer> - specify printer |
lpq [options] |
Lists the print queue. Defaults to cis dispatch printer. | -P<printer> - specify printer |
lw |
Displays text diagram of lab, with the name of everyone logged in. | -f - show full names (default)-n - show logins-t - show amount of time each user has been logged in -i - show how long each user has been idle |
man <Linux command> |
Displays the man (manual) page for the specified command. Good way to move beyond this Appendix, as we are eliding all but the most common options for most commands. | |
more <file> |
Displays file in shell. Only allows forward
scrolling. (more is less than less =] ) |
|
passwd |
Changes password. | |
pwd |
Prints the full path or your current working directory. | |
qwaitlist |
Gives the status of the waitlist, if there is one, including how many people will be kicked off before you. | |
tar [options] <outputfile> <files or dir> |
Creates a type of archive ("Tape Archive") of
files and names it outputfile . |
cvf - to create an archive (tar cvf
package.tar *.java )
|
top |
Real-time display of all processes active on your computer. Useful if your computer seems to be going really slow. (Sometimes, a user won't properly exit a program before logging off, and it becomes a "zombie" process, just eating up the processor. If you top and see a process that you don't own taking up a large percentage of your processor, talk to the consultant.) |
|
unzip [options] <archive> |
Extracts files from a zip archive. | -l - just list files, don't extract them |
xlock [options] |
Password protected screen saver. Use this EVERY time you leave your computer. | |
xv [file] |
Viewer for .jpg (.jpeg), .tiff, .gmp, and .bmp images. | |
zip [options] <outputfile> <files or dir> |
Like tar , but creates a .zip
compressed file. |
-r - recursive (for directories) |
zwrite <login> |
Sends a sort of instant message to the user specified. |
Command | Description |
acroread [file] |
Reader for .pdf files. |
gimp [file] |
Pretty powerful photo editor. |
mozilla [url or file (file must be preceded by "file://")] |
Web browser. |
pico [file] |
Simple, shell-based text editor. |
pine |
Shell-based mail client. |
xemacs [file] |
Text editor. |
xterm |
Shell. |
Command | Shortcut |
Dynamic Expansion |
M-/ |
Exit XEmacs |
C-x C-c |
Find and Replace |
M-% |
Goto Line |
M-g |
Goto Buffer |
C-x b |
Open |
C-x C-f |
Save (current buffer) |
C-x C-s |
Save Some Buffers |
C-x s |
Search (forward, press over and over to find next) |
C-s |
Search (backward, press over and over to find next) |
C-r |
Undo |
C-x u |
Un-split (keep this) |
C-x 1 |
Un-split (keep other) |
C-x 0 |
Not really a menu. Lists all of the windows you have open. If you click one, makes that window your active window.
.fvwm2rc
, you can use this
instead of logging out and logging back in..Xdefaults
file,
which dictates the initial appearance of windows.
<CTRL>-c
in a shell will cancel any active process
in the foreground (one that is controlling your
shell). Typing <CTRL>-z
will
suspend the process.
When to use which? Well, unless you plan on
resuming the process (see the CS Linux
page about suspending then backgrounding
processes), you probably WANT to cancel the
program with <CTRL>-c
.
However, sometimes programs don't respond
to <CTRL>-c
, but they
will respond to
<CTRL>-z
. We don't know why.
So basically, try to cancel, and, if that
doesn't work, try to suspend.
man
page. There are a ton of different
ways to define the permissions, and some ways
are better for certain contexts. This guide
should give you some of the basics though--enough
to protect your files.
Anyway, one way to think about permissions is
that there are 3 tiers of access you have to
define: world, group, and owner. Owner
is the person who created the file (better
be you if you're hoping to change the permissions). Group refers to other users that belong to the "group" associated
with the file. To see the groups for a file,
do ls -l
. Some example of groups
are ugrad (all undergrads), cs009ta (CS9 tas),
etc. World is everyone else.
For each of the segments of users listed above,
you can grant or withhold three permissions:
read (r), write (w), and execute (x).
Read and write are fairly self-explanatory
(note, however, that you need write permission
to a directory in order to save files in it).
Execute refers to both the permission to execute
a file, like a program or script, and the
permission to enter a directory. So, if you want
someone to be able to cd
into
a directory, they must have execute permission
for it.
Let's look at a sample output from
ls -l
:
drwxr-xr-x 2 jgoodwin nougrad 4096 Jul 10 13:44 bin/
drwx------ 5 jgoodwin ugrad 4096 Jun 10 16:14 course/
-rw-r--r-- 1 jgoodwin nougrad 77829 Jun 20 15:00 escalatorlg.jpg
This is a partial listing of John's home directory.
You can see the owner and group for the
files, and, on the left, the permissions.
Lets start with the bin/
directory.
The permissions are in the order: owner, group,
world. The leading 'd'
just
marks this as a directory. You then see that
John has given himself full permissions (rwx =
read, write, and execute), and has given
members of his group, and the rest
of the world, read and execute permissions.
For the course/
directory, John has
given himself full permission and no access
to anyone else. Finally,
escalatorlg.jpg
(his background
picture) has read and write permission to him, and
read to everyone else. Notice that there
is no execute permission, as this is neither
an executable nor
a directory, so there is no reason
for anyone to be able to execute it.
OK, so you can read permissions, what about assigning them? One way to code permissions is using:
chmod ABC <file>
Where A
is an integer
representing owner permission level,
B
represents group level,
and C
world level. These
integers must be from 0-7, and they have the
following permissions associated with them:
0
|
---
|
1
|
--x
|
2
|
-w-
|
3
|
-wx
|
4
|
r--
|
5
|
r-x
|
6
|
rw-
|
7
|
rwx
|
Some examples:
|
|
chmod 755 myDir
|
drwxr-xr-x
|
chmod 700 myPrivateDir
|
drwx------
|
chmod 644 myFile
|
-rw-r--r--
|
chmod 600 mySensitiveFile
|
-rw-------
|
chmod 660 myGroupFile
|
-rw-rw----
|
chmod 755 myScript
|
-rwxr-xr-x
|
Customizing your environment involves changing some configuration files. Configuration files are simply text files that contain information that programs use to initialize themselves. (Windows and other operating systems also use configuration files, but you don't typically edit them directly. They are all those .ini files in your C:\Windows directory.) In Linux and other UNIX dialects, configuration files are identified by their leading period ('.'). As a result they are often called "dot files." Editing these files may seem a little intimidating at first (they are pretty important), but once you get the gist of how everything fits together, you will really appreciate the power of the system. This little tutorial won't make you an expert, but it will get you started.
There are four main configuration files responsible for
setting up your environment: .xsession
,
.fvwm2rc
,
.Xdefaults
, and
.cshrc
. All of theses files are
written in something called Shell
Script, which is like a simple programming language.
(Don't get intimidated if you don't know anything about
scripting. It is really easy to learn enough to change your
colors and customize your desktop a little.)
When you log in, the files get executed, creating your
environment. Their roles are as follows:
.xsession
– This is what is
actually executed when you log in. It is responsible
launching the FVWM2 window manager and creating any initial
windows. It is also where your system colors are set, so if
you aren't partial to blue, this is where you want to go.
Modify this file if you want to change the programs and
windows that are launched when you log in.
.fvwm2rc
– This is the
configuration file for the FVWM2 window manager. This file
sets up your window manager display, specifies the contents
and appearance of system menus, and is responsible for
key and mouse bindings. (Key and mouse bindings dictate what
happens when a mouse button or key is pressed. For
example, you could make a binding that said shift-e will
always open Mozilla to the Google homepage, or you can
define keys that will move your mouse cursor.)
.Xdefaults
– Your X defaults
control the initial appearance of your shells and other
programs. If you wanted to change the default size of your
xterm (shell) or something like that, go here.
.cshrc
– This file is not
responsible for anything visual, but it is a very important
configuration file. It is executed every time you create a
shell, and it defines all of the information the shells need
to operate, like where to look for programs and things like
that.
Not to discourage you, but be careful when you are modifying configuration files! While it is unlikely that you will cause any major disasters (the department makes a lot of back-ups), you can cause yourself some headaches if you're not careful. For more information on customizing your environment, talk to a Sun Lab consultant or attend some of the Mini-Courses that will be held in the Sun Lab over the year.
grep
to find a pattern in a
bunch of files, but there were too many results
to fit in a shell. You could "pipe" the output
to more
so you could page through it
like:
grep ROOT_BG .* | more
That would find all the references to
ROOT_BG
(one of your account
colors) in all your configuration files so
you could see what all would change if you
changed the color. This is a very simple
example. You can create very powerful
commands using pipe.
PREVIOUS Emacs |