像我儿子一样永远保持好奇和梦想

【转】一个非常有用的参考网站 - Man for shell and DOS

上一篇 / 下一篇  2012-03-21 16:49:23 / 个人分类:linux

FYI...ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台i,["X cH [;X {
这个网站介绍的是shell和dos命令ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台`S1Obu8Bb

TWF:lg!DeQ0http://ss64.com/index.html
0cLi3qMD c#k0ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台8kOZe si F
和MAN的不同是,这里不仅介绍命令,同时又很多例子
UV\:qc;lEmt0而且,最搞笑的是,作者还写了一些web脚本,动态的演示结果
,f!a$|6a2O0所以推荐!!
NOh%[|G q0
e.g.ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台"`&gn3g:i'\

chmod

ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台&wK!u!dS7G g

Change access permissions, change mode.

NgKgY~0
Syntax
       chmod [Options]... Mode [,Mode]... file...

       chmod [Options]... Numeric_Mode file...

       chmod [Options]... --reference=RFile file...

Options
  -f, --silent, --quiet   suppress most error messages

  -v, --verbose           output a diagnostic for every file processed
  -c, --changes           like verbose but report only when a change is made

      --reference=RFile   use RFile's mode instead of MODE values

  -R, --recursive         change files and directories recursively

      --help              display help and exit

      --version           output version information and exit

[ M7v|\_ |qs0 chmod changes the permissions of each given file according to mode, where mode describes the permissions to modify. Mode can be specified with octal numbers or with letters. Using letters is easier to understand for most people.

d8m ]'yD?*Nn'\0
Permissions:

*{ l0RlX\?4Y'wx/c0

x6r_a4L0
owner group other
read
write
execute
Numeric mode:

!R9m(QV$Z0

#L0R0b$U*z-|0

!mn'r9T0y-d\0From one to four octal digitsET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台K.U*V'Y#m k
Any omitted digits are assumed to be leading zeros.
*A3?{bZrx#j0
g7t#mO"rNY0The first digit = selects attributes for the set user ID (4) and set group ID (2) and save text image (1)SET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台9zT3]?sU*Q|
The second digit = permissions for the user who owns the file: read (4), write (2), and execute (1)
]"f9^Q L4t|8}0 The third digit = permissions for other users in the file's group: read (4), write (2), and execute (1)
OK!|c+J[~ V0 The fourth digit = permissions for other users NOT in the file's group: read (4), write (2), and execute (1)ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台[4?1` D0ihq+b-D2y

;T&@ Lh(\ lT0 The octal (0-7) value is calculated by adding up the values for each digitET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台D\ ssjj4r_!l
User (rwx) = 4+2+1 = 7ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台 @`'K0CY+AT-}#\/B
Group(rx) = 4+1 = 5
S,Z8qAz*G:s&oAC[0 World (rx) = 4+1 = 5
JJq}j Y!g\/{!F)}.w0 chmode mode = 0755 ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台 If#a Lx3N6s

ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台B"l;B0Fo}

ExamplesET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台q7c l5Cy'ofr7`
ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台?(b K,e|"t\
chmod 400 file - Read by ownerET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台wu x e6q)_*S
chmod 040 file - Read by groupET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台d MDUKl j.i
chmod 004 file - Read by world
b/ul9Xm0
8v4nP:iUQ;c%q0 chmod 200 file - Write by owner
,O4a qs]$la7n0 chmod 020 file - Write by group
,t,~4[ at.s0 chmod 002 file - Write by world
_(rz_#F1wE]gF0 ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台}ed&G4\u8x1hG
chmod 100 file - execute by owner
yrIEg+r+y0 chmod 010 file - execute by group
C5I2u%S{Xs3u-~0 chmod 001 file - execute by world

vBZp CW)\6^0

;D'J!?6ND0wTk0To combine these, just add the numbers together:
|!f V$v#pWl"X0 chmod 444 file - Allow read permission to owner and group and worldET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台%Tr9Ti^)L@
chmod 777 file - Allow everyone to read, write, and execute fileET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台` b {)r3d7C Pr

ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台xyCq]5_U w

Symbolic Mode

^7j:H3|Xbm| n0ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台,EWX%t4w-wH"FG

The format of a symbolic mode is a combination of the letters +-= rwxXstugoa
a N'S#l(i&xl%j1k8vC0 Multiple symbolic operations can be given, separated by commas.
%C2A5E~5x U%U0 The full syntax is [ugoa...][[+-=][rwxXstugo...]...][,...] but this is explained below. ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台p6`\IBJ

p+LB[ m$XM0 A combination of the letters ugoa controls which users' access to the file will be changed:

,q&JgjtAfH\0
User letter
The user who owns it u
Other users in the file's Group g
Other users not in the file's group

oX n4Fj)};{;~ pS0o

"Ye@(S3O}'|s1r6]0
All users a

2S C8G rx f0If none of these are given, the effect is as if a were given, but bits that are set in the umask are not affected.
#jK2DT(m8T v0 ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台Y:ZJq1Re
All users a is effectively user + group + others
o0q5T a3eE0 ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台"Iu[UQ
The operator '+' causes the permissions selected to be added to the existing permissions of each file; '-' causes them to be removed; and '=' causes them to be the only permissions that the file has.ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台0D f q;~`l(m[ @(Sm"]

-b-ld+oy0 The letters 'rwxXstugo' select the new permissions for the affected users:

jC^2D:d#a0bj0
Permission letter
Read r
Write w
Execute (or access for directories) x
Execute only if the file is a directory ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台3f(Ypy,^-V(A
(or already has execute permission for some user)
X
Set user or group ID on execution s
Save program text on swap device t
ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台CG KZ YE{ BP
The permissions that the User who owns the file currently has for it
u
The permissions that other users in the file's Group have for it g
Permissions that Other users not in the file's group have for it o

`dD Aeosj0ExamplesET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台*VAdX| } L.@/R9V } v
Deny execute permission to everyone:
5Rr;H9I8J+p;\tk7}0 chmod a-x fileET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台5?dgCm'q~iG

nP H6e~nz0 Allow read permission to everyone:
X$U'OJ#wA${/jU0 chmod a+r fileET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台4cdx#A0o C

x3lw D5e c8[se0 Make a file readable and writable by the group and others:
B$i#G mb vB!x0 chmod go+rw file

4X.kf;c/IT WQ0

[8ZA+?6kN9Bq0Make a shell script. executable by the user/owner
oX'V*|2f9e'T\ j0 $ chmod u+x myscript.shET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台M^7Px:}
ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台)Rq,^Qp
Allow everyone to read, write, and execute the file and turn on the set group-ID:
B2j[Ig1iJy*M\0 chmod =rwx,g+s file ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台PZ-AJeQK
ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台U:O rMg
Notes:ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台L*K+j s#T'^3Y U
When chmod is applied to a directory:
o'],x:s"B0 read = list files in the directory
Vmt/WU/RZ0 write = add new files to the directory ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台.mk}aR.E
execute = access files in the directory ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台Pc+G$j Fh(U H9h
ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台 Z^)a5Z j P%s8f
chmod never changes the permissions of symbolic links. This is not a problem since the permissions of symbolic links are never used. However, for each symbolic link listed on the command line, chmod changes the permissions of the pointed-to file. In contrast, chmod ignores symbolic links encountered during recursive directory traversals.

'TFv/G0n7H0 ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台;zP$e8?K bP0Nm

This page documents the GNU version of chmod.ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台q~%ITC wP

8w?,cMs7vR Bx0"Whether a pretty woman grants or withholds her favours, she always likes to be asked for them" - Ovid (Ars Amatoria)

%P9v5` ~'u,a0 ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台"nH#E0FzzZ

Related:ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台-|;I5GS ^;?N
ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台![[-O8FI3j%RQ@
access - Determine whether a file can be accessed
1va W/rP$Pq0 ls -l - List current permissions: -- u (owner) -- g (group) -- O (Other)
U1h_;G O0K0 chgrp - Change group ownership
x |C%T~X@?0O0 chown - Change file owner and groupET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台6Ze!v f7J%G
bash syntax - Permissions
IV} vD{r0 Equivalent Windows command: CACLS - Change file permissionsET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台RA6]D-n

ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台7OV0\6C3V%u4l&d

REF:ET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台o$uXV2\
-http://ss64.com/index.htmlET创芯网(EETOP)-电子设计论坛、博客、超人气的电子工程师资料分享平台 ?k8~w F sdPF8m

TAG: bash Dos dos linux Linux LINUX man shell

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

Open Toolbar