15 common Linux Command Line summaries (1)

Source: Internet
Author: User

Many Linux administrators often use many Linux Command lines when using Linux, most of which are not frequently used. This article mainly summarizes the fifteen most commonly used Linux Command lines, hoping to help users who have just come into contact with Linux Command lines.

1. List of the most common commands

The following lists the ten commands that are frequently used in linux. Here is a brief introduction. For detailed usage, refer to the following content.

Cat: displays the file content. Cd to change the directory path. Cp, copy the file. Find to find the file. Grep: Search and filter information. Ls to list directory information. More, display by page. Rm: delete a file or directory. Vi: Call the vi text editor. Who: displays logon user information.

2. chmod ---- change the access mode of one or more files)

chmod [options] mode files

Only file owners or privileged users can use this function to change the file access mode. Mode can be in the digital format or in the who opcode permission format. Which is optional. The default value is a (all users ). Only one opcode can be selected ). You can specify multiple modes separated by commas.

Options:

-C, -- changes only outputs the information of the changed file-f, -- silent, -- quiet. When chmod cannot change the file mode, the user -- help of the file is not notified to output help information. -R, -- recursive recursively traverses sub-directories, and applies the modification to all files and sub-directories in the directory. -- reference = filename sets the permission by referring to the filename permission.-v, -- verbose outputs the version information of each file no matter whether the modification is successful or not.

Who

U user g group o all other a users (default)

Opcode

+ Add permissions-delete permissions = reassign Permissions

Permission

R read w write x execute s set user (or group) ID t Set sticky bit ), prevent files or directories from being deleted by non-owner u user's current permission. The current permission of group g is o the current permission of other users.

In most cases, we use three Octal numbers to indicate permissions. The first one is the owner permission, the second is the group permission, and the third is the permission of other users, each permission is determined by the sum of four (read), two (write), and one (execution) values. For example, 6 (4 + 2) indicates that you have the read and write permissions, and 7 (4 + 2 + 1) indicates that you have the read, write, and execution permissions.

You can also set the fourth digit, which is located before the three-digit permission sequence. The fourth digit is 4, 2, and 1, which means the following:

4. Set the user ID during execution to authorize the process based on the file owner, instead of the user who creates the process. 2. Set the user group ID during execution to authorize the process based on the file group, instead of the user who creates the process. 1. Set the adhesion position

Instance:

$ Chmod u + x file: grant the execution permission to the file owner $ chmod 751 grant the file owner the read, write, and execute (7) permission, assign the read and execute (5) permissions to the group where the file is located, and assign the execution (1) permissions to other users $ chmod u = rwx, g = rx, o = another form of example on x file $ chmod = r file assigns read permissions to all users $ chmod 444 file same as above $ chmod a-wx, a + r in the same example as above $ chmod-R u + r directory recursively assigns read permissions to the owner of all files and subdirectories in the directory $ chmod 4755 sets the ID, assign read, write, and execution permissions to the owner, and assign read and execution permissions to the group and other users.

3. chgrp ---- modify the group to which the file or directory belongs

chgrp [options] newgroup files/directorys

The group name can use the group ID or the group name in/etc/group. Only the file owner or privileged user (root) can change its group.

Options:

-C, -- changes only outputs the information of the changed file-f, -- silent, -- quiet. If the file group attribute cannot be changed, the user -- help of the file is not notified to output the help information. -R, -- recursive can recursively traverse sub-directories and set the current file group-v by referring to the group information of filename for all files and sub-directories under the directory -- reference = filename, -- verbose output details -- version output version information

Instance:

$ Chgrp root test: Change the root group of test to the root group $ chgrp-R mysql test recursively sets the group attributes of the test directory and all files and subdirectories in the directory to mysql $ chgrp root * set the group attribute of all files in the current directory to root.

4. chown ---- set the owner identity of one or more files or directories

chown [options] newowner files/directorys

The new owner can be the user's ID or the login name in/etc/passwd. Chown can also accept the form newowner: newgroup or newowner. newgroup. Change the attributes of the group. If there is no group name after the periods and colons, the group is changed to the new owner group. Only the current owner of a file or directory has the right to change its attributes.

Options:

-C, -- changes only outputs the information of the changed file -- dereference trace Symbolic Link-h, -- no-dereference changes the owner identity of each symbolic chain, instead of the owner identity of the referenced file-f, -- silent, -- quiet, when the file owner attribute cannot be changed, the file user-help is not notified to output help information. -R, -- recursive can recursively traverse sub-directories and change the owner of all files and sub-directories under the directory -- reference = filename to the owner of the filename file-v, -- verbose output details -- version output version information.

Instance:

$ Chown root test improves the root test_directory of the test file by recursively changing all file owners in the test_directory directory to root $ chown -- dereference root test_link the original file owner is changed to root, the owner of the linked file remains unchanged $ chown -- no-dereference root test_link: Change the owner of The Link file of test_link to root, and the owner of the original file remains unchanged.

5. date ---- display and modify the system time

Date [options] [+ format] [date] $ date-s 06/09/2004 modify the date format by month, day, and year) $ date-s 13:56:00 modify the time format by hour, minute, and second) $ date-r test shows the last modification time of the test file $ date + '% Y-% m-% d' to display the date in yyyy-mm-dd format, for other formats, see help $ clock-r to query the BIOS time $ clock-w to write the modified time back to the BIOS.


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.