- Stahuj zápisky z přednášek a ostatní studijní materiály
- Zapisuj si jen kvalitní vyučující (obsáhlá databáze referencí)
- Nastav si své předměty a buď stále v obraze
- Zapoj se svojí aktivitou do soutěže o ceny
- Založ si svůj profil, aby tě tví spolužáci mohli najít
- Najdi své přátele podle místa kde bydlíš nebo školy kterou studuješ
- Diskutuj ve skupinách o tématech, které tě zajímají
Studijní materiály
Hromadně přidat materiály
Quick Linux Tutorial Jaří Vogel
2012033ZAPG - Základy algoritmizace a programování
Hodnocení materiálu:
Zjednodušená ukázka:
Stáhnout celý tento materiálng of disk pack /tmp Directory for temporary data sets /usr Other system programs /var Files which are being updated during system running HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Other Information
Wildcards * and ?
* represents any sequence of symbols (0 or more), e.q. h* represents how hop htrupp.c high help etc.? represents any symbol; e.q.IMPJET2?.DAT represents IMPJET21.DAT IMPJET24.DAT IMJET27.DAT etc.
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "rem1" Return to Remove File HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Input and Output Redirection
The command
p < my_in_file > my_out_file
causes input to the executable program p from my_in_file and output from the program p to the my_out_file. It is written from the beginning of this file.
The command
p < my_in_file >> my_out_file
has the same meaning but the output is appended to the contents of my_out_file
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Another Commands and Examples
Concatanation
The command cat concatenates files and prints on the standard output.
ExampleIf 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
causes the output:
The quick brown fox
jumped over a lazy dog.
If you write
$ cat A B > C
Then the same text is written to the file C.
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Pipe
If you write
ls -l |more
the operator | connect data of two processes. In this
matter contents of the working directory is scrolled according to the
process which is defined by the HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "dis" command more.
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Starting and Stopping Processes in the Background
If you write for example
$ p&
[1] 13456
the process p starts and it is running on the background. The number which appears in the screen is PID (Process Identification Number). You can do on the foreground other activities but you can stop the process p at any time by a command
$ kill -9 13456
which stops the process p before this has been finished
normally.
You can sometimes work on a distant host computer ( HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "work1" see), your process will end in infinite loop (or it seems it lasts too long) and you forgot its PID; you can use command (if your username is for example smith):
ps -u smith (some systems do ps -u)
and all your processes are displayed.
Example:
$ ps -u vogel
PID TTY TIME COMMAND
13536 ttyp2 0:00 ps
13041 ttyp6 0:00 bash
13525 ttyp2 3:09 p
12966 ttyp4 0:00 bash
13128 ttyp5 2:57 netscape
12985 ttyp5 0:00 bash
13295 ttyp4 0:03 xterm
13296 ttyp2 0:01 bash
12984 ttyp4 0:11 xterm
13040 ttyp4 0:08 xterm
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Manual and Command man
The important command of Unix/Linux is a command man.Command man accesses information from the on-line version of Unix/Linux. You can find the description of man by
man man.
The whole command is for example:
man 1 cat
where 1 is the number of a section. Number 1 need not be written. The number of section is usually mentioned in parentheses behind the referred keywords.
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Quick Tutorial for Editor vi
Invoking vi
If you write a command
vi my_file
you will see the screen with a column of tildes. The editor vi is now in so called command mode.
The screen looks like:
~
~
~
~
~
~
~
~
~
The two basic commands are the following:
i Insert text to the left of cursor a Insert text to the right of cursor Since you are at the beginning of an empty file it does not matter which of these you type. Write a text:
Dear Mr Jones,
Thank you for your letter of January 16th.
I will be happy to see you on January 30th.
I suggest you catch the train which leaves
Victoria station at 10.40 and reaches Cantebury at 12.03
I will arrange to meet you at the station.
I will look forward to meet you and
hearing about your proposals.
Yours sicerely
J. B. Show
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Cursor Movements Commands
You need to be in the command mode. If you do not now what mode is actual, press the buttom esc. This keystroke always turns the editor in the command mode. Then you can move along the screen if you keystrokes the button:
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 HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
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 If you are in command mode and you will write
:set smd nu
(where smd means Show MoDe and nu means NUmber),you will now see the mode at the right down corner (usually) and all lines are numbered.
1 Dear Mr Jones,
2
3 Thank you for your letter of January 16th.
4 I will be happ to see you on January 30th.
5 I sugest you catch the train which leaves
6 Victoria station at 10.40 and reaches Cantebury at 12.03
7 I will arrange to meet you at the station.
8 I will look forward to meet you and
9 hearing about your proposals.
10
11 Yours sicerely
12
13 J. B. Show
INPUT MODE
Now go to the 6th line - move the cursor underneath the number 2 press letter x. Pres i and write number 3
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
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 HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Replace Mode
Very useful is so called replace mode which enables overwrite the existing text.
Keystrokes Doing :r Replace one character over the cursor :R Overwrite text until the next action (e.g. keystroke of esc) HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
What is next
The several commands you have learned could be enough for your work. If you will more to know - you can learn to move one text from one place to another in one file or to move a part of the text from one file to another one. In all there are about 150 commands.
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Work at a distant host
If you want to use your PC with implemented Linux as a terminal of some workstation with the address hal.ruk.cuni.cz, you can write:
xhost +
rlogin hal.ruk.cuni.cz
This script switches your PC as a terminal to the host computer. You are asked for your password on the host. (If you use command telnet instead of rlogin, you are asked for your username on the host, too.) You must now inform the host about your PC to enable the x-windows to run on your personal computer. It can be done by the script:
xterm -display jura.fsid.cvut.cz:0 &
where jura.fsid.cvut.cz is address of your PC.It is useful to write the first script as a file (or an alias) on your computer, and the second script as a file (or an alias)on the host.
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "linux" Return to Getting Started HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "kill" Return to kill HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Vloženo: 25.04.2009
Velikost: 149,00 kB
Komentáře
Tento materiál neobsahuje žádné komentáře.
Copyright 2025 unium.cz


