Sunday, January 11, 2009

ES150 Unit 1

ES150
Purpose
ES150 introduces the base elements ,optional fetures,and server provided in Z/OS and OS 390. It focused on the system service facilities provided by the Z/OS and OS/390 Base Control Program(BCP).
Prerequisites Learners should have practical experience with logging on to TSO and working with JCL. This experience can be obtained by attending to ES10-Fundamental System Skills for Z/OS and OS/390 .
Unit 1 Z/OS and OS Overview
What is Z/OS?
The ultimate mainframe operating system
-A packaging of over 70 different solutions
  • Base operating system.
  • Many industry exclusives:workload manager,parallel sysplex,intelligent resource director
  • Key e-business services:networking,security,storage management,distributed files and print
-Unix built right into the base
-Exploiting the techs of the IBM E Server zSeries 800,IBM E Server zSeries 900.
notes:highly secure,high-performance enterprise OS on which to build and deploy Internet and Java-enabled applications,providing a comprehensive and diverse application execution environment.
Z/OS is the next generation of OS 390
Z/OS and OS 390 play a major role in the implementation of today's and future IS installation by integrating the heterogenous components to a solution that is able to cope with the complexity of this enviroment
Z/OS and OS 390 can run on the IBM eServer zSeries 800,900 and 990 machines,which are designed for the high-performance data and transaction needs demanded by next generation e-business.
Before the introduction of OS 390,the system 390 consisted of many different products that are required to be ordered ,installed and maintained seperately.After that,Z/OS and OS 390 can be ordered by customers and customers can receive a tailored package of all the base and optional products they need for their IS installation. IBM makes sure that all products shipped with the order are at the proper release level, and that all prerequisites are met. The z/os and OS 390 packages come in a pretested and easy-to-install form,whichi reduces installation and testing time considerably.Once Z/OS or OS 390 is in place ,IBM provides several differenct ways to keep your installation up-to-date.
Historical Perspective

notes:The BCP for z/OS and OS/390 is built on the MVS operating system. BCP and MVS can be used interchangeably in the documentation for z/OS and OS 390.
MVS/370->MVS/XA->MVS/ESA(open c/s solutions,object tech,network connectivity)
VTAM,TSO/E,ISPF/PDF,RACF,DFSMSdfp,JES2/JES3,SMP/E
to upgrade one product may involve upgrading mutiple other products to solve product dependencies.
IT Requriements:
1.Availability and Reliability: automatic recovery capabilities,dynamic reconfiguration,robustness as a minimum computer infrasture.
2.Application technology choice:Demand for new techs.Demand for shorted application dev cycles and easier maintenance.
3.Service to end users: easy-to-use interfaces and continuous availability of the applications.
4.Enterprise-wide systems management,network and security integration.
Integrated Solutions
DFSMSdfp SNA
JES2/JES3 IP
GDDM Unix
Assembler DCE
TSO/E LE
ISPF BCP
BookManager RMF
RACF SMP
SMP/E
the last release of os 390 was Release 10 delivered in Sep.2000.The first release of z/OS was delivered March 2001.
Each release has General Availability(GA) data and an out of service date.
Elements and Features
To develiver the release in customer-tailored version,z/os and os/390 consist of base elements and optional features(priced or no charge).The IBM-supplied SYS1.PARMLIB member that defines product enablement policy for a system is IFAPRD00.
notes: elements of z/os ,categoried by functional group
1.system services 2.communication services 3.application enablement services 4.Distributed computing services 5.system management and security services 6.LAN services 7.z/os unix system 8.softcopy publications support 9.e-business services
z/OS.e- a specially priced z/os offering available at a fraction of the cost of z/os.
1.run on z800 only 2. for enterprise and e-business applications only(can not run traditional workload such as CICS,IMS,COBOL,FORTRAN)3.same code base as z/os.
Z/OS.e‘s new workloads consisted of Websphere Application Server /Commerce,Domino and ISV's middleware written in Java ,C/C++,J2EE

Thursday, January 8, 2009

route 笔记2

route print命令

C:\Documents and Settings\1st>route print

======================================================================

Interface List

0x1 ........................... MS TCP Loopback interface

0x2 ...00 0a e4 54 b7 20 ...... Realtek RTL8139 Family PCI Fast Ethernet NIC -

acket Scheduler Miniport

======================================================================Active Routes:

Network Destination Netmask Gateway Interface Metric

0.0.0.0 0.0.0.0 192.168.0.13 192.168.0.3 30

0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.3 40

127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1

192.168.0.0 255.255.255.0 192.168.0.3 192.168.0.3 30

192.168.0.3 255.255.255.255 127.0.0.1 127.0.0.1 30

192.168.0.255 255.255.255.255 192.168.0.3 192.168.0.3 30

224.0.0.0 240.0.0.0 192.168.0.3 192.168.0.3 30

255.255.255.255 255.255.255.255 192.168.0.3 192.168.0.3 1

Default Gateway: 192.168.0.13

======================================================================

Persistent Routes:

None

在显示内容列中:

Network Destination 表示目的网络

Netmask 表示子网掩码

Gateway 网关地址

Interface 接口(网卡)

Metric 这里表示路由优先值

其中目的网络和掩码全0表示任意网络。如这一条:

Network Destination Netmask Gateway Interface Metric

0.0.0.0 0.0.0.0 192.168.0.13 192.168.0.3 30

是表示去网往任意网络的IP数据包将被送到网关设备192.168.0.3上去。这种全0的路由通常是指上internet的路由,也称默认路由,俗称指网关。

大家可否注意到这里有两条的默认路由,如下:

Network Destination Netmask Gateway Interface Metric

0.0.0.0 0.0.0.0 192.168.0.13 192.168.0.3 30

0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.3 40

它们的区别在于Metric值不同,那么这样的路由有什么用处呢?

前面已讲到Metric值是表示路由的优先值,所以理论上讲这两条路由可以实现互为备份的 作用,也就是说本地主机192.168.0.3/24这个台主机所属网段里存在两台可以上internet的设备或主机,分别是192.168.0.13 和192.168.0.1,假设网络内192.168.0.13这台设备或主机掉电停机后那么本地主机将自动将网关切换到192.168.0.1上,注意 必需是192.168.0.13掉电或与本地主机网络隔离才会切换本地主机才会切换网关,如果只是拔掉其接外网线路(如adsl)本地主机是不会有任何动 作的。

那么将Metric值改成相等又是否有可以实现负载均衡呢?

两个2M的adsl加起来就是4M了,这个需求对某些用户还是很吸引人的。

答案是,理论上可以的。大多数路由器可以实现windows 2000是否可以实现,本人还没有做实验证实;各位如果有空可以找个环境做一下,别忘了告诉我结果!

看了前面我写的这些你也许对找出为什么有时adsl拨上号却上不了网原因而有所眉目了。

大 家都知道,我们在建立adsl连接后,网络链接里都至少会有两个本地连接;其中一个是物理网卡的连接,另一个则是adsl的pppoe虚接连接,对应 route pirnt路由表来说也就是两个接口。通常如果你在物理网卡上如果已经设了网关地址,而后又在adsl拨号后又获得一个网关地址;那么此时如果物理网卡所 设的网关的Metric值比adsl所获得的网关Metric值高的话,就会出现adsl拨上号后却不能上网的问题。当然这个问题还有一个前提就是物理网 卡所指的网关设备已不具备连接internet的能力。

更多关于route命令的参数请参考route /?

解释route print 命令

本帖发表在我是网管论坛,帖子地址:http://bbs.54master.com/209460,1,1
本机地址:202.256.257.258
掩码:255.255.255.0
操作系统:w2k server
T:\>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x1000003 ...44 e0 4c 10 43 1d ...... Realtek RTL8139/810x Family Fast Ethernet NIC
===========================================================================
==========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 202.256.257.1 202.256.257.258 1
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
202.256.257.0 255.255.255.0 202.256.257.258 202.256.257.258 1
202.256.257.258 255.255.255.255 127.0.0.1 127.0.0.1 1
202.256.257.255 255.255.255.255 202.256.257.258 202.256.257.258 1
224.0.0.0 224.0.0.0 202.256.257.258 202.256.257.258 1
255.255.255.255 255.255.255.255 202.256.257.258 202.256.257.258 1
Default Gateway: 202.256.257.1
===========================================================================
这 是route命令的第一个参数的输出,首先是最上方给出了接口列表,一个本地循环,一个网卡接口,网卡结构给出了网卡的mac地址。再说说每一列的内容 吧,从做到右依次是:Network Destination(目的地址),Netmask(掩码),Gateway(网关),Interface(接口),Metric(也不知道是什么,姑 且认为是一个度量值或是管理距离)。
下面说说每一行内容代表的内容,首先是
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 202.256.257.1 202.256.257.258 1
这表示发向任意网段的数据通过本机接口202.256.257.258被送往一个默认的网关:202.256.257.1,它的管理距离是1,这里对管理距离说说,管理距离指的是在路径选择的过程中信息的可信度,管理距离越小的,可信度越高。
再看看第二行
Network Destination Netmask Gateway Interface Metric
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
A类地址中127.0.0.0留住本地调试使用,所以路由表中所以发向127.0.0.0网络的数据通过本地回环127.0.0.1发送给指定的网关:127.0.0.1,也就是从自己的回环接口发到自己的回环接口,这将不会占用局域网带宽。
第三行
Network Destination Netmask Gateway Interface Metric
202.256.257.0 255.255.255.0 202.256.257.258 202.256.257.258 1
这里的目的网络与本机处于一个局域网,所以发向网络202.256.257.0(也就是发向局域网的数据)使用本机:202.256.257.258作为网关,这便不再需要路由器路由或不需要交换机交换,增加了传输效率。
第四行
Network Destination Netmask Gateway Interface Metric
202.256.257.258 255.255.255.255 127.0.0.1 127.0.0.1 1
表 示从自己的主机发送到自己主机的数据包,如果使用的是自己主机的IP地址,跟使用回环地址效果相同,通过同样的途径被路由,也就是如果我有自己的站点,我 要浏览自己的站点,在IE地质栏里面输入localhost与202.256.257.258是一样的,尽管localhost被解析为 127.0.0.1。
第五行
Network Destination Netmask Gateway Interface Metric
202.256.257.255 255.255.255.255 202.256.257.258 202.256.257.258 1
这里的目的地址是一个局域广播地址,系统对这样的数据包的处理方法是把本机202.256.257.258作为网关,发送局域广播帧,这个帧将被路由器过滤。
第六行
Network Destination Netmask Gateway Interface Metric
224.0.0.0 224.0.0.0 202.256.257.258 202.256.257.258 1
这里的目的地址是一个组播(muticast)网络,组播指的是数据包同时发向几个指定的IP地址,其他的地址不会受到影响。系统的处理依然是适用本机作为网关,进行路由。这里有一点要说明的组播可被路由器转发,如果路由器不支持组播,则采用广播方式转发。
最后一行
Network Destination Netmask Gateway Interface Metric
255.255.255.255 255.255.255.255 202.256.257.258 202.256.257.258 1
目的地址是一个广域广播,同样适用本机为网关,广播广播帧,这样的包到达路由器之后被转发还是丢弃根据路由器的配置决定。
还有个半行没有解释
Default Gateway: 202.256.257.1
这是一个缺省的网关,要是发送的数据的目的地址根前面例举的都不匹配的时候,就将数据发送到这个缺省网关,由其决定路由。

route 笔记2

route print命令

C:\Documents and Settings\1st>route print

======================================================================

Interface List

0x1 ........................... MS TCP Loopback interface

0x2 ...00 0a e4 54 b7 20 ...... Realtek RTL8139 Family PCI Fast Ethernet NIC -

acket Scheduler Miniport

======================================================================Active Routes:

Network Destination Netmask Gateway Interface Metric

0.0.0.0 0.0.0.0 192.168.0.13 192.168.0.3 30

0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.3 40

127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1

192.168.0.0 255.255.255.0 192.168.0.3 192.168.0.3 30

192.168.0.3 255.255.255.255 127.0.0.1 127.0.0.1 30

192.168.0.255 255.255.255.255 192.168.0.3 192.168.0.3 30

224.0.0.0 240.0.0.0 192.168.0.3 192.168.0.3 30

255.255.255.255 255.255.255.255 192.168.0.3 192.168.0.3 1

Default Gateway: 192.168.0.13

======================================================================

Persistent Routes:

None

在显示内容列中:

Network Destination 表示目的网络

Netmask 表示子网掩码

Gateway 网关地址

Interface 接口(网卡)

Metric 这里表示路由优先值

其中目的网络和掩码全0表示任意网络。如这一条:

Network Destination Netmask Gateway Interface Metric

0.0.0.0 0.0.0.0 192.168.0.13 192.168.0.3 30

是表示去网往任意网络的IP数据包将被送到网关设备192.168.0.3上去。这种全0的路由通常是指上internet的路由,也称默认路由,俗称指网关。

大家可否注意到这里有两条的默认路由,如下:

Network Destination Netmask Gateway Interface Metric

0.0.0.0 0.0.0.0 192.168.0.13 192.168.0.3 30

0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.3 40

它们的区别在于Metric值不同,那么这样的路由有什么用处呢?

前面已讲到Metric值是表示路由的优先值,所以理论上讲这两条路由可以实现互为备份的 作用,也就是说本地主机192.168.0.3/24这个台主机所属网段里存在两台可以上internet的设备或主机,分别是192.168.0.13 和192.168.0.1,假设网络内192.168.0.13这台设备或主机掉电停机后那么本地主机将自动将网关切换到192.168.0.1上,注意 必需是192.168.0.13掉电或与本地主机网络隔离才会切换本地主机才会切换网关,如果只是拔掉其接外网线路(如adsl)本地主机是不会有任何动 作的。

那么将Metric值改成相等又是否有可以实现负载均衡呢?

两个2M的adsl加起来就是4M了,这个需求对某些用户还是很吸引人的。

答案是,理论上可以的。大多数路由器可以实现windows 2000是否可以实现,本人还没有做实验证实;各位如果有空可以找个环境做一下,别忘了告诉我结果!

看了前面我写的这些你也许对找出为什么有时adsl拨上号却上不了网原因而有所眉目了。

大 家都知道,我们在建立adsl连接后,网络链接里都至少会有两个本地连接;其中一个是物理网卡的连接,另一个则是adsl的pppoe虚接连接,对应 route pirnt路由表来说也就是两个接口。通常如果你在物理网卡上如果已经设了网关地址,而后又在adsl拨号后又获得一个网关地址;那么此时如果物理网卡所 设的网关的Metric值比adsl所获得的网关Metric值高的话,就会出现adsl拨上号后却不能上网的问题。当然这个问题还有一个前提就是物理网 卡所指的网关设备已不具备连接internet的能力。

更多关于route命令的参数请参考route /?

解释route print 命令

本帖发表在我是网管论坛,帖子地址:http://bbs.54master.com/209460,1,1
本机地址:202.256.257.258
掩码:255.255.255.0
操作系统:w2k server
T:\>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x1000003 ...44 e0 4c 10 43 1d ...... Realtek RTL8139/810x Family Fast Ethernet NIC
===========================================================================
==========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 202.256.257.1 202.256.257.258 1
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
202.256.257.0 255.255.255.0 202.256.257.258 202.256.257.258 1
202.256.257.258 255.255.255.255 127.0.0.1 127.0.0.1 1
202.256.257.255 255.255.255.255 202.256.257.258 202.256.257.258 1
224.0.0.0 224.0.0.0 202.256.257.258 202.256.257.258 1
255.255.255.255 255.255.255.255 202.256.257.258 202.256.257.258 1
Default Gateway: 202.256.257.1
===========================================================================
这 是route命令的第一个参数的输出,首先是最上方给出了接口列表,一个本地循环,一个网卡接口,网卡结构给出了网卡的mac地址。再说说每一列的内容 吧,从做到右依次是:Network Destination(目的地址),Netmask(掩码),Gateway(网关),Interface(接口),Metric(也不知道是什么,姑 且认为是一个度量值或是管理距离)。
下面说说每一行内容代表的内容,首先是
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 202.256.257.1 202.256.257.258 1
这表示发向任意网段的数据通过本机接口202.256.257.258被送往一个默认的网关:202.256.257.1,它的管理距离是1,这里对管理距离说说,管理距离指的是在路径选择的过程中信息的可信度,管理距离越小的,可信度越高。
再看看第二行
Network Destination Netmask Gateway Interface Metric
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
A类地址中127.0.0.0留住本地调试使用,所以路由表中所以发向127.0.0.0网络的数据通过本地回环127.0.0.1发送给指定的网关:127.0.0.1,也就是从自己的回环接口发到自己的回环接口,这将不会占用局域网带宽。
第三行
Network Destination Netmask Gateway Interface Metric
202.256.257.0 255.255.255.0 202.256.257.258 202.256.257.258 1
这里的目的网络与本机处于一个局域网,所以发向网络202.256.257.0(也就是发向局域网的数据)使用本机:202.256.257.258作为网关,这便不再需要路由器路由或不需要交换机交换,增加了传输效率。
第四行
Network Destination Netmask Gateway Interface Metric
202.256.257.258 255.255.255.255 127.0.0.1 127.0.0.1 1
表 示从自己的主机发送到自己主机的数据包,如果使用的是自己主机的IP地址,跟使用回环地址效果相同,通过同样的途径被路由,也就是如果我有自己的站点,我 要浏览自己的站点,在IE地质栏里面输入localhost与202.256.257.258是一样的,尽管localhost被解析为 127.0.0.1。
第五行
Network Destination Netmask Gateway Interface Metric
202.256.257.255 255.255.255.255 202.256.257.258 202.256.257.258 1
这里的目的地址是一个局域广播地址,系统对这样的数据包的处理方法是把本机202.256.257.258作为网关,发送局域广播帧,这个帧将被路由器过滤。
第六行
Network Destination Netmask Gateway Interface Metric
224.0.0.0 224.0.0.0 202.256.257.258 202.256.257.258 1
这里的目的地址是一个组播(muticast)网络,组播指的是数据包同时发向几个指定的IP地址,其他的地址不会受到影响。系统的处理依然是适用本机作为网关,进行路由。这里有一点要说明的组播可被路由器转发,如果路由器不支持组播,则采用广播方式转发。
最后一行
Network Destination Netmask Gateway Interface Metric
255.255.255.255 255.255.255.255 202.256.257.258 202.256.257.258 1
目的地址是一个广域广播,同样适用本机为网关,广播广播帧,这样的包到达路由器之后被转发还是丢弃根据路由器的配置决定。
还有个半行没有解释
Default Gateway: 202.256.257.1
这是一个缺省的网关,要是发送的数据的目的地址根前面例举的都不匹配的时候,就将数据发送到这个缺省网关,由其决定路由。

route 笔记1

关于添加网关的一些汇总

  • Linux 部分
  • 网络环境:
  • 有两个 Class C 网络:
    有线Lan : 192.168.1.0/24
    无线Lan : 192.168.2.0/24

    主机中有两块网卡:
    网卡1: eth0 , 拥有一个 global IP 221.xxx.xxx.xxx
    网卡1: eth1 , 拥有一个 local IP 192.168.1.xxx

  • 设置目标
  • 设置主机使得:
    1) 从 global IP 来的 access 通过 default GW (Global IP GW) 返回 package
    2) 从 local IP 来的 access 通过 192.168.1.10 返回 package

    由于在 route add 命令中需要使用网关的 hostname,所以首先在 /etc/hosts 中定义 gateway 的名称。例如:

    192.168.1.10 gw8f
    查看现有的设置:
    # route
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    221.12.345.56 * 255.255.255.240 U 0 0 0 eth0
    192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
    169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
    default 221x114x249x193 0.0.0.0 UG 0 0 0 eth0
    然后添加route并确认:
    # route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.10 dev eth1
    #说明:来自192.168.2.0/24的package通过192.168.1.10网关返回package。
    # route
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    221.12.345.56 * 255.255.255.240 U 0 0 0 eth0
    192.168.2.0 gw8f 255.255.255.0 UG 0 0 0 eth1
    192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
    169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
    default 221x114x249x193 0.0.0.0 UG 0 0 0 eth0

    保存设置在静态文件中:

    # vi /etc/sysconfig/network-scripts/route-eth1
    添加以下一行即可:
    192.168.2.0/24 via 192.168.1.10

    Windows

    route add 202.126.225.0 mask 255.255.255.0 192.168.1.5 metric 1 if eth1
    其他:
    如果有防火墙设置,需要修改一些设置。比如通过 Easy Firewall Generator 制作的 firewall 中需要添加:
    LOCAL_NET2="192.168.2.0/24"

    # Drop packets received on the external interface
    # claiming a source of the local network
    $IPT -A bad_packets -p ALL -i $INET_IFACE -s $LOCAL_NET2 -j LOG \
    --log-prefix "Illegal source: "

    $IPT -A bad_packets -p ALL -i $INET_IFACE -s $LOCAL_NET2 -j DROP

    # Rules for the private network (accessing gateway system itself)
    $IPT -A INPUT -p ALL -i $LOCAL_IFACE -s $LOCAL_NET2 -j ACCEPT

    参考资料:
    http://www.akadia.com/services/redhat_static_routes.html

    Linux文件权限详解

    Linux文件权限详解
    一、文件和目录权限概述
    在linux中的每一个文件或目录都包含有访问权限,这些访问权限决定了谁能访问和如何访问这些文件和目录。

    通过设定权限可以从以下三种访问方式限制访问权限:只允许用户自己访问;允许一个预先指定的用户组中的用户访问;允许系统中的任何用户访问。同时,用户能 够控制一个给定的文件或目录的访问程度。一个文件活目录可能有读、写及执行权限。当创建一个文件时,系统会自动地赋予文件所有者读和写的权限,这样可以允 许所有者能够显示文件内容和修改文件。文件所有者可以将这些权限改变为任何他想指定的权限。一个文件也许只有读权限,禁止任何修改。文件也可能只有执行权 限,允许它想一个程序一样执行。

    三种不同的用户类型能够访问一个目录或者文件:所有着、用户组或其他用户。所有者就是创建文件的用户,用户是所有用户所创建的文件的所有者,用户可以允许 所在的用户组能访问用户的文件。通常,用户都组合成用户组,例如,某一类或某一项目中的所有用户都能够被系统管理员归为一个用户组,一个用户能够授予所在 用户组的其他成员的文件访问权限。最后,用户也将自己的文件向系统内的所有用户开放,在这种情况下,系统内的所有用户都能够访问用户的目录或文件。在这种 意义上,系统内的其他所有用户就是other用户类。

    每一个用户都有它自身的读、写和执行权限。第一套权限控制访问自己的文件权限,即所有者权限。第二套权限控制用户组访问其中一个用户的文件的权限。第三套 权限控制其他所有用户访问一个用户的文件的权限,这三套权限赋予用户不同类型(即所有者、用户组和其他用户)的读、写及执行权限就构成了一个有9种类型的 权限组。

    我们可以用-l参数的ls命令显示文件的详细信息,其中包括权限。如下所示:

    yekai@kebao:/media/sda5/软件压缩/Linux$ ls -lh
    总用量 191M
    -rwxrwx--- 1 root plugdev 18M 2007-02-28 18:05 ActionCube_v0.92.tar.bz2
    -rwxrwx--- 1 root plugdev 60M 2007-04-30 22:52 nexuiz-223.zip
    -rwxrwx--- 1 root plugdev 7.4M 2007-04-25 02:16 stardict-oxford-gb-2.4.2.tar.bz2
    -rwxrwx--- 1 root plugdev 102M 2007-05-01 18:22 tremulous-1.1.0-installer.x86.run
    -rwxrwx--- 1 root plugdev 4.9M 2007-04-30 14:32 wqy-bitmapfont-0.8.1-7_all.deb.bin

    当执行ls -l 或 ls -al 命令后显示的结果中,最前面的第2~10个字符是用来表示权限。第一个字符一般用来区分文件和目录:

    d:表示是一个目录,事实上在ext2fs中,目录是一个特殊的文件。

    -:表示这是一个普通的文件。

    l: 表示这是一个符号链接文件,实际上它指向另一个文件。

    b、c:分别表示区块设备和其他的外围设备,是特殊类型的文件。

    s、p:这些文件关系到系统的数据结构和管道,通常很少见到。

    下面详细介绍一下权限的种类和设置权限的方法。

    二、一般权限
    第2~10个字符当中的每3个为一组,左边三个字符表示所有者权限,中间3个字符表示与所有者同一组的用户的权限,右边3个字符是其他用户的权限。这三个一组共9个字符,代表的意义如下:
    r(Read,读取):对文件而言,具有读取文件内容的权限;对目录来说,具有浏览目录的权限。
    w(Write,写入):对文件而言,具有新增、修改文件内容的权限;对目录来说,具有删除、移动目录内文件的权限。
    x(eXecute,执行):对文件而言,具有执行文件的权限;对目录了来说该用户具有进入目录的权限。

    -:表示不具有该项权限。
    下面举例说明:
    -rwx------: 文件所有者对文件具有读取、写入和执行的权限。
    -rwxr―r--: 文件所有者具有读、写与执行的权限,其他用户则具有读取的权限。
    -rw-rw-r-x: 文件所有者与同组用户对文件具有读写的权限,而其他用户仅具有读取和执行的权限。
    drwx--x--x: 目录所有者具有读写与进入目录的权限,其他用户近能进入该目录,却无法读取任何数据。
    Drwx------: 除了目录所有者具有完整的权限之外,其他用户对该目录完全没有任何权限。

    每个用户都拥有自己的专属目录,通常集中放置在/home目录下,这些专属目录的默认权限为rwx------:

    表示目录所有者本身具有所有权限,其他用户无法进入该目录。执行mkdir命令所创建的目录,其默认权限为rwxr-xr-x,用户可以根据需要修改目录的权限。

    此外,默认的权限可用umask命令修改,用法非常简单,只需执行umask 777 命令,便代表屏蔽所有的权限,因而之后建立的文件或目录,其权限都变成000,依次类推。通常root帐号搭配umask命令的数值为022、027和 077,普通用户则是采用002,这样所产生的权限依次为755、750、700、775。有关权限的数字表示法,后面将会详细说明。

    用户登录系统时,用户环境就会自动执行rmask命令来决定文件、目录的默认权限。

    三、特殊权限
    其实文件与目录设置不止这些,还有所谓的特殊权限。由于特殊权限会拥有一些“特权”,因而用户若无特殊需求,不应该启用这些权限,避免安全方面出现严重漏洞,造成黑客入侵,甚至摧毁系统!!!

    s或S(SUID,Set UID):可执行的文件搭配这个权限,便能得到特权,任意存取该文件的所有者能使用的全部系统资源。请注意具备SUID权限的文件,黑客经常利用这种权限,以SUID配上root帐号拥有者,无声无息地在系统中开扇后门,供日后进出使用。

    s或S(SGID,Set GID):设置在文件上面,其效果与SUID相同,只不过将文件所有者换成用户组,该文件就可以任意存取整个用户组所能使用的系统资源。

    T或T(Sticky):/tmp和 /var/tmp目录供所有用户暂时存取文件,亦即每位用户皆拥有完整的权限进入该目录,去浏览、删除和移动文件。

    因为SUID、SGID、Sticky占用x的位置来表示,所以在表示上会有大小写之分。加入同时开启执行权限和SUID、SGID、Sticky,则权限表示字符是小写的:

    -rwsr-sr-t 1 root root 4096 6月 23 08:17 conf

    如果关闭执行权限,则表示字符会变成大写:

    -rwSr-Sr-T 1 root root 4096 6月 23 08:17 conf

    四、使用文件管理器来改变文件或目录的权限:
    如果用户要改变一个文件目录的权限,右击要改变权限的文件或者目录,在弹出的快捷菜单中选择“属性”,系统将打开属性对话框

    在“属性”对话框中,单击“权限”标签,就会打开“权限”选项卡。

    在这里你可以修改文件或者目录的所有者、组群和其他用户的权限,而且可以设置特殊权限

    对于特殊权限,最好不要设置,不然会带来很严重的安全问题。

    当然,在这里你也可以改变文件和目录的所有者和所属组。

    五、使用chmod和数字改变文件或目录的访问权限

    文件和目录的权限表示,是用rwx这三个字符来代表所有者、用户组和其他用户的权限。有时候,字符似乎过于麻烦,因此还有另外一种方法是以数字来表示权限,而且仅需三个数字。

    r: 对应数值4

    w: 对应数值2

    x:对应数值1

    -:对应数值0

    数字设定的关键是mode的取值,一开始许多初学者会被搞糊涂,其实很简单,我们将rwx看成二进制数,如果有则有1表示,没有则有0表示,那么rwx r-x r- -则可以表示成为:



    111 101 100

    再将其每三位转换成为一个十进制数,就是754。

    例如,我们想让a.txt这个文件的权限为:

    自己 同组用户 其他用户

    可读 是 是 是

    可写 是 是

    可执行

    那么,我们先根据上表得到权限串为:rw-rw-r--,那么转换成二进制数就是110 110 100,再每三位转换成为一个十进制数,就得到664,因此我 们执行命令:

    [root@localhost ~]# chmod 664 a.txt

    按照上面的规则,rwx合起来就是4+2+1=7,一个rwxrwxrwx权限全开放的文件,数值表示为777;而完全不开放权限的文件“---------”其数字表示为000。下面举几个例子:

    -rwx------:等于数字表示700。

    -rwxr―r--:等于数字表示744。

    -rw-rw-r-x:等于数字表示665。

    drwx―x―x:等于数字表示711。

    drwx------:等于数字表示700。

    在文本模式下,可执行chmod命令去改变文件和目录的权限。我们先执行ls -l 看看目录内的情况:


    [root@localhost ~]# ls -l

    总用量 368

    -rw-r--r-- 1 root root 12172 8月 15 23:18 conkyrc.sample

    drwxr-xr-x 2 root root 48 9月 4 16:32 Desktop

    -r--r--r-- 1 root root 331844 10月 22 21:08 libfreetype.so.6

    drwxr-xr-x 2 root root 48 8月 12 22:25 MyMusic

    -rwxr-xr-x 1 root root 9776 11月 5 08:08 net.eth0

    -rwxr-xr-x 1 root root 9776 11月 5 08:08 net.eth1

    -rwxr-xr-x 1 root root 512 11月 5 08:08 net.lo

    drwxr-xr-x 2 root root 48 9月 6 13:06 vmware

    可以看到当然文件conkyrc.sample文件的权限是644,然后把这个文件的权限改成777。执行下面命令

    [root@localhost ~]# chmod 777 conkyrc.sample

    然后ls -l看一下执行后的结果:

    [root@localhost ~]# ls -l

    总用量 368

    -rwxrwxrwx 1 root root 12172 8月 15 23:18 conkyrc.sample

    drwxr-xr-x 2 root root 48 9月 4 16:32 Desktop

    -r--r--r-- 1 root root 331844 10月 22 21:08 libfreetype.so.6

    drwxr-xr-x 2 root root 48 8月 12 22:25 MyMusic

    -rwxr-xr-x 1 root root 9776 11月 5 08:08 net.eth0

    -rwxr-xr-x 1 root root 9776 11月 5 08:08 net.eth1

    -rwxr-xr-x 1 root root 512 11月 5 08:08 net.lo

    drwxr-xr-x 2 root root 48 9月 6 13:06 vmware

    可以看到conkyrc.sample文件的权限已经修改为rwxrwxrwx

    如果要加上特殊权限,就必须使用4位数字才能表示。特殊权限的对应数值为:

    s或 S (SUID):对应数值4。

    s或 S (SGID):对应数值2。

    t或 T :对应数值1。

    用同样的方法修改文件权限就可以了

    例如:

    [root@localhost ~]# chmod 7600 conkyrc.sample

    [root@localhost ~]# ls -l

    总用量 368

    -rwS--S--T 1 root root 12172 8月 15 23:18 conkyrc.sample

    drwxr-xr-x 2 root root 48 9月 4 16:32 Desktop

    -r--r--r-- 1 root root 331844 10月 22 21:08 libfreetype.so.6

    drwxr-xr-x 2 root root 48 8月 12 22:25 MyMusic

    -rwxr-xr-x 1 root root 9776 11月 5 08:08 net.eth0

    -rwxr-xr-x 1 root root 9776 11月 5 08:08 net.eth1

    -rwxr-xr-x 1 root root 512 11月 5 08:08 net.lo

    drwxr-xr-x 2 root root 48 9月 6 13:06 vmware

    加入想一次修改某个目录下所有文件的权限,包括子目录中的文件权限也要修改,要使用参数-R表示启动递归处理。

    例如:

    [root@localhost ~]# chmod 777 /home/user 注:仅把/home/user目录的权限设置为rwxrwxrwx

    [root@localhost ~]# chmod -R 777 /home/user 注:表示将整个/home/user目录与其中的文件和子目录的权限都设置为rwxrwxrwx

    六、使用命令chown改变目录或文件的所有权

    文件与目录不仅可以改变权限,其所有权及所属用户组也能修改,和设置权限类似,用户可以通过图形界面来设置,或执行chown命令来修改。

    我们先执行ls -l看看目录情况:

    [root@localhost ~]# ls -l

    总用量 368

    -rwxrwxrwx 1 root root 12172 8月 15 23:18 conkyrc.sample

    drwxr-xr-x 2 root root 48 9月 4 16:32 Desktop

    -r--r--r-- 1 root root 331844 10月 22 21:08 libfreetype.so.6

    drwxr-xr-x 2 root root 48 8月 12 22:25 MyMusic

    -rwxr-xr-x 1 root root 9776 11月 5 08:08 net.eth0

    -rwxr-xr-x 1 root root 9776 11月 5 08:08 net.eth1

    -rwxr-xr-x 1 root root 512 11月 5 08:08 net.lo

    drwxr-xr-x 2 root root 48 9月 6 13:06 vmware

    可以看到conkyrc.sample文件的所属用户组为root,所有者为root。

    执行下面命令,把conkyrc.sample文件的所有权转移到用户user:

    [root@localhost ~]# chown user conkyrc.sample

    [root@localhost ~]# ls -l

    总用量 368

    -rwxrwxrwx 1 user root 12172 8月 15 23:18 conkyrc.sample

    drwxr-xr-x 2 root root 48 9月 4 16:32 Desktop

    -r--r--r-- 1 root root 331844 10月 22 21:08 libfreetype.so.6

    drwxr-xr-x 2 root root 48 8月 12 22:25 MyMusic

    -rwxr-xr-x 1 root root 9776 11月 5 08:08 net.eth0

    -rwxr-xr-x 1 root root 9776 11月 5 08:08 net.eth1

    -rwxr-xr-x 1 root root 512 11月 5 08:08 net.lo

    drwxr-xr-x 2 root root 48 9月 6 13:06 vmware

    要改变所属组,可使用下面命令:

    [root@localhost ~]# chown :users conkyrc.sample

    [root@localhost ~]# ls -l

    总用量 368

    -rwxrwxrwx 1 user users 12172 8月 15 23:18 conkyrc.sample

    drwxr-xr-x 2 root root 48 9月 4 16:32 Desktop

    -r--r--r-- 1 root root 331844 10月 22 21:08 libfreetype.so.6

    drwxr-xr-x 2 root root 48 8月 12 22:25 MyMusic

    -rwxr-xr-x 1 root root 9776 11月 5 08:08 net.eth0

    -rwxr-xr-x 1 root root 9776 11月 5 08:08 net.eth1

    -rwxr-xr-x 1 root root 512 11月 5 08:08 net.lo

    drwxr-xr-x 2 root root 48 9月 6 13:06 vmware

    要修改目录的权限,使用-R参数就可以了,方法和前面一样。

    原文地址 http://hi.baidu.com/skyforum/blog/item/4219b72699f160168a82a1db.html

    Wednesday, January 7, 2009

    Linux 笔记

    linux目录架构
    / 根目录
    /bin 常用的命令 binary file 的目錄
    /boot 存放系统启动时必须读取的档案,包括核心 (kernel) 在内
    /boot/grub/menu.lst GRUB设置
    /boot/vmlinuz 内核
    /boot/initrd 核心解壓縮所需 RAM Disk
    /dev 系统周边设备
    /etc 系统相关设定文件
    /etc/DIR_COLORS 设定颜色
    /etc/HOSTNAME 设定用户的节点名
    /etc/NETWORKING 只有YES标明网络存在
    /etc/host.conf 文件说明用户的系统如何查询节点名
    /etc/hosts 设定用户自已的IP与名字的对应表
    /etc/hosts.allow 设置允许使用inetd的机器使用
    /etc/hosts.deny 设置不允许使用inetd的机器使用
    /etc/hosts.equiv 设置远端机不用密码
    /etc/inetd.conf 设定系统网络守护进程inetd的配置
    /etc/gateways 设定路由器
    /etc/protocols 设定系统支持的协议
    /etc/named.boot 设定本机为名字服务器的配置文件
    /etc/sysconfig/network-scripts/ifcfg-eth0 设置IP
    /etc/resolv.conf 设置DNS
    /etc/X11 X Window的配置文件,xorg.conf 或 XF86Config 這兩個 X Server 的設定檔
    /etc/fstab 记录开机要mount的文件系统
    /etc/inittab 设定系统启动时init进程将把系统设置成什么样的runlevel
    /etc/issue 记录用户登录前显示的信息
    /etc/group 设定用户的组名与相关信息
    /etc/passwd 帐号信息
    /etc/shadow 密码信息
    /etc/sudoers 可以sudo命令的配置文件
    /etc/securetty 设定哪些终端可以让root登录
    /etc/login.defs 所有用户登录时的缺省配置
    /etc/exports 设定NFS系统用的
    /etc/init.d/ 所有服務的預設啟動 script 都是放在這裡的,例如要啟動或者關閉
    /etc/xinetd.d/ 這就是所謂的 super daemon 管理的各項服務的設定檔目錄
    /etc/modprobe.conf 内核模块额外参数设定
    /etc/syslog.conf 日志设置文件
    /home 使用者家目录
    /lib 系统会使用到的函数库
    /lib/modules kernel 的相关模块
    /var/lib/rpm rpm套件安装处
    /lost+found 系統不正常產生錯誤時,會將一些遺失的片段放置於此目錄下
    /mnt 外设的挂载点
    /media 与/mnt类似
    /opt 主机额外安装的软件
    /proc 虚拟目录,是内存的映射
    /proc/version 内核版本
    /proc/sys/kernel 系统内核功能
    /root 系统管理员的家目录
    /sbin 系统管理员才能执行的指令
    /srv 一些服務啟動之後,這些服務所需要取用的資料目錄
    /tmp 一般使用者或者是正在執行的程序暫時放置檔案的地方
    /usr 最大的目录,存许应用程序和文件
    /usr/X11R6: X-Window目录
    /usr/src: Linux源代码
    /usr/include:系统头文件
    /usr/openwin 存放SUN的OpenWin
    /usr/man 在线使用手册
    /usr/bin 使用者可執行的 binary file 的目錄
    /usr/local/bin 使用者可執行的 binary file 的目錄
    /usr/lib 系统会使用到的函数库
    /usr/local/lib 系统会使用到的函数库
    /usr/sbin 系统管理员才能执行的指令
    /usr/local/sbin 系统管理员才能执行的指令
    /var 日志文件
    /var/log/secure 記錄登入系統存取資料的檔案,例如 pop3, ssh, telnet, ftp 等都會記錄在此檔案中
    /var/log/wtmp 記錄登入者的訊息資料, last
    /var/log/messages 幾乎系統發生的錯誤訊息
    /var/log/boot.log 記錄開機或者是一些服務啟動的時候,所顯示的啟動或關閉訊息
    /var/log/maillog 紀錄郵件存取或往來( sendmail 與 pop3 )的使用者記錄
    /var/log/cron 記錄 crontab 這個例行性服務的內容
    /var/log/httpd, /var/log/news, /var/log/mysqld.log, /var/log/samba, /var/log/procmail.log:
    分別是幾個不同的網路服務的記錄檔
    一些常用的基本命令:
    uname -a 查看内核版本
    ls -al 显示所有文件的属性
    pwd 显示当前路径
    cd - 返回上一次目录 cd ~ 返回主目录
    date s 设置时间、日期
    cal 显示日历 cal 2006
    bc 计算器具
    man & info 帮助手册
    locale 显示当前字体 locale -a 所有可用字体 /etc/sysconfig/i18n设置文件
    LANG=en 使用英文字体
    sync 将数据同步写入硬盘
    shutdonw -h now & half & poweroff 关机
    reboot 重启
    startx & init 5 进入图形介面
    /work & ?work 向上、下查找文档内容
    chgrp 改变档案群组 chgrp testing install.log
    chown 改变所属人 chown root:root install.log
    chmod 改变属性 chmod 777 install.log read=4 write=2 execute=1
    cp 复制 cp filename
    rm 删除文件 rm -rf filename 强制删除文件
    rmdir 删除文件夹
    mv 移动 mv 123.txt 222.txt 重命名
    mkdir 创建文件夹
    touch 创建文件 更新当前时间
    cat 由第一行开始显示 cat |more 分页
    nl 在内容前加行号
    more & less 一面一面翻动
    head -n filename 显示第N行内容
    tail -n filename 显示后N行内容
    od 显示非纯文档
    df -h 显示分区空间
    du 显示目录或文件的大小
    fdisk 分区设置 fdisk -l /dev/hda 显示硬盘分区状态
    mkfs 建立各种文件系统 mkfs -t ext3 /dev/ram15
    fsck 检查和修复LINUX档案
    ln 硬链接 ln -s 软件链接
    whereis 查找命令
    locate 查找
    find 查找 find / -name "***.*** "
    which 查看工具
    whoami 显示当前用户
    gcc -v 查看GCC版本
    chattr +i filename 禁止删除 chattr -i filename 取消禁止
    lsattr 显示隐藏档属性
    updatedb 更新资料库
    mke2fs 格式化 mkfs -t ext3
    dd if=/etc/passwd of=/tmp/passwd.bak 备份
    mount 列出系统所有的分区
    mount -t iso9660 /dev/cdrom /mnt/cdrom 挂载光盘
    mount -t vfat /dev/fd0 /mnt/floppy 挂载软盘
    mount -t vfat -o iocharset=utf8,umask=000 /dev/hda2 /mnt/hda2 挂载fat32分区
    mount -t ntfs -o nls=utf8,umask=000 /dev/hda3 /mnt/hda3 挂载ntfs分区
    Linux-NTFS Project: http://linux-ntfs.sourceforge.net/
    umount /mnt/hda3 缷载
    ifconfig 显示或设置网络设备
    service network restart 重启网卡
    ifdown eth0 关闭网卡
    ifup eth0 开启网卡
    clear 清屏
    history 历史记录 !55 执行第55个指令
    stty 设置终端 stty -a
    fdisk /mbr 删除GRUB
    at 僅進行一次的工作排程
    crontab 循環執行的例行性命令 [e]编辑,[l]显示,[r]删除任务
    & 后台运行程序 tar -zxvf 123.tar.gz & ---------> 后台运行
    jobs 观看后台暂停的程序 jobs -l
    fg 将后台程序调到前台 fg n ------> n是数字,可以指定进行那个程序
    bg 让工作在后台运行
    kill 结束进程 kill -9 PID [9]强制结束,[15]正常结束,[l]列出可用的kill信号
    ps aux 查看后台程序
    top 查看后台程序 top -d 2 每两秒更新一次 top -d 2 -p10604 观看某个PID
    top -b -n 2 > /tmp/top.txt -----> 將 top 的資訊進行 2 次,然後將結果輸出到 /tmp/top.txt
    pstree 以树状图显示程序 [A]以 ASCII 來連接, [u]列出PID, [p]列出帐号
    killall 要刪除某個服務 killall -9 httpd
    free 显示内存状态 free -m --------> 以M为单位显示
    uptime 显示目前系统开机时间
    netstat 显示网络状态 netstat -tulnp------> 找出目前系統上已在監聽的網路連線及其 PID
    dmesg 显示开机信息 demsg | more
    nice 设置优先权 nice -n -5 vi & -----> 用 root 給一個 nice 植為 -5 ,用於執行 vi
    renice 调整已存在优先权
    runlevel 显示目前的runlevel
    depmod 分析可载入模块的相依性
    lsmod 显示已载入系统的模块
    modinfo 显示kernel模块的信息
    insmod 载入模块
    modprobe 自动处理可载入模块
    rmmod 删除模块
    chkconfig 检查,设置系统的各种服务 chkconfig --list -----> 列出各项服务状态
    ntsysv 设置系统的各种服务
    cpio 备份文件
    压缩命令:
    *.Z compress 程式壓縮的檔案;
    *.bz2 bzip2 程式壓縮的檔案;
    *.gz gzip 程式壓縮的檔案;
    *.tar tar 程式打包的資料,並沒有壓縮過;
    *.tar.gz tar 程式打包的檔案,其中並且經過 gzip 的壓縮
    compress filename 压缩文件 加[-d]解压 uncompress
    gzip filename 压缩 加[-d]解压 zcat 123.gz 查看压缩文件内容
    bzip2 -z filename 压缩 加[-d]解压 bzcat filename.bz2 查看压缩文件内容
    tar -cvf /home/123.tar /etc 打包,不压缩
    tar -xvf 123.tar 解开包
    tar -zxvf /home/123.tar.gz 以gzip解压
    tar -jxvf /home/123.tar.bz2 以bzip2解压
    tar -ztvf /tmp/etc.tar.gz 查看tar内容
    cpio -covB > [file|device] 份份
    cpio -icduv < [file|device] 还原

    vi一般用法
    一般模式 编辑模式 指令模式
    h 左 a,i,r,o,A,I,R,O :w 保存
    j 下 进入编辑模式 :w! 强制保存
    k 上 dd 删除光标当前行 :q! 不保存离开
    l 右 ndd 删除n行 :wq! 保存后离开
    0 移动到行首 yy 复制当前行 :e! 还原原始档
    $ 移动到行尾 nyy 复制n行 :w filename 另存为
    H 屏幕最上 p,P 粘贴 :set nu 设置行号
    M 屏幕中央 u 撤消 :set nonu 取消行号
    L 屏幕最下 [Ctrl]+r 重做上一个动作 ZZ 保存离开
    G 档案最后一行 [ctrl]+z 暂停退出 :set nohlsearch 永久地关闭高亮显示
    /work 向下搜索 :sp 同时打开两个文档
    ?work 向上搜索 [Ctrl]+w 两个文档设换
    gg 移动到档案第一行 :nohlsearch 暂时关闭高亮显示

    认识SHELL
    alias 显示当前所有的命令别名 alias lm= "ls -al " 命令别名 unalias lm 取消命令别名
    type 类似which
    exprot 设置或显示环境变量
    exprot PATH= "$PATH ":/sbin 添加/sbin入PATH路径
    echo $PATH 显示PATH路径
    bash 进入子程序
    name=yang 设定变量
    unset name 取消变量
    echo $name 显示变量的内容
    myname= "$name its me " & myname= '$name its me ' 单引号时$name失去变量内容
    ciw=/etc/sysconfig/network-scripts/ 设置路径
    env 列出所有环境变量
    echo $RANDOM 显示随意产生的数
    set 设置SHELL
    PS1= '[\u@\h \w \A #\#]\$ ' 提示字元的設定
    [root@linux ~]# read [-pt] variable -----------读取键盘输入的变量
    參數:
    -p :後面可以接提示字元!
    -t :後面可以接等待的『秒數!』
    declare 声明 shell 变量
    ulimit -a 显示所有限制资料
    ls /tmp/yang && echo "exist " || echo "not exist "
    意思是說,當 ls /tmp/yang 執行後,若正確,就執行echo "exist " ,若有問題,就執行echo "not exist "
    echo $PATH | cut -d ': ' -f 5 以:为分隔符,读取第5段内容
    export | cut -c 10-20 读取第10到20个字节的内容
    last | grep 'root ' 搜索有root的一行,加[-v]反向搜索
    cat /etc/passwd | sort 排序显示
    cat /etc/passwd | wc 显示『行、字数、字节数』
    正规表示法
    [root@test root]# grep [-acinv] '搜尋字串 ' filename
    參數說明:
    -a :將 binary 檔案以 text 檔案的方式搜尋資料
    -c :計算找到 '搜尋字串 ' 的次數
    -i :忽略大小寫的不同,所以大小寫視為相同
    -n :順便輸出行號
    -v :反向選擇,亦即顯示出沒有 '搜尋字串 ' 內容的那一行!
    grep -n 'the ' 123.txt 搜索the字符 -----------搜尋特定字串
    grep -n 't[ea]st ' 123.txt 搜索test或taste两个字符---------利用 [] 來搜尋集合字元
    grep -n '[^g]oo ' 123.txt 搜索前面不为g的oo-----------向選擇 [^]
    grep -n '[0-9] ' 123.txt 搜索有0-9的数字
    grep -n '^the ' 123.txt 搜索以the为行首-----------行首搜索^
    grep -n '^[^a-zA-Z] ' 123.txt 搜索不以英文字母开头
    grep -n '[a-z]$ ' 123.txt 搜索以a-z结尾的行---------- 行尾搜索$
    grep -n 'g..d ' 123.txt 搜索开头g结尾d字符----------任意一個字元 .
    grep -n 'ooo* ' 123.txt 搜索至少有两个oo的字符---------重複字元 *
    sed 文本流编辑器 利用脚本命令来处理文本文件
    awd 模式扫描和处理语言
    nl 123.txt | sed '2,5d ' 删除第二到第五行的内容
    diff 比较文件的差异
    cmp 比较两个文件是否有差异
    patch 修补文件
    pr 要打印的文件格式化
    帐号管理
    /etc/passwd 系统帐号信息
    /etc/shadow 帐号密码信息 经MD5 32位加密
    在密码栏前面加『 * 』『 ! 』禁止使用某帐号
    /etc/group 系统群组信息
    /etc/gshadow
    newgrp 改变登陆组
    useradd & adduser 建立新用户 ---------> useradd -m test 自动建立用户的登入目录
    useradd -m -g pgroup test ---------> 指定所属级
    /etc/default/useradd 相关设定
    /etc/login.defs UID/GID 有關的設定
    passwd 更改密码 -----------> passwd test
    usermod 修改用户帐号
    userdel 删除帐号 -----------> userdel -r test
    chsh 更换登陆系统时使用的SHELL [-l]显示可用的SHELL;[-s]修改自己的SHELL
    chfn 改变finger指令显示的信息
    finger 查找并显示用户信息
    id 显示用户的ID -----------> id test
    groupadd 添加组
    groupmod 与usermod类似
    groupdel 删除组
    su test 更改用户 su - 进入root,且使用root的环境变量
    sudo 以其他身份来执行指令
    visudo 编辑/etc/sudoers 加入一行『 test ALL=(ALL) ALL 』
    %wheel ALL = (ALL) ALL 系统里所有wheel群组的用户都可用sudo
    %wheel ALL = (ALL) NOPASSWD: ALL wheel群组所有用户都不用密码NOPASSWD
    User_Alias ADMPW = vbird, dmtsai, vbird1, vbird3 加入ADMPW组
    ADMPW ALL = NOPASSWD: !/usr/bin/passwd, /usr/bin/passwd [A-Za-z]*, \
    !/usr/bin/passwd root 可以更改使用者密码,但不能更改root密码 (在指令前面加入 ! 代表不可)
    PAM (Pluggable Authentication Modules, 嵌入式模組)
    who & w 看谁在线
    last 最近登陆主机的信息
    lastlog 最近登入的時間 读取 /var/log/lastlog
    talk 与其他用户交谈
    write 发送信息 write test [ctrl]+d 发送
    mesg 设置终端机的写入权限 mesg n 禁止接收 mesg y
    wall 向所有用户发送信息 wall this is q test
    mail 写mail
    /etc/default/useradd 家目录默认设置
    quota 显示磁盘已使用的空间与限制 quota -guvs -----> 秀出目前 root 自己的 quota 限制值
    quota -vu 查询
    quotacheck 检查磁盘的使用空间与限制 quotacheck -avug -----> 將所有的在 /etc/mtab 內,含有 quota 支援的 partition 進行掃瞄
    [-m] 强制扫描
    quota一定要是独立的分区,要有quota.user和quota.group两件文件,在/etc/fstab添加一句:
    /dev/hda3 /home ext3 defaults,usrquota,grpquota 1 2
    chmod 600 quota* 设置完成,重启生效
    edquota 编辑用户或群组的quota [u]用户,[g]群组,[p]复制,[t]设置宽限期限
    edquota -a yang edquota -p yang -u young -----> 复制
    quotaon 开启磁盘空间限制 quotaon -auvg --------> 啟動所有的具有 quota 的 filesystem
    quotaoff 关闭磁盘空间限制 quotaoff -a --------> 關閉了 quota 的限制
    repquota -av 查閱系統內所有的具有 quota 的 filesystem 的限值狀態
    Quota 從開始準備 filesystem 的支援到整個設定結束的主要的步驟大概是:
    1、設定 partition 的 filesystem 支援 quota 參數:
    由於 quota 必須要讓 partition 上面的 filesystem 支援才行,一般來說, 支援度最好的是 ext2/ext3 ,
    其他的 filesystem 類型鳥哥我是沒有試過啦! 啟動 filesystem 支援 quota 最簡單就是編輯 /etc/fstab ,
    使得準備要開放的 quota 磁碟可以支援 quota 囉;
    2、建立 quota 記錄檔:
    剛剛前面講過,整個 quota 進行磁碟限制值記錄的檔案是 aquota.user/aquota.group,
    要建立這兩個檔案就必須要先利用 quotacheck 掃瞄才行喔!
    3、編輯 quota 限制值資料:
    再來就是使用 edquota 來編輯每個使用者或群組的可使用空間囉;
    4、重新掃瞄與啟動 quota :
    設定好 quota 之後,建議可以再進行一次 quotacheck ,然後再以 quotaon 來啟動吧!

    开机流程简介
    1、載入 BIOS 的硬體資訊,並取得第一個開機裝置的代號;
    2、讀取第一個開機裝置的 MBR 的 boot Loader (亦即是 lilo, grub, spfdisk 等等) 的開機資訊;
    3、載入 Kernel 作業系統核心資訊, Kernel 開始解壓縮,並且嘗試驅動所有硬體裝置;
    4、Kernel 執行 init 程式並取得 run-level 資訊;
    5、init 執行 /etc/rc.d/rc.sysinit 檔案;
    6、啟動核心的外掛模組 (/etc/modprobe.conf);
    7、init 執行 run-level 的各個批次檔( Scripts );
    8、init 執行 /etc/rc.d/rc.local 檔案;
    9、執行 /bin/login 程式,並等待使用者登入;
    10、登入之後開始以 Shell 控管主機。
    在/etc/rc.d/rc3.d內,以S开头的为开机启动,以K开头的为关闭,接着的数字代表执行顺序
    GRUB vga设定
    彩度\解析度 640x480 800x600 1024x768 1280x1024 bit
    256 769 771 773 775 8 bit
    32768 784 787 790 793 15 bit
    65536 785 788 791 794 16 bit
    16.8M 786 789 792 795 32 bit

    ./configure 检查系统信息 ./configure --help | more 帮助信息
    make clean 清除之前留下的文件
    make 编译
    make install 安装
    rpm -q -----> 查询是否安装 rpm -ql ------> 查询该套件所有的目录
    rpm -qi -----> 查询套件的说明资料 rpm -qc[d] -----> 设定档与说明档
    rpm -ivh ----> 安装 rpm -V --------> 查看套件有否更动过
    rpm -e ------> 删除 rpm -Uvh -------> 升级安装
    --nodeps -----> 强行安装 --test -----> 测试安装


    转http://blog.chinaunix.net/u/30619/showart.php?id=249558

    GC & TG 概况

    Oracle offers two conectivity solutions for the heterogeneous environment
    1.Oracle Generic Connectivity
    2.Oracle Transparent Gateways
    Applications developed using a consistent Oracle interface for both Oracle and non-Oracle systems to eliminate the need for application developers to customize their application to access data from different non-Oracle systems.

    SQL translations, data dictionary translations and data type translations are required even if the non-Oracle systems are based on SQL standards for smooth interoperability between disparate systems. GC & TGs have the ability to translate one systems'dialect to another. ( In a word , it is a translator that accomplishes the communication between different dialects of disparate systems)

    1.HS(Heterogeneous Services component) 2. Agent composing the gateway tech.


    Introduction to HS.
    HS can offer the generic tech for connecting to non-Oracle systems . GC & TG are based on HS.
    HS具有强大的解析SQL能力。扩展于Oracle SQL 引擎。利用mappings 获得必需的数据字典信息。提供了两种转换方式(1)Oracle SQL => dialect of non-Oracle system (2)数据字典的转换(Q)data dictionary translations which display the metadata of non-Oracle systems.不过 HS并不保证所有的都可以translation,通过提供了pass-through的功能-当没有translations可以使用的时候,使用pass-through直接将native SQL发送到non-Oracle system.
    HS也提供了在Oralce和non-Oracle系统之间的事务间协调机制。例如提供two-phase commit 协议来保证分布式环境下事务的完整性(Q)


    Agent 和HS 交互 从而实现了oracle &non-oracle之间的透明连接。
    两种类型的agent:1.HS Agents 2.Transparent Gateway agents

    HS Agents 也有两种:a. HS ODBC b.HS OLEDB
    HS Agents are part of the Oracle database 默认安装。GC正是使用这些agents连接到non-Oracle systems.

    Transparent Gateway agents 独立于oralce server.它可以安装在任何机器上。并且可以oracle database 并存。什么时候安装TG agents必须考虑网络阻塞状况、os平台性能、硬件资源和存储情况。要获得最大的性能,TG是最佳选择。TGs use the native interfaces to communicate with non-oracle systems.

    Oracle Generic Connectivity

    Generic Connectivity is a feature of the Oracle database. It is a generic solution that uses an ODBC or OLE DB driver to access any ODBC or OLEDB compliant non-Oracle system. It addresses the needs of data access to many data stores for which Oracle does not have a gateway solution. This feature enables transparent connectivity using industry standards such as ODBC and OLEDB. Oracle Generic connectivity makes it possible to access low-end data stores such as Foxpro, Access, dBase and non-relational targets like Excel.

    Oracle Transparent Gateways

    In contrast to Generic Connectivity, which is a generic solution, Transparent Gateways are tailored solutions, specifically coded for the non-Oracle system. They provide an optimized solution, with more functionality and better performance than Generic Connectivity. Generic Connectivity relies on industry standards, whereas Transparent Gateways accesses the non-Oracle systems using their native interface. Transparent Gateways are also end-to-end certified. Oracle has transparent gateways to many sources, DB2, Sybase, Informix, Microsoft SQL Server, Ingres, Teradata to name a few.

    标记(Q) 进一步学习知识点 技术文档
    KEY FEATURES

    * Improved SQL Generation - Fine grained capability handling
    * Generated SQL queries cache - Non-Oracle language queries are generated and cached in Oracle's Shared Pool, making it more efficient for reuse when such queries are frequently used by multiple client sessions
    * Better performance - Improved remote connectivity techniques of HS, provides better performance
    * Local Cache - Information about capabilities, SQL translations, and data dictionary translations are stored locally, reducing network traffic
    * Distributed SQL Optimizations - Improves performance of multi-site JOIN and SET operations
    * Pass-Through SQL- Allows native SQL (including DDL) of target non-Oracle system to be directly transmitted
    * Read/Write Access - Both query and update capabilities are supported for most non-Oracle systems.
    * Data Type Translations - Performs automatic data type translations between the Oracle Sever and the non-Oracle system
    * Data Dictionary Translations - Metadata of the non-Oracle system is translated and displayed in Oracle format
    * Gateway Mobility - The Transparent Gateway, the non-Oracle system and the Oracle server can all reside on different machines
    * Remote Stored Procedures - Supports execution of stored procedures defined in non-Oracle system
    * Two Phase Commit - Oracle supports two-phase commit with non-Oracle stores. When a public two-phase commit interface is not available, it can be supported when distributed transactions involve Oracle and a single non-Oracle store
    * Logon Security - Enforces access authorizations for remote login
    * Data Encryption - Available with Oracle's Advanced Security Option
    * Location Transparency - Users do not need to be aware of the physical location of data, just the names of the tables to be accessed
    * Commit Transparency - Distributed and non-distributed transactions are committed using the ANSI-standard SQL COMMIT. Oracle automatically detects when a transaction is distributed and uses a two-phase commit protocol to ensure transaction integrity and consistency
    * Network and Operating System Transparency - No special coding is required, even if the data resides on different systems
    * NLS and NCHAR Support - Enables connectivity to non-Oracle systems using multi-byte character sets

    Tuesday, January 6, 2009

    Oracle 通用连接和透明网关

    学习链接
    http://www.oracle.com/technology/global/cn/products/gateways/index.html
    http://www.oracle.com/technology/documentation/gateways_arch.html
    http://www.oracle.com/technology/global/cn/getting-started/index.html

    新年伊始!


    2008年的第一时间我曾经说过一句“2008是不平凡的一年” 2009 新年伊始 一只漂亮的喜鹊落在了门楣上 让我欣喜不已,真的会喜上“楣”梢吗?呵呵 2009 学生时代即将结束 一个新的起点即将开始 祝福我的亲人 朋友 2009 平安 幸福。也祝福自己在Oracle一切顺利和我心爱的minmin早日团聚。听着淡淡的歌。。。

    Monday, January 5, 2009

    CARRA: TORRES RETURN IS MASSIVE BOOST


    Jamie Carragher today spoke of his delight after Fernando Torres returned with a goal against Preston at the weekend.

    Torres missed the whole of December with a hamstring injury, but made the perfect return at the weekend as he came off the substitute's bench to net the crucial second goal in the final minute at Deepdale. Liverpool now face Everton in the fourth round of the competition as they embark on a crucial second half of the campaign - and Carragher is thrilled to have El Nino back to aid the quest for silverware. "Having Torres back has given everyone a big lift,” he said. "It is great when you see a player of that calibre coming back for the second half of the season. "Hopefully, the time he has been out will refresh him because he had a long season with the Euros. "A lot of players have played a lot of games this season because the manager hasn't changed it around so much and it will be good to have someone like him to come back in. "It has been a feather in the cap for everyone concerned with the club that we have reached the top of the table without having the best striker in the world over the last 12 months for periods. "You miss a player of that quality, but it will give us a lift to have him out there." Carragher was pleased to ensure safe FA Cup progress at the expense of Preston on Saturday - but he admits the Reds were taken all the way by Alan Irvine's men. "We can play better than that, but the other team always raises its game in the FA Cup," he added. "We have found these sort of matches difficult in recent years - Luton, Burnley, Barnsley - so we are pleased to get through against a good Championship side. "In the second half they put us under a lot of pressure and took us to the last minute. There was a bit of a scramble just before we scored the second so it could have gone either way. Great credit to Preston."

    Sunday, January 4, 2009

    Command

    常用命令
    Oracle_Database SQL Reference,SQL的语法:http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/toc.htm
    PL SQL Packages and Types,PL/SQL参考:http://st-doc.us.oracle.com/10/102/appdev.102/b14258/toc.htm
    Oracle Database Reference,数据字典使用语法:http://st-doc.us.oracle.com/10/102/server.102/b14237/toc.htm
    ============================常用命令================================su - userchown -R oracle:dba sw-jinnichmod -R +x *ls -auname -rrpm -qdu -sm *ps -ef grepssh-agent $SHELLssh-addsar -u 1 10topiostatsqlplus / as sysdba!sqlhistoryscp rac1pub:/etc/hosts ./hcat /etc/hostscat /proc/cpuinfocat /etc/initiatorname.iscsicat /etc/fstabmount -amount /dev/sdb1fsck.reiserfs /dev/sda3mkfs.reiserfs /dev/sdb1fdisk -ln新建 w保存 p主分区============================常用软件================================mozillaSUSE:KDEYASTREDHAT:/usr/bin/redhat-config-network============================网络设置================================/sbin/ifconfig改IP:vi /etc/sysconfig/networkvi /etc/hostsvi /etc/sysconfig/network-scripts/ifcfg-eth0/sbin/service network restart改DNS:vi /etc/resolv.conf=========================RAC数据库相关==============================emctl start stop status setpasswd dbconsolelsnrctl servlsnrctl status LISTENER_RAC2PUBsrvctl status database -d nagf
    env grep SIDexport ORACLE_SID=+ASM1asmcmdASMCMD> lsdgASMCMD> lslvASMCMD> lsctASMCMD> exit/etc/init.d/oracleasm listdisksSQL> select name from v$asm_disk;SQL> alter diskgroup netapp_dg dismount;
    find /dev -name *scsi* morevi /etc/iscsi.conf/etc/init.d/iscsi start/etc/init.d/iscsi restartchkconfig iscsi onchkconfig iscsi offchkconfig iscsi -l
    SQL> select tablespace_name from dba_tablespaces;SQL> desc dba_datafiles;SQL> select file_name,file_id,tablespace_name from dba_data_files;SQL> select name from v$datafileunionselect member from v$logfileunionselect name from v$controlfileunionselect name from v$tempfile;SQL> select index_name from dba_indexes where index_name like 'CALL_%'SQL> show parameter ****SQL> alter system set xxx=xxxSQL> select * from v$session;SQL> select * from v$process p, v$session s where p.serial#=s.serial# and p.spid=12615;
    输出htm格式的报表:SQL> SET MARKUP HTML ONSQL> spool select * from ALL_RULE_SET_RULES.htmSQL> select * from select * from ALL_RULE_SET_RULES;SQL> spool offSQL> SET MARKUP HTML OFFSQL> startup restrict mount;SQL> drop database;
    注册到listener:SQL> alter system registerSQL> purge recyclebin;