UNIX环境高级编程英语阅读学习第一章第一节.

1.1.Introduction    

      All operating systems provide services for programs they run.Typical services include executing a new program,opening a file,reading a file,allocating a region of memory,getting the current time of day,and so on.The focus of this text is to describe the services provided by various versions of the UNIX operating system.

      所有的操作系统都向他们运行的程序提供服务。典型的服务有执行新程序,打开文件,读文件,分配存储区,获得当前时间等等。这本书集中阐述了UNIX操作系统各种版本所提供的服务。

      Describing the UNIX System in a strictly linear fashion,without any forward references to terms that haven't been described yet,is nearly impossible (and would probably be boring).This chapter provices a whirlwind tour of the UNIX System from a programmer's perspective.We'll give some brief descriptions and examples of terms and concepts that appear throughout the text.We describe these features in much more detail in later chapters.This chapter also provides an introduction and overview of the services provided by the UNIX System,for programmers new to this environment.

      以严格的步进方式,不超前引用尚未说明过的术语的方式来说明UNIX几乎是不可能的(可能也会是令人厌烦的)。本章从程序员角度快速浏览UNIX,并对书中引用的一些术语和概念进行简要的说明和给出实例。在以后的章节中,我们将对这些概念做更详细的说明。本章也对不熟悉UNIX的程序人员简要介绍了UNIX提供的各种服务。

1.2. Logging In

 

1.2.1 Login Name    

 

 

      When we log in to a UNIX system, we enter our login name, followed by our password. The system then looks up our login name in its password file, usually the file  /etc/password. If we look at our entry in the password file we see that it's composed of seven colon-separated fields: the login name, encrypted password, numeric user ID (205), numeric group ID (105), a comment field, home directory(/home/sar), and shell program (/bin/ksh)All contemporary systems have moved the encrypted password to a different file. In Chapter 6, we'll look at these files and some functions to access them.

 

      登录 U N I X 系统时,先键入登录名,然后键入口令。系统在其口令文件,通常是/etc/password 文件中查看登录名。口令文件中的登录项由 7 个以冒号分隔的字段组成:登录名,加密口令,数字用户 ID(205),数字组ID(105,)注释字段,起始目录(/home/sar)以及shell程序(/bin/ksh).很多比较新的系统已将加密口令移到另一个文件中。第 6章将说明这种文件以及存取它们的函数。
1.2.2 shells  

      Once we log in, some system information messages are typically displayed, and then we can type commands to the shell program. (Some systems start a window management program when you log in, but you generally end up with a shell running in one of the windows.) A shell is a command-line interpreter that reads user input and executes commands. The user input to a shell is normally from the terminal (an interactive shell) or sometimes from a file (called a shell script). The common shells in use are summarized in Figure 1.2.

 

      登录后,系统先显示一些典型的系统信息,然后就可以向shell程序键入命令。shell是一个
命令行解释器,它读取用户输入,然后执行命令,用户通常用终端,有时则通过文件 ( 称为
shell脚本 )向shell进行输入。常用的shell总结在表1.2中(见上)。

 

     The system knows which shell to execute for us from the final field in our entry in the password file.

     系统从口令文件中登录项的最后一个字段中了解到应该执行哪一个shell。

 

1.3 Files and Directories

File System

 

        The UNIX file system is a hierarchical arrangement of directories and files.Everything starts in the directory called root whose name is the single character /.

        UNIX文件系统是目录和文件的一种层次安排,目录的起点成为根(root),其名字是一个字符/。

        A directory is a file that contains directory entries.Logically,we can think of each directory entry as containing a filename along with a structure of information describing the attributes of the file.The attributes of a file are such things as type of fileregular file,directory the size of the file,the owner of the file,permissions for the filewhether other users may access this fileand when the file was last modified.The stat and fstat functions return a structure of information containing all the attributes of a file.In chapter 4,we'll examine all the attributes of a file in great detail.

        目录是一个包含目录项的文件,在逻辑上,我们可以认为每个目录项都包含一个文件名,同时还包含说明该文件属性的信息。文件属性是:文件类型,文件长度,文件所有者,文件的许可权,文件最后的修改时间等。stat和fstat函数返回一个包含所有文件属性的信息结构。将在第4章详细说明文件的各种属性。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值