Link PayPAL

Monday, May 21, 2007

Tutorial Linux Part II

# Basic commands

1. Work with File
    1. Display File
   If you write the command more and a name of a file then the file will be displayed.

User can controle the output:
* press space...the next screen is displayed
* press enter...the next row is displayed
* press q.......the command is finished

Return to Pipe

2. 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.

3. 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.


4. Remove File
The command

rm file_a

removes the file_a from the system at all. If you use 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!

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 Remove Directory


5. Find File
The command

find /usr -name lpr

finds a file lpr in subdirectores in directory usr.


2. Work with Directories
1. 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

No comments: