Linux instruction type (i) Change directive

Source: Internet
Author: User
Tags file permissions

I. Change instructions

Chattr

Chgrp

chmod

Chown

Chfn

Chsh

Chroot

Second, the CH instruction detailed introduction (1) chattr

Full Name: Change attribute

function: The chattr command is used to change file properties

Syntax: chattr [-RV][-v< version number >][+/-/=< Properties >][file or directory ...]

Parameters:

-R recursively handles all files and subdirectories under the specified directory.

-v< version number > set file or directory version.

-V Displays the instruction execution process.

+< Properties > Open the Item property of the file or directory.

-< Properties > Close the Item property of the file or directory.

The =< property > Specifies the Item property of the file or directory.

Property:

A: Make the file or directory available for additional use only.

B: Do not update the last access time of the file or directory.

C: Compress the file or directory and store it.

D: Exclude files or directories from dumping operations.

I: Do not alter the file or directory arbitrarily.

S: Privacy delete files or directories.

S: Update files or directories instantly.

U: Remove outside of prevention.

Example:chattr +i /etc/resolv. conf

(2) Chgrp

Full Name: Change Group

Role: The CHGRP command is used to change the owning group of a file or directory

Syntax:chgrp [-cfhrv][--help][--version] [affiliation Group] [file or directory ...]

or chgrp [-cfhrv][--help][--reference=< reference file or directory >][--version [file or directory ...]

Parameters:

The-C or--changes effect resembles the "-V" parameter, but returns only the part of the change.

-F or--quiet or--silent does not display an error message.

-H or--no-dereference only modifies the signed file, without altering any other related files.

-R or--recursive recursively handles all files and subdirectories under the specified directory.

-V or--verbose shows the instruction execution process.

--help online Help.

--reference=< reference file or directory > set all of the assigned files or directories to the same group as the reference file or directory.

--version Displays version information.

Example: Chgrp-v bin Log2012.log

ll #显示信息

(3) chmod

Full Name: Change mode

Role: chmod can be used to control how files are called by others

Syntax: chmod [-CFVR] [--help] [--version] Mode file ...

Mode: Permission set string, format such as: [Ugoa ...] [[+-=][RWXX] ...] [,...]

Mode parameter:

U represents the owner of the file, and G indicates that the owner of the file belongs to the same group (group), and O means the other person, and a means that all three are.

+ indicates an increase in permissions,-represents a cancellation permission, = Represents a unique set of permissions.

R means readable, w means writable, x is executable, x means only if the file is a subdirectory, or the file has been set to executable.

Additional parameter Description:

-C: If the file permission has changed, it will not show its change action

-F: Do not display an error message if the file permissions cannot be changed

-V: Show details of permission changes

-r: The same permissions change for all files in the current directory as subdirectories (that is, they are changed in a recursive manner)

--HELP: Show Auxiliary Instructions

--version: Display version

Example: chmod ugo+r file1.txt

chmod +x test.sh

(4) Chown

Full Name: Change owner

Role: Chown The owner of the specified file to the specified user or group, the user can be either a user name or a user ID, a group can be a group name or a group ID, and a file is a space separate list of files to change permissions, and wildcard characters are supported.

Limitation: Only the system administrator (root) has this permission.

Syntax: chown [-CFHVR] [--help] [--version] user[:group] File ...

Parameters:

User: The user ID of the new file owner

Group: The user group of the new file owner (group)

-C: If the file owner does change, the change action is displayed

-F: Do not display an error message if the owner of the file cannot be changed

-H: Changes to the link only, not the file that the link really points to

-V: Show details of owner changes

-R: The same owner changes to all files in the current directory as subdirectories (that is, they are changed individually in a recursive manner)

--HELP: Show Auxiliary Instructions

--version: Display version

Example: Chown jessie:users file1.txt

(5) CHFN

Full Name:

Function: Used to change the information displayed by the finger command. This information is stored in the passwd file in the/etc directory. If you do not specify any options, the CHFN command enters the question-and-answer interface.

Syntax: CHFN [parameter] [user name]

Parameters:

-f< real name > or--full-name< real name;: Set real name

-h< Home Phone > or--home-phone< home phone: Set the phone number in your home

-o< Office Address > or--office< Office Address: Set Office Address

-p< Office Phone > or--office-phone< Office Phone: Set the office phone number

-U or--help: Online Help

-V or-version: Displays version information.

Example: CHFN
Chfn-f Jack.

(6) Chsh

Full Name: Change shell

Role: The CHSH command is used to change the user shell settings.

Syntax: chsh [parameters] [Shell path]

Parameters:

-S or--shell: Changes the system preset shell environment.

-L or--list-shells: Lists the shell lists available for the current system

-U or--help: Online Help

-V or-version: Displays version information.

Example: Chsh

Chsh-s/bin/zsh

(7) Chroot

Full Name: Change root

Role: The chroot command is used to change the root directory.

Syntax: chroot [--help][--version][destination directory] [execution instructions ...]

Parameter description:

--help online Help.

--version Displays version information.

Example: Chroot/mnt/ls//changing root directory

Linux instruction type (i) Change directive

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.