hsy75的个人空间 https://blog.eetop.cn/vivilife [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

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

已有 1252 次阅读| 2012-3-21 16:49 |个人分类:linux

FYI...
这个网站介绍的是shell和dos命令

http://ss64.com/index.html

和MAN的不同是,这里不仅介绍命令,同时又很多例子
而且,最搞笑的是,作者还写了一些web脚本,动态的演示结果
所以推荐!!

e.g.

chmod

Change access permissions, change mode.

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

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.

Permissions:


owner group other
read
write
execute
Numeric mode:

From one to four octal digits
Any omitted digits are assumed to be leading zeros.

The first digit = selects attributes for the set user ID (4) and set group ID (2) and save text image (1)S
The second digit = permissions for the user who owns the file: read (4), write (2), and execute (1)
The third digit = permissions for other users in the file's group: read (4), write (2), and execute (1)
The fourth digit = permissions for other users NOT in the file's group: read (4), write (2), and execute (1)

The octal (0-7) value is calculated by adding up the values for each digit
User (rwx) = 4+2+1 = 7
Group(rx) = 4+1 = 5
World (rx) = 4+1 = 5
chmode mode = 0755

Examples

chmod 400 file - Read by owner
chmod 040 file - Read by group
chmod 004 file - Read by world

chmod 200 file - Write by owner
chmod 020 file - Write by group
chmod 002 file - Write by world

chmod 100 file - execute by owner
chmod 010 file - execute by group
chmod 001 file - execute by world

To combine these, just add the numbers together:
chmod 444 file - Allow read permission to owner and group and world
chmod 777 file - Allow everyone to read, write, and execute file

Symbolic Mode

The format of a symbolic mode is a combination of the letters +-= rwxXstugoa
Multiple symbolic operations can be given, separated by commas.
The full syntax is [ugoa...][[+-=][rwxXstugo...]...][,...] but this is explained below.

A combination of the letters ugoa controls which users' access to the file will be changed:

User letter
The user who owns it u
Other users in the file's Group g
Other users not in the file's group

o

All users a

If none of these are given, the effect is as if a were given, but bits that are set in the umask are not affected.

All users a is effectively user + group + others

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.

The letters 'rwxXstugo' select the new permissions for the affected users:

Permission letter
Read r
Write w
Execute (or access for directories) x
Execute only if the file is a directory
(or already has execute permission for some user)
X
Set user or group ID on execution s
Save program text on swap device t

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

Examples
Deny execute permission to everyone:
chmod a-x file

Allow read permission to everyone:
chmod a+r file

Make a file readable and writable by the group and others:
chmod go+rw file

Make a shell script. executable by the user/owner
$ chmod u+x myscript.sh

Allow everyone to read, write, and execute the file and turn on the set group-ID:
chmod =rwx,g+s file

Notes:
When chmod is applied to a directory:
read = list files in the directory
write = add new files to the directory
execute = access files in the directory

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.

This page documents the GNU version of chmod.

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

Related:

access - Determine whether a file can be accessed
ls -l - List current permissions: -- u (owner) -- g (group) -- O (Other)
chgrp - Change group ownership
chown - Change file owner and group
bash syntax - Permissions
Equivalent Windows command: CACLS - Change file permissions



REF:
-http://ss64.com/index.html

点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 2

    粉丝
  • 1

    好友
  • 2

    获赞
  • 14

    评论
  • 3241

    访问数
关闭

站长推荐 上一条 /2 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-19 15:06 , Processed in 0.015827 second(s), 7 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部