Tag-Archive for » linux «

星期二, 04月 28th, 2009 | Author: Zealot

今天apt-get install vim-full的时候,出现了错误,详见后面。原因不清楚,估计是sun-java5-jre这个包相关的东西出了问题,彻底清除了试试:sudo apt-get –purge remove sun-java5-jre,然后重新装上。。
再来sudo apt-get install vim-full,OK。

Reading package lists…
Building dependency tree…
You might want to run `apt-get -f install’ to correct these:
The following packages have unmet dependencies:
sun-java5-jre: Depends: sun-java5-bin (= 1.5.0-14-1etch1) but it is not going to be installed or
ia32-sun-java5-bin (= 1.5.0-14-1etch1) but it is not installable
vim-full: Depends: vim-gui-common (= 1:7.0-122+1etch5) but it is not going to be installed
Depends: vim-common (= 1:7.0-122+1etch5) but 1:7.0-122+1etch3 is to be installed
Depends: vim-runtime (= 1:7.0-122+1etch5) but 1:7.0-122+1etch3 is to be installed
Depends: libart-2.0-2 (>= 2.3.16) but it is not going to be installed
Depends: libatk1.0-0 (>= 1.12.2) but it is not going to be installed
Depends: libbonobo2-0 (>= 2.13.0) but it is not going to be installed
Depends: libbonoboui2-0 (>= 2.5.4) but it is not going to be installed
Depends: libcairo2 (>= 1.2.4) but it is not going to be installed
Depends: libgconf2-4 (>= 2.13.5) but it is not going to be installed
Depends: libglib2.0-0 (>= 2.12.0) but it is not going to be installed
Depends: libgnome-keyring0 (>= 0.6.0) but it is not going to be installed
Depends: libgnome2-0 (>= 2.14.1) but it is not going to be installed
Depends: libgnomecanvas2-0 (>= 2.11.1) but it is not going to be installed
Depends: libgnomeui-0 (>= 2.13.0) but it is not going to be installed
Depends: libgnomevfs2-0 (>= 2.13.92) but it is not going to be installed
Depends: libgtk2.0-0 (>= 2.8.0) but it is not going to be installed
Depends: liborbit2 (>= 1:2.14.1) but it is not going to be installed
Depends: libpango1.0-0 (>= 1.14.8) but it is not going to be installed
Depends: libperl5.8 (>= 5.8.8) but it is not going to be installed
Depends: libruby1.8 (>= 1.8.5) but it is not going to be installed
Depends: libxcursor1 (> 1.1.2) but it is not going to be installed
Depends: libxfixes3 (>= 1:4.0.1) but it is not going to be installed
Depends: libxi6 but it is not going to be installed
Depends: libxinerama1 but it is not going to be installed
Depends: libxrandr2 but it is not going to be installed
Depends: libxrender1 but it is not going to be installed
Depends: tcl8.4 (>= 8.4.5) but it is not going to be installed

星期四, 10月 30th, 2008 | Author: Zealot

From : http://www.fire3.cn/2008/08/03/linux-howto-read-man-page.html

 
 

搜索和打印介绍不错:)

 
 

1 什么是man手册

 
 

首先,man是manual的简称,中文说法可以是手册。

 
 

在Linux世界中,许多新手请教某条命令的用法时, 好多不耐心的老手通常会用一条命令来回答这位无助的新手,而这条命令通常

就是man开头。无助的新手敲上这条命令一看究竟,在终端上顿时显示出来了一屏幕的英文,

老手的意思是,自己看看手册吗,可是看手册也是有学问的,无助的新手甚

至不知道怎么退出这条命令呢。下面我们就来讲解一下看man手册的学问。

2 从man手册中获取有用的信息

 
 

我们先以mkdir命令来解释读man手册的一些入门知识。

 
 

MKDIR(1) User Commands MKDIR(1)

 
 

NAME

mkdir – make directories

 
 

SYNOPSIS

mkdir [OPTION] DIRECTORY…

 
 

DESCRIPTION

Create the DIRECTORY(ies), if they do not already exist.

 
 

Mandatory arguments to long options are mandatory for short options too.

 
 

-m, –mode=MODE

set file mode (as in chmod), not a=rwx – umask

 
 

-p, –parents

no error if existing, make parent directories as needed

 
 

-v, –verbose

print a message for each created directory

 
 

-Z, –context=CTX

set the SELinux security context of each created directory to CTX

 
 

–help display this help and exit

 
 

–version

output version information and exit

 
 

AUTHOR

Written by David MacKenzie.

 
 

REPORTING BUGS

Report bugs to <bug-coreutils@gnu.org>.

 
 

COPYRIGHT

Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

 
 

This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

 
 

SEE ALSO

 
 

mkdir(2)

 
 

The full documentation for mkdir is maintained as a Texinfo manual. If the info and mkdir programs are properly installed at your site, the com-

 
 

mand

 
 

info coreutils ‘mkdir invocation’

 
 

should give you access to the complete manual.

 
 

首先第一行 MKDIR(1),显然,MKDIR是命令的大写,那么为什么有个(1)呢,那是因为man手册页有如下的规定:

Section         名称         说明

l         本地文档         与本特定系统有关的

1         用户命令         可由任何人启动的

2         系统调用         即由内核提供的函数

3         例程         即库函数

4         设备         即/dev目录下的特殊文件

5         文件格式描述         例如/etc/passwd

6         游戏         不用解释啦

7         杂项         例如宏命令包、惯例等

8         系统管理员工具         只能由root启动

9         其他(Linux特定的)         用来存放内核例行程序的文档

n         新文档         可能要移到更适合的领域

o         老文档         可能会在一段期限内保留

 
 

MKDIR(1)表示该命令属于Section 1,为用户命令,类似的man

apt-get会看到APT-GET(8),表示apt-get命令为系统管理工具。

 
 

“NAME”部分是该命令的名字和简单的解释,显然,在命令行中要执行该命令要使用到它的名称。

 
 

“SNOPSIS”是摘要部分,简要解释该命令如何使用,比如mkdir的摘要:

mkdir [OPTION] DIRECTORY…,读到这里便需要讲解一下了:

 
 

“OPTIONS”左右有”["和"]“,表示这些参数并不必须,但是可以使用。对应的DIRECTORY两边没有”[]“,就是必须要加的参数了。

另外,它们后面都有”…” ,表示这些参数可以重复使用多次。至于OPTIONS具体怎么用,就要看DESCRIPTION部分了。下面举几个简单的例子,并配合例子解释:

用法         解释

mkdir tmp         创建 tmp 目录

mkdir –mode=a+w tmp         创建一个模式为”a+w”的tmp目录,–mode是长参数,用法是–mode=MODE,在DESCRIPTION里说明

mkdir -m a+w tmp         创建一个模式为”a+w”的tmp目录,-m 是短参数,不用加 = 号,效果等同 –mode=MODE

mkdir -mv a+w tmp         创建一个模式为”a+w”的tmp目录,同时显示信息,verbose模式,-mv可以一起用

mkdir -v -m a+w tmp         创建一个模式为”a+w”的tmp目录,同时显示信息,verbose模式,-v后面接一个空格再用-m

3 man手册页的操作

3.1 退出man

 
 

最简单,按下”q”键

3.2 查找

 
 

如果你知道要打开的手册页,在man命令打开的手册页中可以用

“/” 键进行正则表达式的搜索。

 
 

如果不知道所要打开的手册页名称,可以用 “man

-k”命令搜索相关的手册页,比如:

 
 

man -k postscript

 
 

会给出一堆关于”postscript”的相关命令页。

3.3 打印

 
 

最简单的办法,以mkdir为例:

 
 

man -t mkdir > mkdir_man.ps

 
 

可以直接打印ps,打算发给别人打印的话,转换成pdf也比较方便:

 
 

ps2pdf mkdir_man.ps mkdir_man.pdf

Category: linux  | Tags: , , , , ,  | Leave a Comment
星期三, 10月 08th, 2008 | Author: Zealot

  • 获取Squid
  • 编译安装
  • 快速配置
  • 运行Squid
Category: linux  | Tags: , , ,  | Leave a Comment
星期三, 08月 06th, 2008 | Author: Zealot

这个命令用的比较多了,作用很简单:改变文件的权限

平时主要能涉及到的就读写执行三种权限了,分别对应rwx

主要形式用的比较多的就是:”chmod 三个数字表示权限 文件” 和 “chomd a+x 文件”,其中a表示所有用户,还有u,g,加好增加相应权限,减号相反。目录的执行权限定义不一样。

详细介绍如下:

http://blog.csdn.net/chenshaoying/archive/2008/08/04/2767064.aspx

chmod用于改变文件或目录的访问权限。用户用它控制文件或目录的访问权限。该命令有两种用法。一种是包含字母和操作符表达式的文字设定法;另一种是包含数字的数字设定法。

1. 文字设定法

语法:chmod [who] [+ | - | =] [mode] 文件名

命令中各选项的含义为:

操作对象who可是下述字母中的任一个或者它们的组合:
  u 表示“用户(user)”,即文件或目录的所有者。
  g 表示“同组(group)用户”,即与文件属主有相同组ID的所有用户。
  o 表示“其他(others)用户”。
  a 表示“所有(all)用户”。它是系统默认值。
操作符号可以是:
  + 添加某个权限。
  - 取消某个权限。
  = 赋予给定权限并取消其他所有权限(如果有的话)。
设置 mode 所表示的权限可用下述字母的任意组合:
  r 可读。
  w 可写。
   x 可执行。
  X 只有目标文件对某些用户是可执行的或该目标文件是目录时才追加x 属性。
  s 在文件执行时把进程的属主或组ID置为该文件的文件属主。
      方式“u+s”设置文件的用户ID位,“g+s”设置组ID位。
  t 保存程序的文本到交换设备上。
  u 与文件属主拥有一样的权限。
  g 与和文件属主同组的用户拥有一样的权限。
  o 与其他用户拥有一样的权限。
文件名:以空格分开的要改变权限的文件列表,支持通配符。

在一个命令行中可给出多个权限方式,其间用逗号隔开。例如:

chmod g+r,o+r example  % 使同组和其他用户对文件example 有读权限。

2. 数字设定法

我们必须首先了解用数字表示的属性的含义:0表示没有权限,1表示可执行权限, 2表示可写权限,4表示可读权限,然后将其相加。所以数字属性的格式应为3个从0到7的八进制数,其顺序是(u)(g)(o)。

例如,如果想让某个文件的属主有“读/写”二种权限,需要把4(可读)+2(可写)=6(读/写)。

数字设定法的一般形式为:

语法:chmod [mode] 文件名

指令实例:

chmod a+x sort
% 即设定文件sort的属性为:
 文件属主(u) 增加执行权限
 与文件属主同组用户(g) 增加执行权限
 其他用户(o) 增加执行权限

chmod ug+w,o-x text
% 即设定文件text的属性为:
 文件属主(u) 增加写权限
 与文件属主同组用户(g) 增加写权限
 其他用户(o) 删除执行权限

chmod u+s a.out
% 假设执行chmod后a.out的权限为(可以用ls – l a.out命令来看):
 –rws--x--x 1 inin users 7192 Nov 4 14:22 a.out
 并且这个执行文件要用到一个文本文件shiyan1.c,其文件存取权限为“–rw-------”,
  即该文件只有其属主具有读写权限。
   当其他用户执行a.out这个程序时,他的身份因这个程序暂时变成inin(由于chmod
  命令中使用了s选项),所以他就能够读取shiyan1.c这个文件(虽然这个文件被设定为
  其他人不具备任何权限),这就是s的功能。
  因此,在整个系统中特别是root本身,最好不要过多的设置这种类型的文件(除非
  必要)这样可以保障系统的安全,避免因为某些程序的bug而使系统遭到入侵。

chmod a–x mm.txt
chmod –x mm.txt
chmod ugo–x mm.txt
% 以上这三个命令都是将文件mm.txt的执行权限删除,它设定的对象为所有使用者。

$ chmod 644 mm.txt
% 即设定文件mm.txt的属性为:-rw-r--r--
 文件属主(u)inin 拥有读、写权限
 与文件属主同组人用户(g) 拥有读权限
 其他人(o) 拥有读权限

chmod 750 wch.txt
% 即设定wchtxt这个文件的属性为:-rwxr-x---
 文件主本人(u)inin 可读/可写/可执行权
 与文件主同组人(g) 可读/可执行权
 其他人(o) 没有任何权限
Category: linux  | Tags: , , ,  | Leave a Comment