Monthly Archives: December 2005

ps命令

man了一下
-A all processes                      -C by command name
-N negate selection                   -G by real group ID (supports names)
-a all w/ tty except session leaders  -U by real user ID (supports names)
-d all except session leaders         -g by session OR by effective group name
-e all processes                      -p by process ID
T  all processes on this terminal     -s processes in the sessions given
a  all w/ tty, including other users  -t by tty
g  OBSOLETE — DO NOT USE             -u by effective user ID (supports names)
r  only running processes             U  processes for specified users
x  processes w/o controlling ttys     t  by tty
*********** output format **********  *********** long options ***********
-o,o user-defined  -f full            –Group –User –pid –cols –ppid
-j,j job control   s  signal          –group –user –sid –rows –info
-O,O preloaded -o  v  virtual memory  –cumulative –format –deselect
-l,l long          u  user-oriented   –sort –tty –forest –version
-F   extra full    X  registers       –heading –no-heading –context
                    ********* misc options *********
-V,V  show version      L  list format codes  f  ASCII art forest
-m,m,-L,-T,H  threads   S  children in sum    -y change -l format
-M,Z  security data     c  true command name  -c scheduling class
-w,w  wide output       n  numeric WCHAN,UID  -H process hierarchy

Linux常用命令

 Linux之所以受到广大计算机爱好者的喜爱,主要原因有两个,首先它是自由软件,用户不用支付费用就可以使用它,并可根据自己的需要对它进行修改。另外,它具有Unix的全部功能,任何使用Unix系统或想要学习Unix系统的人都可以从中获益。
 
   让我们一起从每一个命令开始,走向Linux高手之路吧。
 
1.Linux进入与退出系统
进入Linux系统:
必须要输入用户的账号,在系统安装过程中可以创建以下两种帐号:
   1.root–超级用户帐号(系统管理员),使用这个帐号可以在系统中做任何事情。
   2.普通用户–这个帐号供普通用户使用,可以进行有限的操作。
   一般的Linux使用者均为普通用户,而系统管理员一般使用超级用户帐号完成一些系统管理的工作。如果只需要完成一些由普通帐号就能完成的任务,建议不要使用超级用户帐号,以免无意中破坏系统。影响系统的正常运行。
   用户登录分两步:第一步,输入用户的登录名,系统根据该登录名识别用户;第二步,输入用户的口令,该口令是用户自己设置的一个字符串,对其他用户是保密的,是在登录时系统用来辨别真假用户的关键字。
   当用户正确地输入用户名和口令后,就能合法地进入系统。屏幕显示:
[root@loclhost /root] #
 
这时就可以对系统做各种操作了。注意超级用户的提示符是“#”,其他用户的提示符是“$”。
 
修改口令
   为了更好的保护用户帐号的安全,Linux允许用户随时修改自己的口令,修改口令的命令是passwd,它将提示用户输入旧口令和新口令,之后还要求用户再次确认新口令,以避免用户无意中按错键。如果用户忘记了口令,可以向系统管理员申请为自己重新设置一个。
 
虚拟控制台
   Linux是一个真正的多用户操作系统,它可以同时接受多个用户登录。Linux还允许一个用户进行多次登录,这是因为Linux和UNIX一样,提供了虚拟控制台的访问方式,允许用户在同一时间从控制台进行多次登录。虚拟控制台的选择可以通过按下Alt键和一个功能键来实现,通常使用F1-F6例如,用户登录后,按一下Alt-F2键,用户又可以看到"login:"提示符,说明用户看到了第二个虚拟控制台。然后只需按Alt-F1键,就可以回到第一个虚拟控制台。 一个新安装的Linux系统默认允许用户使用Alt-F1到Alt-F6键来访问前六个虚拟控制台。虚拟控制台可使用户同时在多个控制台上工作,真正体现Linux系统多用户的特性。用户可以在某一虚拟控制台上进行的工作尚未结束时,切换到另一虚拟控制台开始另一项工作。
 
退出系统
   不论是超级用户,还是普通用户,需要退出系统时,在shell提示符下,键入exit命令即可。
 
Linux文件的复制、删除和移动命令
 
cp命令
该命令的功能是将给出的文件或目录拷贝到另一文件或目录中,同MSDOS下的copy命令一样,功能十分强大。
 
语法: cp [选项] 源文件或目录 目标文件或目录
 
说明:该命令把指定的源文件复制到目标文件或把多个源文件复制到目标目录中。
 
该命令的各选项含义如下:
 
– a 该选项通常在拷贝目录时使用。它保留链接、文件属性,并递归地拷贝目录,其作用等于dpR选项的组合。
 
– d 拷贝时保留链接。
 
– f 删除已经存在的目标文件而不提示。
 
– i 和f选项相反,在覆盖目标文件之前将给出提示要求用户确认。回答y时目标文件将被覆盖,是交互式拷贝。
 
– p 此时cp除复制源文件的内容外,还将把其修改时间和访问权限也复制到新文件中。
 
– r 若给出的源文件是一目录文件,此时cp将递归复制该目录下所有的子目录和文件。此时目标文件必须为一个目录名。
 
– l 不作拷贝,只是链接文件。
 
   需要说明的是,为防止用户在不经意的情况下用cp命令破坏另一个文件,如用户指定的目标文件名已存在,用cp命令拷贝文件后,这个文件就会被新源文件覆盖,因此,建议用户在使用cp命令拷贝文件时,最好使用i选项。
 
mv命令
 
用户可以使用mv命令来为文件或目录改名或将文件由一个目录移入另一个目录中。该命令如同MSDOS下的ren和move的组合。
 
语法:mv [选项] 源文件或目录 目标文件或目录
 
说明:视mv命令中第二个参数类型的不同(是目标文件还是目标目录),mv命令将文件重命名或将其移至一个新的目录中。当第二个参数类型是文件时,mv命令完成文件重命名,此时,源文件只能有一个(也可以是源目录名),它将所给的源文件或目录重命名为给定的目标文件名。当第二个参数是已存在的目录名称时,源文件或目录参数可以有多个,mv命令将各参数指定的源文件均移至目标目录中。在跨文件系统移动文件时,mv先拷贝,再将原有文件删除,而链至该文件的链接也将丢失。
 
命令中各选项的含义为:
 
– I 交互方式操作。如果mv操作将导致对已存在的目标文件的覆盖,此时系统询问是否重写,要求用户回答y或n,这样可以避免误覆盖文件。
 
– f 禁止交互操作。在mv操作要覆盖某已有的目标文件时不给任何指示,指定此选项后,i选项将不再起作用。
 
如果所给目标文件(不是目录)已存在,此时该文件的内容将被新文件覆盖。为防止用户用mv命令破坏另一个文件,使用mv命令移动文件时,最好使用i选项。
 
 
 
rm命令
 
用户可以用rm命令删除不需要的文件。该命令的功能为删除一个目录中的一个或多个文件或目录,它也可以将某个目录及其下的所有文件及子目录均删除。对于链接文件,只是断开了链接,原文件保持不变。
 
rm命令的一般形式为:
 
rm [选项] 文件…
 
如果没有使用- r选项,则rm不会删除目录。
 
该命令的各选项含义如下:
 
– f 忽略不存在的文件,从不给出提示。
 
– r 指示rm将参数中列出的全部目录和子目录均递归地删除。
 
– i 进行交互式删除。
 
使用rm命令要小心。因为一旦文件被删除,它是不能被恢复的。了防止这种情况的发生,可以使用i选项来逐个确认要删除的文件。如果用户输入y,文件将被删除。如果输入任何其他东西,文件则不会删除。
 
Linux目录的创建与删除命令
mkdir命令
 
功能:创建一个目录(类似MSDOS下的md命令)。
 
语法:mkdir [选项] dir-name
 
说明:该命令创建由dir-name命名的目录。要求创建目录的用户在当前目录中(dir-name的父目录中)具有写权限,并且dirname不能是当前目录中已有的目录或 文件名称。
 
命令中各选项的含义为:
 
– m 对新建目录设置存取权限。也可以用chmod命令设置。
 
– p 可以是一个路径名称。此时若路径中的某些目录尚不存在, 加上此选项后, 系统将自动建立好那些尚不存在的目录,即一次可以建立多个目录。
 
 
 
rmdir 命令
 
功能:删除空目录。
 
语法:rmdir [选项] dir-name
 
说明:dir-name表示目录名。该命令从一个目录中删除一个或多个子目录项。需要 特别注意的是,一个目录被删除之前必须是空的。rm – r dir命令可代替 rmdir,但是有危险性。删除某目录时也必须具有对父目录的写权限。
 
命令中各选项的含义为:
 
– p 递归删除目录dirname,当子目录删除后其父目录为空时,也一同被删除。如果整个路径被删除或者由于某种原因保留部分路径,则系统在标准输出上显示相应 的信息。
 
 
 
cd 命令
 
功能:改变工作目录。
 
语法:cd [directory]
 
说明:该命令将当前目录改变至directory所指定的目录。若没有指定directory, 则回到用户的主目录。为了改变到指定目录,用户必须拥有对指定目录的执行和读 权限。
 
该命令可以使用通配符(通配符含义请参见第十章)。
 
pwd 命令
 
在Linux层次目录结构中,用户可以在被授权的任意目录下利用mkdir命令创建新目录,也可以利用cd命令从一个目录转换到另一个目录。然而,没有提示符来告知用 户目前处于哪一个目录中。要想知道当前所处的目录,可以使用pwd命令,该命令显示整个路径名。
 
语法:pwd
 
说明:此命令显示出当前工作目录的绝对路径。
 
 
 
ls 命令
 
ls是英文单词list的简写,其功能为列出目录的内容。这是用户最常用的一个命令之一,因为用户需要不时地查看某个目录的内容。该命令类似于DOS下的dir命令。
 
语法:ls [选项] [目录或是文件]
 
对于每个目录,该命令将列出其中的所有子目录与文件。对于每个文件,ls将输出 其文件名以及所要求的其他信息。默认情况下,输出条目按字母顺序排序。当未给出目录名或是文件名时,就显示当前目录的信息。
 
命令中各选项的含义如下:
 
– a 显示指定目录下所有子目录与文件,包括隐藏文件。
 
– A 显示指定目录下所有子目录与文件,包括隐藏文件。但不列出“.”和 “..”。
 
– b 对文件名中的不可显示字符用八进制逃逸字符显示。
 
– c 按文件的修改时间排序。
 
– C 分成多列显示各项。
 
– d 如果参数是目录,只显示其名称而不显示其下的各文件。往往与l选项一起使 用,以得到目录的详细信息。
 
– f 不排序。该选项将使lts选项失效,并使aU选项有效。
 
– F 在目录名后面标记“/”,可执行文件后面标记“*”,符号链接后面标记 “@”,管道(或FIFO)后面标记“|”,socket文件后面标记“=”。
 
– i 在输出的第一列显示文件的i节点号。
 
– l 以长格式来显示文件的详细信息。这个选项最常用。
 
每行列出的信息依次是: 文件类型与权限 链接数 文件属主 文件属组 文件大小 建立或最近修改的时间 名字
 
对于符号链接文件,显示的文件名之后有“—〉”和引用文件路径名。
 
对于设备文件,其“文件大小”字段显示主、次设备号,而不是文件大小。
 
目录中的总块数显示在长格式列表的开头,其中包含间接块。
 
– L 若指定的名称为一个符号链接文件,则显示链接所指向的文件。
 
– m 输出按字符流格式,文件跨页显示,以逗号分开。
 
– n 输出格式与l选项相同,只不过在输出中文件属主和属组是用相应的UID号和 GID号来表示,而不是实际的名称。
 
– o 与l选项相同,只是不显示拥有者信息。
 
– p 在目录后面加一个“/”。
 
– q 将文件名中的不可显示字符用“?”代替。
 
– r 按字母逆序或最早优先的顺序显示输出结果。
 
– R 递归式地显示指定目录的各个子目录中的文件。
 
– s 给出每个目录项所用的块数,包括间接块。
 
– t 显示时按修改时间(最近优先)而不是按名字排序。若文件修改时间相同,则 按字典顺序。修改时间取决于是否使用了c或u选顶。缺省的时间标记是最后一次修 改时间。
 
– u 显示时按文件上次存取的时间(最近优先)而不是按名字排序。即将-t的时间 标记修改为最后一次访问的时间。
 
– x 按行显示出各排序项的信息。
 
用ls – l命令显示的信息中,开头是由10个字符构成的字符串,其中第一个字符表示文件类型,它可以是下述类型之一:
 
– 普通文件
 
d 目录
 
l 符号链接
 
b 块设备文件
 
c 字符设备文件
 
后面的9个字符表示文件的访问权限,分为3组,每组3位。
 
第一组表示文件属主的权限,第二组表示同组用户的权限,第三组表示其他用户的权限。每一组的三个字 符分别表示对文件的读、写和执行权限。
 
各权限如下所示:
 
r 读
 
w 写
 
x 执行。对于目录,表示进入权限。
 
s 当文件被执行时,把该文件的UID或GID赋予执行进程的UID(用户ID)或GID(组 ID)。
 
t 设置标志位(留在内存,不被换出)。如果该文件是目录,在该目录中的文件只能被超级用户、目录拥有者或文件属主删除。如果它是可执行文件,在该文件执行 后,指向其正文段的指针仍留在内存。这样再次执行它时,系统就能更快地装入该文件。
 
Linux文本处理命令
sort命令
 
sort命令的功能是对文件中的各行进行排序。sort命令有许多非常实用的选项,这些选项最初是用来对数据库格式的文件内容进行各种排序操作的。实际上,sort命令可以被认为是一个非常强大的数据管理工具,用来管理内容类似数据库记录的文件。
 
Sort命令将逐行对文件中的内容进行排序,如果两行的首字符相同,该命令将继续比较这两行的下一字符,如果还相同,将继续进行比较。
 
语法:
 
sort [选项] 文件
 
说明:sort命令对指定文件中所有的行进行排序,并将结果显示在标准输出上。如不指定输入文件或使用“- ”,则表示排序内容来自标准输入。
 
sort排序是根据从输入行抽取的一个或多个关键字进行比较来完成的。排序关键字定义了用来排序的最小的字符序列。缺省情况下以整行为关键字按ASCII字符顺序进行排序。
 
改变缺省设置的选项主要有:
 
– m 若给定文件已排好序,合并文件。
 
– c 检查给定文件是否已排好序,如果它们没有都排好序,则打印一个出错信息,并以状态值1退出。
 
– u 对排序后认为相同的行只留其中一行。
 
– o 输出文件 将排序输出写到输出文件中而不是标准输出,如果输出文件是输入文件之一,sort先将该文件的内容写入一个临时文件,然后再排序和写输出结果。
 
改变缺省排序规则的选项主要有:
 
– d 按字典顺序排序,比较时仅字母、数字、空格和制表符有意义。
 
– f 将小写字母与大写字母同等对待。
 
– I 忽略非打印字符。
 
– M 作为月份比较:“JAN”<“FEB”
 
– r 按逆序输出排序结果。
 
+posl – pos2 指定一个或几个字段作为排序关键字,字段位置从posl开始,到pos2为止(包括posl,不包括pos2)。如不指定pos2,则关键字为从posl到行尾。字段和字符的位置从0开始。
 
– b 在每行中寻找排序关键字时忽略前导的空白(空格和制表符)。
 
– t separator 指定字符separator作为字段分隔符。
 
 
 
uniq命令
 
文件经过处理后在它的输出文件中可能会出现重复的行。例如,使用cat命令将两个文件合并后,再使用sort命令进行排序,就可能出现重复行。这时可以使用uniq命令将这些重复行从输出文件中删除,只留下每条记录的唯一样本。
 
语法:
 
uniq [选项] 文件
 
说明:这个命令读取输入文件,并比较相邻的行。在正常情况下,第二个及以后更多个重复行将被删去,行比较是根据所用字符集的排序序列进行的。该命令加工后的结果写到输出文件中。输入文件和输出文件必须不同。如果输入文件用“- ”表示,则从标准输入读取。
 
该命令各选项含义如下:
 
– c 显示输出中,在每行行首加上本行在文件中出现的次数。它可取代- u和- d选项。
 
– d 只显示重复行。
 
– u 只显示文件中不重复的各行。
 
– n 前n个字段与每个字段前的空白一起被忽略。一个字段是一个非空格、非制表符的字符串,彼此由制表符和空格隔开(字段从0开始编号)。
 
+n 前n个字符被忽略,之前的字符被跳过(字符从0开始编号)。
 
– f n 与- n相同,这里n是字段数。
 
– s n 与+n相同,这里n是字符数。
 
Linux备份与压缩命令
 
tar命令
 
tar可以为文件和目录创建档案。利用tar,用户可以为某一特定文件创建档案(备份文件),也可以在档案中改变文件,或者向档案中加入新的文件。tar最初被用来在磁带上创建档案,现在,用户可以在任何设备上创建档案,如软盘。利用tar命令,可以把一大堆的文件和目录全部打包成一个文件,这对于备份文件或将几个文件组合成为一个文件以便于网络传输是非常有用的。Linux上的tar是GNU版本的。
 
语法:tar [主选项+辅选项] 文件或者目录
 
使用该命令时,主选项是必须要有的,它告诉tar要做什么事情,辅选项是辅助使用的,可以选用。
 
主选项:
 
c 创建新的档案文件。如果用户想备份一个目录或是一些文件,就要选择这个选项。
 
r 把要存档的文件追加到档案文件的未尾。例如用户已经作好备份文件,又发现还有一个目录或是一些文件忘记备份了,这时可以使用该选项,将忘记的目录或文件追加到备份文件中。
 
t 列出档案文件的内容,查看已经备份了哪些文件。
 
u 更新文件。就是说,用新增的文件取代原备份文件,如果在备份文件中找不到要更新的文件,则把它追加到备份文件的最后。
 
x 从档案文件中释放文件。
 
辅助选项:
 
b 该选项是为磁带机设定的。其后跟一数字,用来说明区块的大小,系统预设值为20(20*512 bytes)。
 
f 使用档案文件或设备,这个选项通常是必选的。
 
k 保存已经存在的文件。例如我们把某个文件还原,在还原的过程中,遇到相同的文件,不会进行覆盖。
 
m 在还原文件时,把所有文件的修改时间设定为现在。
 
M 创建多卷的档案文件,以便在几个磁盘中存放。
 
v 详细报告tar处理的文件信息。如无此选项,tar不报告文件信息。
 
w 每一步都要求确认。
 
z 用gzip来压缩/解压缩文件,加上该选项后可以将档案文件进行压缩,但还原时也一定要使用该选项进行解压缩。
 
 
 
gzip命令
 
减少文件大小有两个明显的好处,一是可以减少存储空间,二是通过网络传输文件时,可以减少传输的时间。gzip是在Linux系统中经常使用的一个对文件进行压缩和解压缩的命令,既方便又好用。
 
语法:gzip [选项] 压缩(解压缩)的文件名
 
各选项的含义:
 
-c 将输出写到标准输出上,并保留原有文件。
 
-d 将压缩文件解压。
 
-l 对每个压缩文件,显示下列字段:
 
压缩文件的大小
 
未压缩文件的大小
 
压缩比
 
未压缩文件的名字
 
-r 递归式地查找指定目录并压缩其中的所有文件或者是解压缩。
 
-t 测试,检查压缩文件是否完整。
 
-v 对每一个压缩和解压的文件,显示文件名和压缩比。
 
-num 用指定的数字num调整压缩的速度,-1或–fast表示最快压缩方法(低压缩比),-9或–best表示最慢压缩方法(高压缩比)。系统缺省值为6。
 
 
 
unzip命令
 
用MS Windows下的压缩软件winzip压缩的文件如何在Linux系统下展开呢?可以用unzip命令,该命令用于解扩展名为.zip的压缩文件。
 
语法:unzip [选项] 压缩文件名.zip
 
各选项的含义分别为:
 
-x 文件列表 解压缩文件,但不包括指定的file文件。
 
-v 查看压缩文件目录,但不解压。
 
-t 测试文件有无损坏,但不解压。
 
-d 目录 把压缩文件解到指定目录下。
 
-z 只显示压缩文件的注解。
 
-n 不覆盖已经存在的文件。
 
-o 覆盖已存在的文件且不要求用户确认。
 
-j 不重建文档的目录结构,把所有文件解压到同一目录下。
 
在Linux环境下运行DOS命令   
 
Linux系统提供了一组称为mtools的可移植工具,可以让用户轻松地从标准的DOS软盘上读、写文件和目录。它们对DOS和Linux环境之间交换文件非常有用。它们是不具备共同的文件系统格式的系统之间交换文件的有力手段。对于一个MSDOS的软盘,只要把软盘放在软驱中,就可以利用mtools提供的命令来访问软盘上的文件。
 
mtools的主要命令如下:
 
mcd 目录名 改变MSDOS目录;
 
mcopy 源文件 目标文件 在MSDOS和Unix之间复制文件;
 
mdel 文件名 删除MSDOS文件;
 
mdir 目录名 显示MSDOS目录;
 
mformat 驱动器号 在低级格式化的软盘上创建MSDOS文件系统;
 
rnlabel 驱动器号 产生MSDOS卷标;
 
mmd 目录名 建立MSDOS目录;
 
mrd 目录名 删除MSDOS目录;
 
mren 源文件 目标文件 重新命名已存在的MSDOS文件;
 
mtype 文件名 显示MSDOS文件的内容。
 
提示:这些命令和对应的MSDOS命令非常相似。
 
Linux改变文件或目录的访问权限命令
   Linux系统中的每个文件和目录都有访问许可权限,用它来确定谁可以通过何种方式对文件和目录进行访问和操作。
 
   文件或目录的访问权限分为只读,只写和可执行三种。以文件为例,只读权限表示只允许读其内容,而禁止对其做任何的更改操作。可执行权限表示允许将该文件作为一个程序执行。文件被创建时,文件所有者自动拥有对该文件的读、写和可执行权限,以便于对文件的阅读和修改。用户也可根据需要把访问权限设置为需要的任何组合。
 
   有三种不同类型的用户可对文件或目录进行访问:文件所有者,同组用户、其他用户。所有者一般是文件的创建者。所有者可以允许同组用户有权访问文件,还可以将文件的访问权限赋予系统中的其他用户。在这种情况下,系统中每一位用户都能访问该用户拥有的文件或目录。
 
   每一文件或目录的访问权限都有三组,每组用三位表示,分别为文件属主的读、写和执行权限;与属主同组的用户的读、写和执行权限;系统中其他用户的读、写和执行权限。当用ls -l命令显示文件或目录的详细信息时,最左边的一列为文件的访问权限。例如:
 
   $ ls -l sobsrc. tgz
 
   -rw-r–r– 1 root root 483997 Ju1 l5 17:3l sobsrc. tgz
 
   横线代表空许可。r代表只读,w代表写,x代表可执行。注意这里共有10个位置。第一个字符指定了文件类型。在通常意义上,一个目录也是一个文件。如果第一个字符是横线,表示是一个非目录的文件。如果是d,表示是一个目录。
 
   例如:
 
   – rw- r– r–
 
   普通文件 文件主 组用户 其他用户
 
   是文件sobsrc.tgz 的访问权限,表示sobsrc.tgz是一个普通文件;sobsrc.tgz的属主有读写权限;与sobsrc.tgz属主同组的用户只有读权限;其他用户也只有读权限。
 
   确定了一个文件的访问权限后,用户可以利用Linux系统提供的chmod命令来重新设定不同的访问权限。也可以利用chown命令来更改某个文件或目录的所有者。利用chgrp命令来更改某个文件或目录的用户组。
 
   下面分别对这些命令加以介绍。
 
   chmod 命令
 
   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] 文件名?
 
 
 
   chgrp命令
 
  功能:改变文件或目录所属的组。
 
   语法:chgrp [选项] group filename?
 
   该命令改变指定指定文件所属的用户组。其中group可以是用户组ID,也可以是/etc/group文件中用户组的组名。文件名是以空格分开的要改变属组的文件列表,支持通配符。如果用户不是该文件的属主或超级用户,则不能改变该文件的组。
 
   该命令的各选项含义为:
 
   – R 递归式地改变指定目录及其下的所有子目录和文件的属组。
 
   chown 命令
 
   功能:更改某个文件或目录的属主和属组。这个命令也很常用。例如root用户把自己的一个文件拷贝给用户xu,为了让用户xu能够存取这个文件,root用户应该把这个文件的属主设为xu,否则,用户xu无法存取这个文件。
 
   语法:chown [选项] 用户或组 文件
 
   说明:chown将指定文件的拥有者改为指定的用户或组。用户可以是用户名或用户ID。组可以是组名或组ID。文件是以空格分开的要改变权限的文件列表,支持通配符。
 
  该命令的各选项含义如下:
 
   – R 递归式地改变指定目录及其下的所有子目录和文件的拥有者。
 
   – v 显示chown命令所做的工作。
 
Linux与用户有关的命令
 
passwd命令
 
出于系统安全考虑,Linux系统中的每一个用户除了有其用户名外,还有其对应的用户口令。因此使用useradd命令增加时,还需使用passwd命令为每一位新增加的用户设置口令;用户以后还可以随时用passwd命令改变自己的口令。
 
该命令的一般格式为: passwd [用户名] 其中用户名为需要修改口令的用户名。只有超级用户可以使用“passwd 用户名”修改其他用户的口令,普通用户只能用不带参数的passwd命令修改自己的口令。
 
该命令的使用方法如下:
 
输入
 
passwd< Enter>;
 
在(current) UNIX passwd:下输入当前的口令
 
在new password:提示下输入新的口令(在屏幕上看不到这个口令):
 
系统提示再次输入这个新口令。
 
输入正确后,这个新口令被加密并放入/etc/shdow文件。选取一个不易被破译的口令是很重要的。
 
选取口令应遵守如下规则:
 
口令应该至少有六位(最好是八位)字符;
 
口令应该是大小写字母、标点符号和数字混杂的。
 
超级用户修改其他用户(xxq)的口令的过程如下,
 
# passwd root
 
New UNIX password:
 
Retype new UNIX password:
 
passwd: all authentication tokens updated successfully
 
#
 
 
 
su命令
 
这个命令非常重要。它可以让一个普通用户拥有超级用户或其他用户的权限,也可以让超级用户以普通用户的身份做一些事情。普通用户使用这个命令时必须有超级用户或其他用户的口令。如要离开当前用户的身份,可以打exit。
 
该命令的一般形式为: su [选项] [? ] [使用者帐号]
 
说明:若没有指定使用者帐号,则系统预设值为超级用户root。 该命令中各选项的含义分别为:
 
? c 执行一个命令后就结束。
 
? 加了这个减号的目的是使环境变量和欲转换的用户相同。
 
? m 保留环境变量不变。
 
password: 【输入超级用户的密码】  
 
Linux系统管理命令
 
wall命令
 
这个命令的功能是对全部已登录的用户发送信息,用户可以先把要发送的信息写好存入一个文件中,然后输入:
 
# wall < 文件名
 
这样就能对所有的用户发送信息了。
 
在上面的例子中符号“<”表示输入重定向,有关它的含义和用法请参阅第十章的有关内容。 例如:
 
# wall ‘Thank you!’
 
Broadcast message from root (tty1) Fri Nov 26 14:15:07 1999…
 
Thank you!
 
#
 
执行以上命令后,用户的屏幕上显示出“Thank you!”信息后,并不出现系统提示符$(#),再次按回车键后,屏幕出现系统提示符。
 
 
 
write命令
 
write命令的功能是向系统中某一个用户发送信息。 该命令的一般格式为:
 
write 用户帐号 [终端名称]
 
例如: $ write Guest hello
 
此时系统进入发送信息状态,用户可以输入要发送的信息,输入完毕,希望退出发送状态时,按组合键< Ctrl+c>即可。
 
 
 
mesg指令
 
mesg命令设定是否允许其他用户用write命令给自己发送信息。如果允许别人给自己发送信息,输入命令:
 
# mesg y
 
否则,输入:
 
# mesg n
 
对于超级用户,系统的默认值为 n;而对于一般用户系统的默认值为y。 如果mesg后不带任何参数,则显示当前的状态是y还是n.。
 
 
 
sync命令
 
   sync命令是在关闭Linux系统时使用的。 用户需要注意的是,不能用简单的关闭电源的方法关闭系统,因为Linux象其他Unix系统一样,在内存中缓存了许多数据,在关闭系统时需要进行内存数据与硬盘数据的同步校验,保证硬盘数据在关闭系统时是最新的,只有这样才能确保数据不会丢失。一般正常的关闭系统的过程是自动进行这些工作的,在系统运行过程中也会定时做这些工作,不需要用户干预。 sync命令是强制把内存中的数据写回硬盘,以免数据的丢失。用户可以在需要的时候使用此命令。该命令的一般格式为:
 
   sync
 
 
 
shutdown命令
 
shutdown 命令可以安全地关闭或重启Linux系统,它在系统关闭之前给系统上的所有登录用户提示一条警告信息。该命令还允许用户指定一个时间参数,可以是一个精确的时间,也可以是从现在开始的一个时间段。精确时间的格式是hh:mm,表示小时和分钟;时间段由“+”和分钟数表示。系统执行该命令后,会自动进行数据同步的工作。
 
该命令的一般格式为: shutdown [选项] [时间] [警告信息] 命令中各选项的含义为:
 
– k 并不真正关机,而只是发出警告信息给所有用户。
 
– r 关机后立即重新启动。
 
– h 关机后不重新启动。
 
– f 快速关机,重启动时跳过fsck。
 
– n 快速关机,不经过init程序。
 
– c 取消一个已经运行的shutdown。
 
需要特别说明的是,该命令只能由超级用户使用。
 
 
 
free命令
 
free命令的功能是查看当前系统内存的使用情况,它显示系统中剩余及已用的物理内存和交换内存,以及共享内存和被核心使用的缓冲区。
 
该命令的一般格式为: free [-b | -k | -m] 命令中各选项的含义如下:
 
-b 以字节为单位显示。
 
-k 以K字节为单位显示。
 
-m 以兆字节为单位显示。
 
 
 
uptime命令
 
uptime命令显示系统已经运行了多长时间,它依次显示下列信息:现在时间、系统已经运行了多长时间、目前有多少登录用户、系统在过去的1分钟、5分钟和15分钟内的平均负载。
 
该命令的一般格式为: uptime
 
Linux磁盘管理
 
df命令
 
功能:检查文件系统的磁盘空间占用情况。可以利用该命令来获取硬盘被占用了多少空间,目前还剩下多少空间等信息。
 
语法:df [选项]
 
说明:df命令可显示所有文件系统对i节点和磁盘块的使用情况。
 
该命令各个选项的含义如下:
 
-a 显示所有文件系统的磁盘使用情况,包括0块(block)的文件系统,如/proc文件系统。
 
-k 以k字节为单位显示。
 
-i 显示i节点信息,而不是磁盘块。
 
-t 显示各指定类型的文件系统的磁盘空间使用情况。
 
-x 列出不是某一指定类型文件系统的磁盘空间使用情况(与t选项相反)。
 
-T 显示文件系统类型。
 
 
 
du命令
 
du的英文原义为“disk usage”,含义为显示磁盘空间的使用情况。
 
功能:统计目录(或文件)所占磁盘空间的大小。
 
语法:du [选项] [Names…]
 
说明:该命令逐级进入指定目录的每一个子目录并显示该目录占用文件系统数据块(1024字节)的情况。若没有给出Names,则对当前目录进行统计。
 
该命令的各个选项含义如下:
 
-s 对每个Names参数只给出占用的数据块总数。
 
-a 递归地显示指定目录中各文件及子孙目录中各文件占用的数据块数。若既不指定-s,也不指定-a,则只显示Names中的每一个目录及其中的各子目录所占的磁盘块数。
 
-b 以字节为单位列出磁盘空间使用情况(系统缺省以k字节为单位)。
 
-k 以1024字节为单位列出磁盘空间使用情况。
 
-c 最后再加上一个总计(系统缺省设置)。
 
-l 计算所有的文件大小,对硬链接文件,则计算多次。
 
-x 跳过在不同文件系统上的目录不予统计。
 
 
 
dd命令
 
功能:把指定的输入文件拷贝到指定的输出文件中,并且在拷贝过程中可以进行格式转换。可以用该命令实现DOS下的diskcopy命令的作用。先用dd命令把软盘上的数据写成硬盘的一个寄存文件,再把这个寄存文件写入第二张软盘上,完成diskcopy的功能。需要注意的是,应该将硬盘上的寄存文件用rm命令删除掉。系统默认使用标准输入文件和标准输出文件。
 
语法:dd [选项]
 
if =输入文件(或设备名称)。
 
of =输出文件(或设备名称)。
 
ibs = bytes 一次读取bytes字节,即读入缓冲区的字节数。
 
skip = blocks 跳过读入缓冲区开头的ibs*blocks块。
 
obs = bytes 一次写入bytes字节,即写入缓冲区的字节数。
 
bs = bytes 同时设置读/写缓冲区的字节数(等于设置ibs和obs)。
 
cbs = byte 一次转换bytes字节。
 
count=blocks 只拷贝输入的blocks块。
 
conv = ASCII 把EBCDIC码转换为ASCIl码。
 
conv = ebcdic 把ASCIl码转换为EBCDIC码。
 
conv = ibm 把ASCIl码转换为alternate EBCDIC码。
 
conv = block 把变动位转换成固定字符。
 
conv = ublock 把固定位转换成变动位。
 
conv = ucase 把字母由小写转换为大写。
 
conv = lcase 把字母由大写转换为小写。
 
conv = notrunc 不截短输出文件。
 
conv = swab 交换每一对输入字节。
 
conv = noerror 出错时不停止处理。
 
conv = sync 把每个输入记录的大小都调到ibs的大小(用NUL填充)。
 
 
 
fdformat 命令
 
软盘是用户常用的存储介质之一。软盘在使用之前必须先作格式化操作,然后可以用tar、dd、cpio等命令存储数据,也可以在软盘上建立可安装的文件系统。
 
功能:低级格式化软盘
 
语法:format [-n] device
 
说明:该命令的作用是对软盘进行格式化。
 
-n 软盘格式化后不作检验。
 
device 指定要进行格式化的设备,通常是下述设备之一:
 
/dev/fd0d360
 
/dev/fd0h1200
 
/dev/fd0D360
 
/dev/fd0H360
 
/dev/fd0D720
 
/dev/fd0H720
 
/dev/fd0h360
 
/dev/fd0h720
 
/dev/fd0H1440
 
Linux其它命令
 
echo命令
 
echo命令的功能是在显示器上显示一段文字,一般起到一个提示的作用。
 
该命令的一般格式为: echo [ -n ] 字符串
 
其中选项n表示输出文字后不换行;字符串可以加引号,也可以不加引号。用echo命令输出加引号的字符串时,将字符串原样输出;用echo命令输出不加引号的字符串时,将字符串中的各个单词作为字符串输出,各字符串之间用一个空格分割。
 
 
 
cal命令
 
cal命令的功能是显示某年某月的日历。
 
该命令的一般格式为: cal [选项] [月 [年]] 命令中各选项的含义为:
 
– j 显示出给定月中的每一天是一年中的第几天(从1月1日算起)。
 
– y 显示出整年的日历。
 
 
 
date命令
 
date命令的功能是显示和设置系统日期和时间。
 
该命令的一般格式为: date [选项] 显示时间格式(以+开头,后面接格式)
 
date 设置时间格式
 
命令中各选项的含义分别为:
 
-d datestr, –date datestr 显示由datestr描述的日期
 
-s datestr, –set datestr 设置datestr 描述的日期
 
-u, –universal 显示或设置通用时间
 
时间域
 
% H 小时(00..23)
 
% I 小时(01..12)
 
% k 小时(0..23)
 
% l 小时(1..12)
 
% M 分(00..59)
 
% p 显示出AM或PM
 
% r 时间(hh:mm:ss AM或PM),12小时
 
% s 从1970年1月1日00:00:00到目前经历的秒数
 
% S 秒(00..59)
 
% T 时间(24小时制)(hh:mm:ss)
 
% X 显示时间的格式(%H:%M:%S)
 
% Z 时区 日期域
 
% a 星期几的简称( Sun..Sat)
 
% A 星期几的全称( Sunday..Saturday)
 
% b 月的简称(Jan..Dec)
 
% B 月的全称(January..December)
 
% c 日期和时间( Mon Nov 8 14:12:46 CST 1999)
 
% d 一个月的第几天(01..31)
 
% D 日期(mm/dd/yy)
 
% h 和%b选项相同
 
% j 一年的第几天(001..366)
 
% m 月(01..12)
 
% w 一个星期的第几天(0代表星期天)
 
% W 一年的第几个星期(00..53,星期一为第一天)
 
% x 显示日期的格式(mm/dd/yy)
 
% y 年的最后两个数字( 1999则是99)
 
% Y 年(例如:1970,1996等)
 
注意:只有超级用户才有权限使用date命令设置时间,一般用户只能使用date命令显示时间。
 
 
 
clear命令
 
clear命令的功能是清除屏幕上的信息,它类似于DOS中的 cls命令。清屏后,提示符移动到屏幕左上角。

在终端状态下使用bt….

linux下没有bt怎么行,我们还要下载电影啊!
 
上网看了看,有个教程说ctorrent可以在终端下运行,看看

将下载回来的ctorrent-1.3.2.tar.gz文件解压缩。
tar zxvf ctorrent-1.3.2.tar.gz
进入ctorrent-1.3.2目录
cd ctorrent-1.3.2
配置和编译软件
./configure
错误,要求先安装openssl。
安装apt-get install openssl libssl-dev。
重新编译就可以了
在上网看看,网上对这个东西的评价是,n长时间没有开发了,并且n长时间连接不上种子。这种就不用了。马上rm -rf掉
 
只能用官方的了,嘿嘿
 

安装
apt-get install bittorrent

说明一下,
btdownloadheadless这是纯字符界面的BT下载客户端。
btdownloadcurses支持ncurses库的客户端,有在字节界面的窗口效果。
btdownloadgui安了WXpython后就可用的GUI客户端.
btmakemetafile如果你要做种,用这个。
 
下载开始:
直接使用

btdownloadheadless 1.torrent

等啊等,下载终于开始了。。
 
不过推荐用

btdownloadcurses 1.torrent

因为多少有了点图形化。。。看起来直观点。不过似乎不稳定。
 
另外btdownload*的常用参数:
 
–max_uploads
允许最大上传者的数目(缺省是7)
 
–minport
最小可用的端口,如果你的ISP禁用BT的话,改它(比如10000)
–maxport
最大可用的端口,同上(比如20000)
 
–saveas
设置本地的下载位置
 
–check_hashes
如果你是在做种,开始前把参数设置成0以不检查文件的完整性。
 
–max_upload_rate
限上传速度,以KB为单位,0指无限上传

 

 
 
 

Linux is Not Windows

If, as I do, you spend any amount of time on a Linux forum, you’ll eventually grow exasperated, as I did, by the number of posts that run something like this:

"Hi! I’ve been using Linux for a few days, and it’s mostly great. But, it’s a shame that [something or other] doesn’t work like it does on Windows. Why don’t all the developers completely rewrite all the software so it acts more like Windows? I’m sure Linux would get lots more users if they did!"

You may even have had a go at answering these questions, only to be shot down in flames by a Linux newbie who takes it as read that his idea, based on years of experience with a different OS plus a few hours on Linux, is revolutionarily brilliant, and you only don’t like it because you’re an "old-school Linux user" who thinks that GUIs are the spawn of the Devil and everybody should be forced to stick to the CLI.

This article is aimed at explaining to those newbies exactly why their ideas tend to get flamed rather than embraced.

First and foremost, the most cherished argument: "If Linux did this, it would get lots more people converting from Windows!"

So, allow me to explain something that is fundamental to understanding Linux: The Linux community is not trying to provide the average Windows user with a replacement OS. The goal of Linux is not "Linux on every desktop".

Really. It honestly isn’t.. Yes, they’re both an OS. Yes, they can both be used for the same things. But that makes Linux an alternative, not a replacement. It might seem an insignificant distinction, but it’s actually a vitally important one.

Linux <=> Windows is like Motorbikes <=> Cars: Both are vehicles that get you from A to B via the roads. But they’re different shapes, different sizes, have different controls, and they work in fundamentally different ways. They are not freely interchangeable. They have different uses and different strengths & weaknesses, and you should pick whichever is appropriate, not pick one and expect it to do everything that the other can do.

Somebody who drives a car might be sitting in a long queue of traffic someday and see a motorbike go sailing past him. He might envy the biker’s ability to largely ignore something that is a crippling problem to a car. If that driver then said "I know all about cars, so I must know all about motorbikes!" then he’d be wrong.

  • If that driver bought a bike and then found that he was confused by the accelerator being a hand-controlled twist-grip instead of a foot-controlled pedal, he might complain that motorbikes should be fitted with a gas pedal.
  • If that driver had a wife and two kids, he might find the bike’s single passenger capacity a flaw. He might suggest that bikes be re-built so they could carry four people, two abreast.
  • If that driver were to try and drive away, only to find that he fell over because he wasn’t used to having to keep balance, he might suggest that bikes should be re-designed with four wheels.
  • If the driver were to find himself leaning around the corners, he might suggest bikes should be fitted with stabilisers to keep them upright when cornering.
  • If the driver wanted to keep his bike from being stolen, he might complain that there were no doors to lock potential thieves out, making his bike much more likely to be stolen than a car.
  • If the driver found a crash helmet an encumberance, he might suggest that an airbag in the bike’s handlebars could be fitted as an alternative to the annoying helmet.

And in every case, he would be wrong. Because he thinks that a motorbike replaces a car, he thinks it can and should do everything a car can do. He thinks it can work in the same way that a car does, that ‘missing’ car features can just be grafted on.

In the same way, well-meaning Linux newcomers make suggestions about making Linux more like what they’re used to. And they get nowhere, for all the same reasons. Linux and Windows might both be used for the same purposes, but so are a car & motorbike. That doesn’t mean you can swap directly from one to the other, and it doesn’t mean features can or should be swapped directly from one to the other.

Too many people think that migrating from Windows to Linux is like switching from a BMW to a Mercedes. They think that the controls should be the same, their experience should transfer directly, and all differences should be largely cosmetic. They think that "I need a car to use a road, I need an OS to use a computer. Cars all work the same way, therefore OSes should all work the same way." But this is not accurate. "I need a vehicle to use a road, I need an OS to use a computer. I know how to drive a car, I’m ignorant about motorbikes. I know how to use Windows, I’m ignorant about Linux."this is accurate.

A Windows user must realize that he’s only an experienced Windows user, not an experienced computer user; just like a car driver is only a car driver, not an all-road-vehicles driver. A Windows user on Linux must realize that he has just become a novice again, just like a car driver on a motorbike. A Windows user must be willing to learn that there are different ways of accomplishing the same task, just as a car driver must get used to the handlebars replacing a wheel and the need for a crash helmet he never had to use before. And they have to be prepared to accept that "different" does not mean "inferior".

This simple fact causes great difficulty for the more established Windows users. They come to Linux with many Windows habits ingrained and an attitude of "I know exactly how to use a computer, thank you very much." The problem is, they don’t. They only know how to use Windows. When they come to a different OS, these "power users" can be the ones who have the worst problems: They have far more to unlearn.

Where a newbie will just say "I don’t know" and start exploring or asking on forums, the Windows Power User will say "I know how to do this, I just do this, this, this, and then. . . It doesn’t work! Stupid OS!" And then they’ll say "If knowledgeable me couldn’t get it working, a newbie will stand no chance! Linux is nowhere near ready for desktop use!". They don’t realise that all their knowledge is working against them, causing them to have more problems than the less knowledgeable users. They’ve made the mistake of thinking Linux is different software doing the same thing as Windows, when it’s actually different software doing different things. It’s not doing a bad job of the same tasks, it’s doing a good job of alternative tasks.

Linux is an alternative to Windows, but not a replacement. It will never be a replacement, because it has incompatible goals. Microsoft’s goal is to get their software onto as many PCs as posible, as their priority is profit. Linux has no such goal, because Linux is free. It has a different priority.

To understand this is to understand FOSS . It’s perfectly understandable that Linux newbies don’t understand it yet – they’re new to it. They’re used to thinking in terms of proprietary software. So let me explain it:

Typical FOSS software is created by somebody who looks around, doesn’t find any pre-existing software he likes, and so writes his own. Then, because he’s such a nice guy, he throws open the source and says to the world "Help yourself!". He can do this, because it costs nothing to duplicate software, so it costs him no more to give it to the whole world than it would to keep it to himself. He doesn’t suffer by giving his software away.

However, the important thing to remember is: He doesn’t benefit from giving his software away, either. Whether it gets used by one person, or by one billion, makes no difference to the developer. Oh, sure, he gets the satisfaction of knowing he’s made a popular product: The number of people using it can be a nice ego boost; a way, if you will, of keeping score. But it doesn’t make him any money: It’s FOSS.

If the software is a success, other people get interested in it, and they help improve it. That’s the biggest advantage of FOSS: Every user is a potential developer. Everybody can chip in and do their part in making software work better, do more, be less buggy. It’s great when a piece of software attracts a community of developers. But it’s great for the software. It makes the software better. It doesn’t make the developer richer. It just creates more demands on his time.

FOSS is the exact opposite of proprietary software like Windows: FOSS is all about the software. It’s not about the number of end users. Software that works well but has only a few users is considers a failure by commercial software standards, but a success by FOSS ones.

FOSS is about making good quality software, software that can DO things. If you want to use it, you’re expected to invest time in learning how to use it. It was created and given to you, free of charge, by people who invested a lot of their own time in it for no personal gain. The least you could do to repay their contribution is invest a little time of your own before you complain that it doesn’t work like the parallel Windows software.

"Aha, now I’ve got you,"says a newbie smugly. "There are Linux projects with the goal of replacing Windows, not just being an alternative."

It’s easy to see where that idea comes from. KDE and Gnome, for instance, provide a desktop environment that’s far more Windows-like than typical Linux window managers and the CLI. Linspire is a distro based almost entirely around the idea of making Linux Windows-like.

However, paradoxically, these prove my point better than they prove the newbie’s.

Why? Because these projects are normal FOSS projects, revolving entirely around making the software better. The only difference is, one of the definitions of quality in these projects is "How easily can a Windows user use it?"

As soon as you factor this in, you can’t help but agree that these are 100% typical Linux, with the sole aim of improving software. These are projects made by even-more-selfless-than-usual Linux developers: They aren’t making software for their own use, as they know Linux very well. Instead, they’re making software entirely for other people’s benefit: Software that makes the transition from Windows to Linux easier.

These developers have recognised that there are Windows users who want to move to Linux, and they’ve put a lot of effort into creating a Linux environment which Windows users find comfortably familiar. But they haven’t done so to try and replace Windows, though the end result might give that impression. The end goal is what makes the difference: The goal is not to make a Windows replacement; the goal is to ease the Windows-user’s transition to Linux.

It’s not uncommon to see community hostility towards these projects. Some of it for rational, understandable reasons ("KDE is a resource hog, so use Fluxbox") but some seems to be an irrational, hostile, "Windows-like software is bad" attitude. This isn’t, actually, an anti-MS or anti-Windows attitude. Instead, it’s the far more compehensible dislike of what isn’t understood.

The ‘typical’ Linux user is a hobbyist: He uses computers because computers are fun, programming is fun, hacking is fun. And Linux is a far better OS for a hacking hobbyist: He can take it apart to its most fundamental level, and reassemble it exactly as he sees fit.

However, the current influx of Linux users has a large percentage of non-hobbyist non-hackers. They want a computer that Just Works, a computer that works like Windows. They aren’t interested in spending time setting up Linux to make it work the way they want it, they want it to work like that out-of-the-box.

And that’s perfectly okay, but from the typical Linux user’s perspective, this is like somebody who wants a Lego car that comes pre-assembled and glued together so it can’t come apart. It is alien to their understanding. The only way they can react is with a baffled "Why would anybody want that?"

It’s baffling. If you want a ready-made model car, buy a toy car. If you want a car you can build and take apart, buy Lego. Why would anybody want a Lego car that can only be used as a toy car? The whole point of Lego is that you have fun assembling it yourself!

This is how a typical Linux user reacts to the "Why can’t it Just Work?" brigade: "If you want it to Just Work, use Windows. If you want to hack it, use Linux. Why do you want to switch to Linux if you have no interest in taking advantage of its open source nature?"

The answer, usually, is that they don’t actually want to move to Linux. They just want to get away from Windows: They’re running away from viruses; they’re fleeing malware; they’re striving to be free of restrictions on how they use their paid-for software; they’re trying to escape from the clutches of the E.U.L.A. They aren’t trying to get into Linux, they’re trying to get out of Windows. Linux is simply the best-known alternative. 

More on that later. . .

You might think "Okay, that explains why developers don’t make a deliberate effort to make their software work like Windows. But surely Linux software could be given a GUI that’s WIndows-user-friendly without it interfering with FOSS principles?"

There are a few reasons why this isn’t the case.

Firstly: Do you really think that somebody who creates a piece of software deliberately gives it a lousy user interface?

When somebody devotes a large chunk of his own time to create a piece of software, he will make the user interface (UI) as good as possible. The UI is a hugely important part of the software: there’s no point having functionality if you can’t access it via the UI. You might not know what it is, but there is always a reason why the UI works the way it does. That reason? Because it is the best UI the creator could create.

Before you insist that a more Windows-like UI would make the software better, bear this fact in mind: The creator of this software, a coder who, by definition, knows far more than you do about this piece of software, doesn’t agree with you. He might be wrong, but the odds are against it.

Secondly: There already ARE nice, Windows-user-friendly GUI frontends available. I can’t think of any function off the top of my head that you can’t control via a GUI, no matter how high-level. You can compile a kernel (make xconfig), set up your firewall (fwbuilder), partition your hard drive (qtparted). . . it’s all there, pretty, interactive, intuitive, and user-friendly.

But the ‘release cycle’ of Linux isn’t like Windows. You don’t get the finished, highly-polished GUI package released right from the start. GUIs add complexity and no functionality to software. A developer doesn’t sit down and design a pretty GUI that does nothing, he sits down and creates a piece of software that does what he needs it to do.

The first thing a piece of software does is be usable from the command line interface (CLI). It will probably have all sorts of invocation options and maybe a lengthy configuration file. This is how it starts out, because it’s functionality that’s required. Everything else comes later. And even when software has a nice GUI, it’s important to remember it can still usually be controlled fully from the CLI and the config files.

  • This is because the CLI has many advantages: The CLI is universal. Every Linux system has a CLI. Every executable can be run from the CLI. It’s easy to operate software via the CLI remotely.
    None of these are true of the GUI: Some Linux machines don’t have the X11 windowing system installed; Some software has no GUI; Some software is not available from GUI menus; It’s often not easy or practical to use a GUI tool remotely.

Lastly, multiple GUI frontends can exist to do the same job, and there’s no telling which you may have installed.

So do remember, if you ask "How do I. . ?", you’ll mostly be told how to do it via the CLI. That doesn’t mean that it can only be done from the CLI. It just reflects the relative importance that the GUI has compared to the CLI in the development of a software project.

  • Windows is totally GUI-centric. It’s a GUI-based OS with a lousy (but soon to improve) CLI. There’s pretty much no such thing as non-GUI Windows software. That tends to make people think of the GUI as a vital and integral part of software. But in Linux, software gets released as soon as it’s functional. Only after it’s become stable, reasonably bug-free, and feature-rich, does it become worth adding a GUI.
    Try thinking about software without a helpful GUI as a "sneak preview" rather than a finished product. FOSS is very rarely ‘finished’, it’s always being improved. In time, it will be made user-friendly. But most of the time, it’s more important to make it work better than make it ‘feel’ better. Be glad you’ve got the functionality long before all the wimps who need a good GUI, instead of demanding tomorrow’s software today. FOSS is more of a journey than a destination.

The last thing you have to bear in mind is, GUIs for software will often be a separate piece of software. It may even have been developed completely independantly of the original piece of software, by completely separate developers. If you want a GUI, it’s not unlikely that it will be a separate installation, rather than all one piece.

This does, admittedly, mean an extra step to get that elusive, ‘Windowsy’ GUI behaviour, but that shouldn’t detract from the fact that you can, right now, do just about anything you really want to via a pretty, "just like Windows" GUI. You just have to remember: a GUI is usually the LAST step, and not the first. Linux doesn’t do form over function.

Thirdly: Linux is deliberately designed for the well-informed, knowledgeable user, rather than the ignorant beginner. This is for two reasons:

  • Ignorance may be bliss, but it’s also short-lived. Knowledge is eternal. It might take days, weeks, or months to get your knowledge level up from "Linux newbie" to "average Linux user", but once it’s there, you’ve got years of Linux use ahead of you.
    Putting in lots of code to make software easier for newcomers would be like permanently bolting stabiliser wheels to all bicycles. They might make it easier right at the start, but after that. . ?
    You wouldn’t buy a bicycle with stabilisers on it now, I’m sure. And not because you’re some anti-user-friendly freak. No, it would be because they’re useless to you, and useless to anybody other than a beginner, and all they’d do is get in the way.
  • No matter how good software is, it’s only as good as its user. The most secure door in the world is no barrier to thieves if you leave the window open, the door unlocked, or the keys in the lock. The most perfectly-tuned engine in the world won’t get very far if you fill it with diesel fuel instead of petrol.
    Linux puts all power in the hands of the user. That includes the power to break it. Nobody wins in that situation. The only way to keep Linux working well is to learn enough to know what you’re doing. Making it easier for a user to meddle with functionality he doesn’t understand would just make it more likely he’ll break something by accident.

Fourthly: Where, in any of the above text, did you see a way that FOSS would actually benefit from attracting lots of typical Windows users?

Take your time. Re-read it, if you like. I’ll wait.

The guiding principle of Linux and FOSS is "make good software". It is not "Make Windows-replacing software". The only thing a horde of typical Windows users will contribute to Linux is complaints. What will they complain? "It doesn’t work like this on Windows."

No, it doesn’t. If it worked like Windows, Linux would suck. It would be an inferior copy that nobody would use. The reason people are so passionately fond of Linux is that it doesn’t work like Windows. It doesn’t do everything for you, it doesn’t assume you’re a perpetual ignorant newbie, it doesn’t hide all the inner workings from you.

Windows chauffeurs you around; Linux hands you the keys and puts you in the driver’s seat. If you can’t drive, that’s your problem. And your fault. Plenty of people will help you learn if you ask. And if you make a suggestion that’s the equivalent of fitting cruise control, you might get somewhere: This leaves the driver in control, but takes some of the effort out. But you’ll get very short shrift if you try and convince anybody that what Linux really, really needs is a chauffeur.

"But it would get Linux so much more mainstream!", the newbie cries.

It might well do. But how many Linux developers would benefit from Linux going mainstream? Linux is free, as in beer. None of the people creating Linux profit from it gaining a bigger userbase. None of the people on the Linux forums profit from it gaining a bigger userbase. Linux’s aim is not "gain a bigger userbase" – that’s the goal of proprietary software.

Linux’s goal is to make a really good operating system. Developers are busy adding features, removing bugs, and improving existing implementations. They’re not busy putting up billboards advertising how good their stuff is. That should tell you something about where their priorities are.

And look at what this approach has done to Linux’s userbase: It’s made it grow. Linux started out tiny, and has become huge. The reason it has attracted such widespread acclaim? Because its focus has always been on quality. The users attracted to Linux are users who want the freedom and quality that only FOSS can give them. Linux became big because it didn’t care how big it got. Developers focussed solely on making it work, and work well, and so they attracted users who wanted an OS that worked, and worked well.

To suddenly throw that all away and focus instead of making Linux all about replacing Windows would be to kill the very thing that has made Linux what it is. There are corporations out there that have seen Linux’s growth, and want to cash in on it. They’re frustrated by the GPL, which makes it very hard for them to sell Linux at Microsoft prices. "Linux will die if it stays open," they say, "as nobody can make money off it like that."

They don’t realize that making Linux proprietary would be killing the goose that lays the golden eggs. Linux became big because it was FOSS, and nobody was trying to make it a Windows substitute. Linux is thriving because it’s fighting Windows on a front that Microsoft can never defeat it on: Open-ness and quality.

To most Windows users, Linux is an inferior Windows copy. It has less apparent functionality, less integration, and lots more complexity. To that type of user, Linux is seen as a bad OS. And correctly so: It doesn’t meet their needs. Their needs are an OS that’s very simple to use and does everything without them needing to learn anything.

Windows is created for non-tech users. The widespread perception amongst those users is that Linux is hard to use. This is not the case, but it’s an understandable misconception.

Linux is actually blissfully easy to use. Genuinely. It is really easy to use. The reason it isn’t perceived this way? Because the term "ease of use" has been so badly distorted. In common usage, "easy to use" now means "easy to do something without knowing beforehand how to do it". But that’s not really "easy to use", is it? That’s "easy to figure out". It’s like the difference between:

  • a safe with a notice above it saying "You unlock this safe by turning the dial to 32 then 64 then 18 then 9, then turn the key and lift the handle up"

and

  • a car that can be unlocked by pressing the remote control "unlock" button.

It’s far easier to unlock the car, right? One button from anywhere near the car, opposed to numerous highly-specific dial-turns. However, it’s easier for somebody who doesn’t know how to unlock either to get the safe open than the car: the safe has clear instructions in place, while the car just has buttons that aren’t even attached to the car.

Linux is the same. It’s easy to use if you know how to use it. It’s easy to use, but it’s not always easy to learn. Only if you are willing to invest the time in learning Linux will you find it easy. Inescapably, the more you break a task down into simple steps, the more steps you have to take to accomplish that task.

As a really simple example, take this arbitrary exercise: You want to move five lines (paragraphs) from the middle of a text document to the end.

In MS Word; MS WordPad; or MS Notepad; all "user-friendly" Windows text editors, the quickest way to do this is:
– Ctrl-Shift-Down
Ctrl-Shift-Down
Ctrl-Shift-Down
Ctrl-Shift-Down
Ctrl-Shift-Down
Ctrl-X
Ctrl-End
Ctrl-V

(That’s assuming you use the keyboard. Otherwise, you need some Click-and-Drag mouse operations and a reliable autoscroll.)

In vi, however, it is:
– d5d
– Shift-g
– p

Vi, which is about as "user-unfriendly" as it gets, beats Microsoft’s offerings hands down. Why? Because vi was designed for functionality, while Microsoft design to be "user-friendly". Microsoft break everything down into easy steps, and so it takes far more steps to accomplish the same task.

This makes vi far quicker and easier to use for virtually all text-editing tasks. Just so long as you know how to use it. If you don’t know "d5d" means "Place five lines of text in the buffer, and delete them from the document" then you’re going to struggle to make vi work. But if you DO know, then you’re going to fly along.

So when some newbie sees how fast and easily an experienced vi user can do stuff, he readily agrees that vi is superior to Word for text editing. Then he tries to use it himself. He starts it up, gets a screen full of ~s, and when he types, nothing appears on the screen.

He finds out about the text-entry and command modes, and starts trying to use vi with a limited knowledge of it’s functions. He struggles, as there are so many things he has to learn before he can make vi work. Then he complains "vi would be much better if it was as easy to use as Word!"

But the real problem is "I don’t know how to use vi and can’t be bothered to learn." But that would mean the problem was with him, so he blames his problems on the software instead. Never mind all the thousands of people who are happily using vi without any problems: It’s too hard to use, and must be changed!

And believe me, if he can make a text editor that is as "user-friendly" as Word and as functional as vi, he’ll be met with nothing but applause. In fact, he’ll probably be awarded the Nobel Prize For Extreme Cleverness, as nobody else has been able to do it yet. But just whining about vi being hard to use will be met with derision, because there’s no problem with vi, the problem is with him.

It’s like buying da Vinci’s painbrush and then complaining that you still can’t paint. The brush wasn’t what made the Mona Lisa, it was the skill of the artist. The brush is a tool that relies on the user’s skill. There’s no way to get that skill other than practice.

Same with vi. Same with many pieces of Linux software that new users complain is "too hard" or "not intuitive enough", whether they’re talking about a text editor, a package manager, or the command line itself.

Before you start insisting that something about Linux needs fixing, there’s one important question to ask: "Do experienced users have a problem with this?"

If the answer is "No", then the problem is on your end. If other people can use it successfully, why can’t you? Have you taken the time to learn how to use it? Or did you just expect it to work for you right from the word ‘Go’?

"User-friendly" and "raw functionality" are exclusive. All the little buttons and drop-down menus that are vital to make a piece of software simple to use are just obstacles that get in the way of the experienced user. It’s the difference between navigating from A to B with a map & compass, and going from A to B by following the road signs: Anybody can get there by following the signs, but they’ll take twice as long as somebody who knows how to go straight there.

 

If I want to paste the value of a formula in Excel, I have to do it via the Edit->Paste Special->Paste Values menus. I don’t want to navigate through all these pain-in-the-rear ‘friendly’ menus, sub-menus and dialogue boxes. I just want to do it. And, to be fair, if I reprogram the shortcut keys and record some macros, I can make Excel and Word do most things at the push of a button.

But that’s not really user-friendly, is it? That’s still requiring the user to invest a lot of time in the software. Linux requires you to put the time in to learn how to use the existing functionality. "User-friendly" software makes you put the time in to creating the functionality.

If that’s the way you prefer it, that’s fine, go ahead and do it that way. But don’t ever lose sight of the fact that the fault lies with your ignorance and not with the software itself. All Linux software is supremely easy to use, once you know how to use it. If you don’t know, it won’t be easy, and it won’t be because the software is at fault.

Now, you might be starting to feel that Linux has an attitude problem. It doesn’t want users, it doesn’t want to make life easy for its users. . . it’s just for snobbish l33t h4xx0r5!

Nothing could be farther from the truth. Of course Linux wants users! And of course it doesn’t want to make things hard. Quite the opposite: Hard to use software is, by definition, bad software.

But you have to realize, its definitions may be different to yours, and different to the ‘traditional’ proprietary software culture.

Linux wants users who want Linux. And that doesn’t mean just the name. It means everything: The free, open-source software; the ability to tinker with your software; the position of being in the driver’s seat, in total control.

That’s what Linux is. That’s what it’s all about. People migrate to Linux because they’re sick of viruses, sick of BSODs, sick of spyware. That’s understandable. But those people don’t want Linux. They really just want Windows without the flaws. They don’t really want Linux. So why should Linux want them?

But if they give Linux a try because of viruses and spyware, and then decide that they love the idea of an OS that they control. . . That’s when they want Linux for its own sake. And that’s when Linux wants them.

Before you decide you want to switch to Linux, ask yourself "Why do I want to switch?"

If the answer is "I want an OS that puts all the power in the hands of the user and expects him to know how to use it": Get Linux. You’ll have to invest a substantial amount of time and effort before you get it to where you want it, but you’ll eventually be rewarded with a computer that works exactly the way you want it to.

BUT. . .

If the answer is "I want Windows without the problems": Do a clean install of Windows XP SP2; set up a good firewall; install a good anti-virus; never use IE for browsing the web; update regularly; reboot after each software install; and read about good security practices. I myself have used Windows from 3.1 through 95, 98, NT, and XP, and I have never once had a virus, suffered from spyware, or been cracked. Windows can be a safe and stable OS, but it relies on you keeping it that way.

If the answer is "I want a replacement for Windows without the problems": Buy an Apple Mac. I’ve heard wonderful things about the Tiger release of OS X, and they’ve got some lovely-looking hardware. It’ll cost you a new computer, but it’ll get you what you want.

In either case, don’t switch to Linux. You’ll be dissapointed with both the software and the community. Linux is not Windows.