Linux Tutorial
Linux Tutorial
Contents
1. Literature
2. Unix History
3. Linux History
4. Linux Features
5. Getting Started
6. Termination of a Program
7. Leaving the System
8. Password Changing
9.
Basic Commands
1.
1. Display File
2. Copy File
3. Rename and/or Move File
4. Remove File
5. Find File
2.
Invoking vi
1.
Cursor Movements Commands
2.
Deleting text
3.
File Saving
4.
Replace Mode
5.
What is next
6.
11. Work at a Distant Host
http://www.castrop-
rauxel.netsurf.de/homepages/m.hussmann/linux.html
or
Return to Contents
Return to Contents
3. Linux History Linux was written by Linus Torvalds and has been
improoved by countless number of people around the word. It was
initially developed for small PC.
Return to Contents
4. Linux Features
multitasking: several programs running at once
multiusers: several users at the same machine at once
multiplatforms: it runs on many different CPU
5. Return to Contents
6. Getting Started You can login to an UNIX operating system after
you had been assigned a username by a system administrator.
After a not very complicated procedure, which unfortunately alters
according the taste of concrete system administrator you should
see something like the following:
$login:
Attention!
Stand at easy!
After entering your username you will be faced with the following:
$password:
and you must written your password. (At first you will be given a
password from a system administrator and you can change it at
any time.)
$
or a little detailed prompt
marian:~$
$ who
Return to Contents
7. Termination of a Program Use (usually) keystroke ctrl-c
8. Leaving the System
logout
or
exit
Return to Contents
9. Password Changing If you want to change your password, you will write
the command passwd
If you write your old password and a new password correctly, the new
one becomes valid.
Return to Contents
cp file_1 file_2
Return to Contents
mv file_1 file_2
Return to Contents
rm file_a
rm h*c
rm *
rm -i *
it will be done also but the system will ask for
permission before removing each file.
The command
rm -r your_file
Attention!
Command
rm -r /
will erase all your directories (including not empty
directories). If you were a system administrator you
should be sent to mad-house; but alas! Too late.
Stand at easy!
Return to Contents
Return to Contents
ls
Example:
$ ls
BFCPLOT.TMP.gz IMPJET25.CAS TRYSKA21.gz
nparal.f ECK.gz IMPJET25.DAT TRYSKA23 par.f.gz
ECKERT.CAS.gz IMPJET26.CAS TRYSKA24
parmat.f.gz ECKERT.DAT.gz IMPJET26.DAT
TRYSKA25 parts ECKERT.GRD.gz IMPJET27.GRD
TRYSKA26 psryi1.xls ECKERTN.DAT.gz Mail
alfa22.xls.gz psy23.xls.gz IMPJET13.CAS.gz
OSA_X12.gz aly23.xls.gz psy25.xls.gz
IMPJET13.DAT.gz OSA_X16 aly24.xls.gz
psy26.xls.gz IMPJET14.CAS.gz OSA_X17.gz
aly25.xls.gz ptrzj1.xls IMPJET14.DAT.gz OSA_Y12.gz
aly26.xls.gz ptz23.xls.gz IMPJET16.CAS.gz
OSA_Y16 bin ptz25.xls.gz IMPJET16.DAT.gz
OSA_Y17.gz dipsb top.dump IMPJET16.GRD.gz
PLUME dispb vmy23_00.xls.gz IMPJET17.CAS.gz
PLUMEZJ dispd vmy25_00.xls.gz IMPJET17.DAT.gz
PLUMEZJ.CAS dispj vmz23.xls.gz IMPJET18.CAS.gz
PLUMEZJ.DAT dispk vmz25.xls.gz IMPJET18.DAT.gz
STREAM25.PS.gz dispm wmyi1.xls
IMPJET19.CAS.gz TRSKA26.gz dumpster
wmyi160.xls IMPJET19.DAT.gz TRYSKA12.gz
kont.f.gz wmzj1.xls IMPJET21.CAS.gz TRYSKA13
license.log.gz x IMPJET21.DAT.gz TRYSKA14
matmul.f.gz zp1 IMPJET23.CAS TRYSKA16 mbox
IMPJET23.DAT TRYSKA17.gz mulcad $ If the
command ls is written with parameter -l then the
command lists contents of the working directory with
details.
Example:
$ ls -l
cd try_it
Return to Contents
3. Moving in Directories
Command Meaning
cd try_it Change directory
mkdir my_dir
rmdir your_dir
Return to Contents
Character Meaning
r Permission for reading
w Permission for writing
x File is executable
$ ls -l nparal.f
Return to Contents
11. Postfix
Meaning
.c Source program in C language
.f Source program in Fortran 77
.f90 Source program in Fortran 90
.p Source program in Pascal
.pbm bi-level, black and white image (2 bits per pixel)
.pgm grayscale (8 bits per pixel)
.ppm color (24 bits per pixel)
compressed by JPEG
.jpg
Return to Contents
12. Determine File Type The type of file can be detected by a
command file.
Example:
$ file kvsortrec.f90
Return to Contents
The command
Return to Contents
Example
If in a file A is written The quick brown fox jumped
and in a file B is a text over a lazy dog. then
command
$ cat A B
If you write
$ cat A B > C
Return to Contents
2. Pipe
If you write
ls -l |more
Return to Contents
$ p&
[1] 13456
$ kill -9 13456
Example:
$ ps -u vogel
Return to Contents
man man.
man 1 cat
Return to Contents
vi my_file
Dear Mr Jones,
Yours
sicerely
J. B.
Show
Return to Contents
Keystroke of Doing
h Cursor is moved one space to the left
j Cursor is moved one line down
k Cursor is moved one line up
l Cursor is moved one space to the right
Return to Contents
3. Deleting Text
If you are in command mode then
Keystroke of Doing
x Delete one character at the cursor
dd Delete one line where the cursor is placed
:set smd nu
1 Dear Mr Jones,
10
11
Yours sicerely
12
13
J. B. Show
INPUT MODE
Return to Contents
4. File Saving
You must be in command mode. You can use then several tricks to save the file:
Keystrokes Doing
:x Write file to the disk and finish
ZZ Write file to the disk and finish
:w Write file to the disk and continue
Return to Contents
5. Replace Mode
Very useful is so called replace mode which enables overwrite the existing text.
Keystrokes Doing
:r Replace one character over the cursor
Overwrite text until the next action (e.g.
:R
keystroke of esc)
Return to Contents
6. What is next
Return to Contents