linux chmod+x_在Linux和Unix中,“ chmod + x”命令有什么作用?

linux chmod+x

linux chmod+x

chmod  is very useful tool to manage file modes like read write execute. One of the most used option for chmod is +x which stands for execution rights. In this tutorial we will look different use cases for user or owner, group and others roles.

chmod是用于管理文件模式(如读写执行)的非常有用的工具。 chmod最常用的选项之一是+x ,代表执行权限。 在本教程中,我们将介绍用户或所有者,组和其他角色的不同用例。

列出当前用户和文件组 (List Current User and Group Of A File)

We generally need to know given file current user and group. We will use ls  command with -al options in order to list this information.

我们通常需要知道给定文件的当前用户和组。 我们将使用带有-al选项的ls命令以列出此信息。

$ ls -al app.sh
List Current User and Group Of A File
List Current User and Group Of A File
列出当前用户和文件组

更改用户的文件模式(Change File Mode For The User)

We can use u user before the plus in order to enable user execution right of the given file. In this example we will enable user execution of file app.sh

我们可以在加号之前使用u user,以启用给定文件的用户执行权。 在此示例中,我们将允许用户执行文件app.sh

$ chmod u+x app.sh

更改组的文件模式 (Change File Mode For Group)

We can use g group before the plus in order to enable group execution right of the given file. In this examples we will enable group execution of file app.sh

我们可以在加号之前使用g组,以启用给定文件的组执行权。 在此示例中,我们将启用文件app.sh组执行

$ chmod g+x app.sh

更改其他文件模式 (Change File Mode For Other)

Others is special group which covers all users in a Linux system. We can enable the execution right of the all users in a file with o like below.

其他是专门的小组,涵盖Linux系统中的所有用户。 我们可以使用如下所示的o启用文件中所有用户的执行权。

$ chmod o+x app.sh

更改所有人的文件模式 (Change File Mode For All)

In some cases we can see the +x  without a definition. This is used for all which is equivalent for user , group and others . Alternative is adding a like below.

在某些情况下,我们可以看到没有定义的+x 。 这用于所有与usergroupothers等效的东西。 另a是在下面添加a类似。

$ chmod a+x app.sh

OR

要么

$ chmod +x app.sh
LEARN MORE  How To Add Existing User To A Group In Ubuntu?
了解更多如何在Ubuntu中将现有用户添加到组中?

翻译自: https://www.poftut.com/chmod-x-command-linux-unix/

linux chmod+x

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值