Some useful things to know about linux
1 The linux manual - man and apropos
If you know the name of a command, type man <command> to nd out
more about it. In particular man will tell you about the ags that a given
command uses (for instance why do I use 'ls -la' rather than 'ls', or 'rm -i'
instead of 'rm'? Try typing man rm for instance to nd out).
There is another command whatis that gives a very short description
of any other command (e.g. try whatis whatis). The command man does
everything that this does, but I include it for completeness.
apropos <something> will look for every command that has the words
<something> in its manual page. It will often produce a long list of
possibilities,
but it can be useful if you have no idea where to start.
2 Directories - ls, cd
Directories are just a good way of organising your les. Just as it is better
to organise papers in folders, so it is better to put your les into separate
folders
Mike
algebra
lectures
.icewm
.mozilla
family
South_africa
An example directory structure
cd pictures
cd ..
cd ..
pictures
notes physics
public_html
2.1 Making and deleting directories - mkdir and rmdir
To make a directory, type mkdir <folder name> where you should replace
<folder name> with something that you understand.
To delete (remove) a directory, type rmdir <directory name>. This
only works if there is nothing in the directory (try looking at man rmdir
to see how to override this).
2.2 Moving around and seeing what is in a directory - cd
and ls
To go into that folder type cd <folder name>. Then if you want to see what
les there are in the folder, type ls. Your home directory is /aims/home/<your
user name>. This is abbreviated to (pronounced 'tilde'), so that cd will
take you to your homepage from any other directory. To move 'up' one
directory (ie towards the 'root' directory /) type cd ... To move 'down' one
directory, type cd <directory name>.
3 Renaming, removing and creating les
3.1 Deleting les - rm
The command for this is rm < lename>. BE VERY CAREFUL WITH
THIS COMMAND!!! You will not be asked to con rm this, and you could
very well delete something important.
3.2 Renaming, or moving, les - mv
Moving a le is the same as renaming it. The command to do this is
mv< lename>. In fact a le can be moved to a di
erent directory with
2
this command. Suppose you want to move the le mike1.tex to the directory
my les. Then the command mv mike1.tex my les/ will move the
le to the directory, but keep the same lename (mike1.tex).
To move all les beginning with prog to a directory called c programs,
type mv prog* c programs/. This uses a wildcard character - see below
for more details. Similarly, to move all programs ending in .tex into a latex
folder, type mv *.tex latex/
In short, a wildcard character means 'any combination of letters or symbols'.
The two special characters are '*' (any number of characters), and ' ?'
(wildcard for a single character).
3.3 Creating les
So how to create les? You already know many ways - create tex, html, C
les with emacs (or vim), download from the internet, draw with x g (or
metapost), save from Octave and Xmaxima. A few other things that are
useful:
gimp (to run, type gimp). This is a powerful graphics manipulation
program - try modifying a picture with it!
When you run latex it produces a le of the type .dvi. By converting it
with dvips you create a postscript le that can be viewed using gv (to run
this type gv < lename>.
3
Latex file
dvi file
postscript
file
latex <filename.tex>
dvips <filename.dvi>
gv <filename.ps>
4 Printing - lpr and lpq
If you want to print a text le, simply type lpr < lename>.
5 What to do when the computer stops working
properly (crashes)
If your program is not responding (it doesn't look right, you can't type
things in with the keyboard, and it will not close), then it has probably
crashed. If this is the case, then you need to tell the computer to close that
program. The way to do this is to type ps -auxw which will list all the
processor (computer) commands currently being run. The ones you want
will normally be near the end. If you nd the program you want to get rid of,
type kill <number> where the <number> is the 4 or 5 digit number in the
second column of the list. This may not work - if this is the case try typing
kill -9 <number>. However do not use this rst, because it immediately
kills the program without giving it a chance to shut down properly, which
4
may cause problems.
If there are many jobs to be got rid of, try typing killall <name>, where
the name is the process to be killed, as written in the list given by ps -auxw.
This is the same as kill, it just saves time if there are many processes to be
killed.
ps −auxw
Gives processer i.d. number
kill <number>
Should get rid of program
kill −9 <number>
Will get rid of program
(only for use if kill doesn’t
work)
killall <name>
kills every process called
<name>
NOTE THAT YOU SHOULD TAKE CARE WHEN 'KILLING' PROCESSES.
IF YOU KILL ONE THAT YOU DIDN'T MEAN TO YOU WILL
LOSE ANY UNSAVED INFORMATION FROM THAT PROGRAM.
6 Making your les private - chmod
When you save les in your directory the default is that noone else can read
them. To check this type ls -l - this will list the les in your directory with
their readability shown in the rst columns on the left ('r' means readable,
'w' writable, and 'x' executable - for directories). If only the rst four
spaces are occupied, then noone else can read your les. If however, you
have something like '{rw-rw-rw-' then anyone can read and write to that
le.
To change the le access permissions, use chmod. There are several
ways to do this (see man chmod for more information), but I tend to use
chmod a-r < lename> to to change a le so that it is no longer readable
by 'all'.
7 Key shortcuts
There are some useful keys everyone should know about. Firstly the <tab>
key. this will autocomplete any command or lename if it is unique (and
will normally display all possibilities if hit repeatedly otherwise).
5
Other keys I use all the time are the up and down arrow keys. These
give the last commands that you typed in previously (try them).
Compare this to Ctrl+r, which also gives you access to your history. Try
pressing Ctrl+r, then typing the beginning of a command you have recently
typed in that window. You will nd thatit should be completed for you!
By creating a le called keys in the directory /.icewm you can add other
key shortcuts for things you do often.
Please send additions, comments and corrections to serin
Keep up with people you care about with Yahoo! India Mail. Learn how.
http://in.overview.mail.yahoo.com/connectmore
_______________________________________________
Discuss mailing list
Discuss@lists.fsugtsr.org
http://lists.fsugtsr.org/mailman/listinfo/discuss