在你使用UNIX之前,你必须在workstation上有account(帐号),你才能进去使用。 Before you use UNIX, you must have the workstation account (account), you can go use.
在login:出现後,打入帐号名称,然後输入密码,现在你已经完成login的动作,进入UNIX了。 At the login: appears, enter the account name, then enter the password, login now you have completed the action, enter a UNIX. 在进入之後,系统会启动"shell",这个程式会接受你打的指令,去执行它, shell有好几种,有csh、tcsh、sh、bash、ksh...,我主要指的是csh。 After entering the system will start the "shell", the program will accept your instructions to play, to run it, shell there are several, there is csh, tcsh, sh, bash, ksh ..., I refer primarily to the csh. 基本上,我们待会谈的指令都是在shell下输入的。 Basically, our instructions are to be talks in the shell input. 会谈的指令都是在shell下输入的。 Talks are in the shell command input.
当你输入set指令,你会看到一些变数,来看几个重要的: When you enter the set command, you will see a number of variables, several important terms:
home:家。 home: home. Home是你拥有的地方,你可以在这个目录下放置任何东东。 Home is where you have, you can place any directory in this stuff. 你一进入系统,一定是先到这里的。 You enter the system, must be first here.
path:路径。 path: the path. 通常执行档是放在不同的地方,系统会顺著path中的目录一个个去找执行档。 Executable is usually placed in different places, the system will follow the path of the directory one by one to find the executable file.
term:终端机。 term: terminal. 表示现在的终端机形态,常用vt100、vt102、ansi。 That the current terminal morphology, common vt100, vt102, ansi.
set=xxxx就可以设定变数的值,$代表这个变数。 set = xxxx you can set the value of a variable, $ represent this variable.
例如:setterm=vt100 For example: setterm = vt100
setpath=($home/bin$path) setpath = ($ home / bin $ path)
echo$term vt100 echo $ term vt100
□文件系统介绍 □ File System Introduction
UNIX的档案系统呈树状结构,包含了目录(Directory)和档案(file)。 UNIX file system was tree, contains a directory (Directory) and file (file). 如果说你以前有接触过DOS,那应该不陌生;如果没有,那你应该仔细瞧瞧。 If you ever come into contact with DOS, it will be no stranger; If not, then you should take a closer look.
一、目录(Directory) 基本上,目录是用来分类档案的。 A directory (Directory) Basically, the file directory is used for classification.
目录下面可以包含许多档案,或是许多目录,而这些下层的目录就叫″子目录″(subdirectory),它们也都具有相性质。 Directory can contain many files, or the number of directories, which are lower directory called "sub" (subdirectory), they also have a relative in nature. 由这些目录所构成的一层层分枝,看起来就像一棵树,所以才叫树状结构,而最上面的目录称作″根目录″。 Posed by these directories branching layers, looks like a tree, so called tree structure, and the top of the directory called "root."
一个目录在建立的时候,具有两个基本项目:″.”和″..”。 A directory in the establishment of the time, has two basic items: "." And ".."。 ”.”指的是目录本身,而″..”指的是上一层的目录,这两个是一直跟著目录共存亡的。 "." Refers to the directory itself, and ".." refers to the parent directory, the directory of these two is always followed by a total of survival.
这是档案系统简图,很像一棵树吧! This is the file system diagram, much like a tree now!
┌Joe..... ┌ Joe .....
│┌Mail┬joe │ ┌ Mail ┬ joe
││├Mary │ │ ├ Mary
┌—users┼Tom┤└Eric ┌-users ┼ Tom ┤ └ Eric
││└dead.letter │ │ └ dead.letter
│└Mary┬Mail..... │ └ Mary ┬ Mail .....
│└.... /┼—bin┬ls │ └ .... / ┼-bin ┬ ls
│├mail │ ├ mail
│├rm │ ├ rm
│└cp │ └ cp
└—tmp └-tmp
二、档案(file) 档案是储存资料的地方,这个资料可能是一份文字档,也可能是一个可执行的程式,不同功能的档案,有著不同的属性,现在来看看。 Second, the file (file) file where the data is stored, this information may be a text file, it may be an executable program file different functions, have different properties, and now look.
%ls-l % Ls-l
total1059 total1059
drwx------4 jong 512 Sep614:54 Mail drwx ------ 4 jong 512 Sep614: 54 Mail
drwxr-xr-x2 jong 512 Oct2219:02 News drwxr-xr-x2 jong 512 Oct2219: 02 News
在每个档案前有十个字,第一个字元是档案形式,d指目录,-指档案,l指连结(link)档案。 In ten words of each file before the first character is the file format, d refers to the directory, - refers to the file, l refers to the link (link) file.
从二到十是属性,三字一组,一共三组。 From two to Ten is property of, a group of words, a total of three groups. 一组三字代表<读、写、执行>,即rwx,-则表无此属性。 A group of words on behalf of
rw-------只有owner可读写r-xr-xr-x可读、执行,不可写 only the owner can read and write rw ------- r-xr-xr-x read, execute, can not write
rw-r--r--owner可读写,其他只可读档案的名字除了"/"之外,都可以用,随便多少都可以。 rw-r - r - owner can read and write, others read only the file name except "/" but can be used, just how much can be.
档案开头是"."的档案是隐藏档,平常看不到,要用ls-a或ls-al来看。 Beginning of the file is "." The file is a hidden file, usually do not see, use ls-a or ls-al point of view.
□进程(process) □ process (process)
一个正在执行中的程序,我们称做process。 A program is running, we called the process.
UNIX是多工的系统(multitasking), 可以同时执行多个程式,让好几个人同时使用系统,执行程式。 UNIX is a multi-tasking system (multitasking), you can run multiple programs simultaneously, so that several people simultaneously using the system, run the program.
执行程式可分为两种: Run the program can be divided into two types:
前景执行(foreground)和背景执行(background)。 The foreground (foreground) and background (background).
一般我们在shell下执行程式,一直要等到程式结束才能继续输入指令,这就是前景执行。 Generally, we run the program in the shell, has been to wait until the end of the program can continue to enter the command, which is the foreground.
如果说我们不想等待程式结束, 或是执行时间太长,就可以将程式放到背景去执行,系统会自动执行它,而你就可以去做别的事了。 If we do not want to wait for the end of the program, or taking too long, you can program into the background to perform, the system will automatically execute it, and you can do anything else. 怎样才能把程式放入背景? How can we program into the background? 只要在指令後面加上"&"就可以了。 As long as the command followed by "&" on it. 一但你在背景执行程式,系统会传回"[n]xxxx",n是jobid,xxxx是processid。 Once you run the program in the background, the system will return "[n] xxxx", n is the jobid, xxxx is processid. 每一个process都有processid,而且不会有重覆。 Each process has processid, but there will be no repeat. 要想停止前景执行的程式,可以按CTRL_C 中止,若是想暂停一下,可以按CTRL_Z 暂时停止执行,要恢复执行可以用fg或bg来决定前景或背景执行。 To stop the foreground of the program, you can stop by CTRL_C, if would like to pause, you can temporarily stop execution by CTRL_Z to resume with fg or bg can determine the foreground or background.
Tidak ada komentar:
Posting Komentar