- 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álRLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "pip" Return to Pipe HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Copy File
The command
cp file_1 file_2
copies file_1 to file_2. The both files must be in the same working directory. If they are in various directories, the path must be given.
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Rename and/or Move the File
The command
mv file_1 file_2
moves file_1 to file_2. The both files must be in the same working directory. If they are in various directories, the path must be given. The file_1 is removed from the disk.
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Remove File
The command
rm file_a
removes the file_a from the system at all. If you use HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "wil" wildcard. For example
rm h*c
you will remove all files beginning with h and ending with c which are in working directory. If you write
rm *
you will erase all files from your working directory. If you write
rm -i *
it will be done also but the system will ask for permission before removing each file.
The command
rm -r your_file
causes removing of the directory your_file even if this directory is not empty.
Attention!
Commandrm -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!
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "remo1" Return to Remove Directory
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Find File
The command
find /usr -name lpr
finds a file lpr in subdirectores in directory usr.
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Work with Directories
List Contents of the Working Directory
The command
ls
displays the names of all subdirectories and files in the working (current, actual) directory.
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
-rw-r--r-- 1 vogel user 1209041 May 1 13:55 IMPJET24.CAS
-rw-r--r-- 1 vogel user 10259798 May 1 20:57 IMPJET24.DAT
-rw-r--r-- 1 vogel user 1209041 May 1 13:43 IMPJET25.CAS
-rw-r--r-- 1 vogel user 6860385 May 1 23:17 IMPJET25.DAT
-rw-r--r-- 1 vogel user 1209041 May 1 14:12 IMPJET26.CAS
-rw-r--r-- 1 vogel user 10259798 May 1 14:12 IMPJET26.DAT
-rw-r--r-- 1 vogel user 2030624 May 1 11:04 IMPJET27.GRD
drwx------ 2 vogel user 22 Apr 9 1997 Mail
-rw-r--r-- 1 vogel user 2661 Nov 22 13:48 OSA_X12.gz
-rw-r--r-- 1 vogel user 4153 Nov 22 14:01 OSA_X16
-rw-r--r-- 1 vogel user 2399 Nov 22 14:08 OSA_X17.gz
-rw-r--r-- 1 vogel user 2299 Nov 22 13:50 OSA_Y12.gz
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Change Working Directory
The command
cd try_it
changes the directory try_it which path is given relative to the working directory. If the working directory is, for example, /home/smith then the working directory will become /home/smith/try_it
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Moving in Directories
Command Meaning cd try_it Change directory pwd Print working directory (e.g. /home/smith/try_it) cd .. Move to superior directory pwd Print /home/smith cd /home The absolute path pwd Print /home cd The system is returned to the user home directory pwd Print /home/smith HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Make Directory
The command
mkdir my_dir
makes new directory my_dir (the path is given relative) as a subdirectory of the current directory.
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Remove Directory
The command
rmdir your_dir
removes directory your_dir if it is empty. If you want to remove not empty directory, HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "empty" see.
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Access Permission of File
Example
$ ls -l nparal.f
-rw-r--r-- 1 vogel user 776 Aug 30 1995 nparal.f
The first column is empty for data and programs or in first column is written character d if the item is directory etc. The next three columns are permissions for the user, the columns 5, 6, 7 for the user's group (in this example the group is called user), and the last three for the rest of the word. The next information in the row is the size of the file (in bytes), the date of the last update, and the name of the file. The next table clarifies the meaning of the letters written from the 2nd to the 10th column:
Character Meaning r Permission for reading w Permission for writing x File is executable If we want to allow people from the user's group to read this file and the rest of the word will be unable even to read this file, we will write the command:
$ chmod 760 nparal.f
The access permission looks now like:
$ ls -l nparal.f
-rwxrw---- 1 vogel user 776 Aug 30 1995 nparal.
To understand this you must know that number 1 "allows" and number 0 "suppresses" access permission and you need to know relation between octal and binary numbers:
Octal scale Binary scale 0 000 1 001 2 010 3 011 4 100 5 101 6 110 6 110 7 111 HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Some Postfixes of Files
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) .jpg compressed by JPEG HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Determine File Type
The type of file can be detected by a command file.
Example:
$ file kvsortrec.f90
kvsortrec.f90: fortran program text
HYPERLINK "http://www.fsid.cvut.cz/en/U201/linux.html" \l "con" Return to Contents
Structure of Standard Directories in Unix/Linux
Directory Meaning /bin Directory for system command /dev Directory with special files which enable to work with pheripheral devices /etc System programs and data /home User's home directories /lib Libraries /mnt Directory for mounti
Vloženo: 25.04.2009
Velikost: 149,00 kB
Komentáře
Tento materiál neobsahuje žádné komentáře.
Copyright 2025 unium.cz


