Linux learning the next day (Rights Management commands, file search commands, help commands)

Source: Internet
Author: User

Add user Two-step walk: 1.useradd username 2.passwd PS

Rights Management Commands

Command name:chmod->>change The permissions mode of a file

Command path:/bin/chmod

Execute Permissions: All Users

Syntax: chmod [{u g o} {+-=}{rwx}][file or directory]

[mode = 421] [File or directory]

+: Increase Permissions

-: Reduce permissions

=: Give permission directly

the focus of mastery is to use the digital way of authority control, r=4 w=2 x=1.

rwxr-xr--= 754

Rw-r-x--x = 651

Example: chmod g+w file

chmod 777 File

RWX Permissions in a file

R-cat, more, head, tail

W-echo, vi modify content, cannot delete

X-Commands, scripts

RWX Permissions for the directory

R-ls

W-touch, mkdir, rm delete new

X-Enter the directory

Function Description: Change file or directory permissions

Command name:chown->>change file ownership

Command path:/bin/chown

Execute Permissions: All Users

Syntax: chown [user] [file or directory]

Example: Chown Nobody file to change the owner of files to nobody "system comes with"

Command name:chgrp->>change file group ownership

Command path:/BIN/CHGRP

Execute Permissions: All Users

Syntax: chgrp[user [file or directory]

Example: chgrp Nobody file to change the owning group of files for ADM "System comes with"

Command name:umask

Command path:/bin/umask

Execute Permissions: All Users

Syntax: Chgrp[-s]

-S displays the new file or directory default permissions in the Rwx form

0022

0-Special Permission bit

022-user permission bit, permission mask value

Its true value is 777-022 = 755

Linux permissions rule: Files created by default cannot be granted discretionary x permissions

So a file created with touch, with a value of 644, can mask many attacks, trojans and viruses.

Function Description: Displays, sets the default permissions for the file.

File Search Command

Command name:which

Command path:/bin/which

Execute Permissions: All Users

Syntax: which [command name]

Function Description: Displays the directory where the system commands are located and can only find commands

Example: Which LS

Command name:Find

Command path:/usr/bin/find

Execute Permissions: All Users

Syntax: find[search path [search keywords]

Function Description: Find files or directories

Example:find/etc-name init---->>> Find file init in directory/etc, files containing the init keyword are not searched

When you don't remember your full name, you can use wildcards to search

* matches any character? Match a single character

Find /-size +204800---->>> look for files larger than 100MB in the root directory

Less than how much to use-204800

100MB = 102400kb = 204800 block 1block = 512 bytes

find/home-usr Samlee->>>>> Find the file owner-Samlee under the root directory

  find/etc-mmin-120 files modified in etc directory for two hours

Time

1, Days CTime, Atime, Mtime

2, Minutes Cmin, Amin, Mmin

-like, + more than

C-change change: Indicates that the properties of the file (owner, owning group, permissions, and so on) have been modified

A-access Access:

M-modify: Indicates that the contents of the file have been modified

Connector-a and-o or

Connector find ...-exec command {} \; where {} represents the result of the Find query

-ok Ask for confirmation

Find/etc-size +163840-a-size 204800

Files larger than 80m and less than 100M

-type Lookup based on file type F binary file l Soft link file-D directory

-inum Search based on I node

Command name:Locate

Command path:/usr/bin/locate

Execute Permissions: All Users

Syntax: locate[keywords]

Function Description: Find a file or directory, based on the installation and the regular update of the contents of the database to find and do not need to find the entire hard disk, generally with updatedb use

The speed is much faster than find.

Example: Locate file

Command name:updatedb--->> update the slocate database

Command path:/usr/bin/updatedb

Execute permissions: Root

Syntax: UpdateDB

Function Description: Create a database of the entire system catalog file

Example: UpdateDB

Command name:grep

Command path:/bin/grep

Execute permissions: All user

Syntax: grep[specified string [source file]

Function Description: Searches the file for the specified string and outputs

Example: grep ftp/etc/services

Command name: Man---->> manual

Command path:/usr/bin/man

Execute permissions: All user

Syntax: grep[command or config file command or configuration file just write the name, don't write absolute path

The first is the Help for the command, and the fifth is the help for the configuration file. Use when a name is used to differentiate even if the command is a configuration file

Mans 1 Password

Mans 5 Password

Function Description: Get help information

Example: Man ls

Command name:Info---->> Information

Command path:/usr/bin/info

Execute permissions: All user

Syntax: info[command or config file command or configuration file just write the name, don't write absolute path

Function Description: Get help information, and man's difference is only in the way the content is presented.

Example: Info ls

Command name:Whatis Apropos Makewhatis

Command path:/usr/bin/whatis apropos

/usr/sbin/makewhatis

Execute permissions: All User,root

Syntax: whatis[command or config file command or configuration file just write the name, don't write absolute path

Function Description: The most basic usage of the Extract command

Example: Whatis ls

Apropos fstab equivalent to Man-k

Command--help to list the options for the command

Help built-in commands: View the shell's built-in commands

Linux learning the next day (Rights Management commands, file search commands, help commands)

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.