Marco Education The third day directory file management, text processing, user and group management

Source: Internet
Author: User

3.1.1, Linux system files are composed of data and meta-data, special files without data such as: Device files. The device file contains two classes (character devices and block devices). A character device is also called a linear device, and a block device is also called a random device.
3.1.2, command alias: Alias Name=value. Unalias to cancel the alias. echo, cp-r recursively copy files and directories: For example cp-r/etc/[mln]*[^0-9a-z]conf/tmp/mylinux3/,-p copy and preserve the original properties of the file,- A is equivalent to-DRP to save directories and files (including linked files) and retain the original attributes, MV, RM
3.1.3, ' strong reference: Do not do variable substitution, ' "" weak reference: can do variable substitution, ' ' anti-quotation: Reference command result $ () execution results as compared to the specification: Example file-$ (date +%h-%m-%s). txt.
3.1.4, File wildcard: * Any character of any length,? Any single character in any single-character, [] specified range: example [A-z], [0-9], [0-9a-z] wildcard-time letters are not case-sensitive, [^] any single character outside the specified range: examples [^0-9a-z] do not contain numbers and letters, [: space:]: whitespace characters, [: Punct:]: Punctuation, [: lower:]: lowercase, [: Upper:]: Uppercase letters, [:D igit:]: Numbers, [: Alnum:]: All numbers and letters, [: Alpha:]: All letters

3.2.1, Nano full screen editor. Linux philosophy Everything is file, all files are managed by the kernel (file standard input: 0 (default keyboard), Standard output: 1 (Default monitor), Error output: 2 (Default monitor)), redirection means: change its default location.
3.2.2, output redirection (;: overlay output, >>: Append output, 2>: Error overwrite output, 2>>: Append error output, &>: Merge output redirect (can also be written as Command>file 2 >&1), redirect (Command>file 2>file2), input redirection (< example: tr ' A-Z ' A-Z ' </etc/inittab), << here Document: Example Cat >123.txt << EOF (EOF as file terminator)
3.2.3, Wc:word count displays the number of lines of text, the number of words and bytes (-l only displays lines,-W,-c), the cut specifies the delimiter and displays the specified field (-d specifies the delimiter,-f Specifies the field to display), sort (-f ignores character case,- T specify the delimiter,-K to sort the field after the delimiter,-N to sort by numeric size,-u sort to go back to weight): example cut-d:-f1-3/etc/passwd | Sort-nuf-t:-k3, Uniq deduplication tool (-D displays only duplicate rows,-u displays only non-repeating rows, and-c counts the number of occurrences), and TR replaces the specified characters with the corresponding characters: for example, replace all lowercase letters in the Inittab file with uppercase letters: TR ' A-Z ' A-Z ' </etc/inittab, (-d delete the specified character set: For example, delete all lowercase letters in Inittab: tr-d ' A-Z ' </etc/inittab)

3.3.1,/dev/null: A data black hole is used to clear all data pointing to it, set to set bash some features. Useradd: Add Users If you do not specify a user group, a group with the same user name is created automatically as the base group for adding users. Users can join multiple groups (Basic group, additional group)
3.3.2, users and groups are the core elements of the implementation of the allocation of resources, the user is divided into three categories (administrator: 0, the System user 1-499 (no need to login only to run the background program), ordinary users 500 +, the group is divided into three categories and the same user concept password is a verification mechanism to verify the identity of the user credentials. Permissions are a mechanism for allocating resources that govern the rights of users to use resources.
3.3.3, file permissions, r (view file contents), W (can modify file contents), X (to run this file and submit it to the kernel to start as a process). Directory permissions, R can view the list of files in the directory, W can create and delete files in the directory, and X can go into the catalog file.
3.3.4,/etc/passwd user account information, format account (user name):p assword (password position): UID (User ID): GID (Basic group ID): GECOS (note information):d irectory (home directory): Shell (default shell). /etc/shells View the security shell that the system can use
3.3.5,/etc/group user group information, format description group_name (group name):p asswd (group password Placeholder): GID (group ID): User_list (all users under this group)
3.3.6, useradd Add User (-u specify user uid,-G Specify user base group GID,-G Specify user's additional group (can add multiple additional groups to, separate),-c annotation information,-D to specify home directory (when the family directory already exists, will report a warning message, and will not copy/ etc/skel/file to directory),-s to specify the user shell (must be a shell in the/etc/shells file),-R Add System user,-M do not specify home directory). When adding a new user, the files under this directory will be copied to the user's home directory (/etc/skel/)

3.4.1, passwd Ordinary users can only modify their own password, the administrator can modify any user password.  Password complexity (number, uppercase, lowercase, special characters at least 3 kinds, the shortest 5 bits, not suitable for easy-to-guess passwords, regular replacement)--stdin no need to interactively change passwords: Example of echo "$SHELL" | passwd--stdin username &>/dev/null,-l Lock user,-u unlocks user.
3.4.2,/etc/shadow user passwords and related settings, Format Description: User name: encrypted password: The last time the password was modified (Unix years to Change password days): Minimum password age (0 means no setting): Password maximum age: Password Expiration warning Time: Password inactivity period (password expires after entering the system change password time, Do not change the use of system resources, this period expires after the system lock account): Account expiration period (after the account expires): The reserved area is not used
3.4.3, Userdel Delete user (-R and delete the user and home directory), Groupdel, Usermod (using the same parameters and useradd, note that modifying-G will overwrite the original add-on group is generally used together with-a,- D and-M use to modify the home directory and move the original files to the new home directory), ShCh can modify the user shell, CHFN can modify user comments information, ID display user-related information (-G,-G,-U,-N), finger view user information. SU option (-Security switch,-C executes a command)

Marco Education The third day directory file management, text processing, user and group management

Related Article

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.