Topic - Basics (2) about Linux

Basic knowledge about Linux

  Users CRUD, rights management

  First of all, we first learn how to learn how to view the user information in Linux:

  id users: You can view the information of the user

  Creating a user has five parts: four document rights management; configuration file required under / home users to copy already exists;

  Its four managing user permissions are: / etc / passwd, / etc / group, / etc / shadow, / etc / gshadow four files;

  Among them, we were to look at the contents inside look at these four files:

  /etc/passwd

  alex:x:1001:1001::/home/alex:/bin/bash

  Username: Password (of course not stood here): User ID: Group ID: Remarks information: Path: the first command execution

  /etc/group

  alex:x:1001:

  Group name: Password: Group ID: can add other users to this group (optional)

  /etc/shadow

  alex:.......:7::

Only to master the first two: Username: after encryption password: .......

  /etc/gshadow

  alex:!::

 Group Name: Password (generally not set for when representatives did not!)

  Mastered these basics, we need to learn to manage a user: useradd, usermod, userdel

  Note: Linux General Command mode: command options parameters

  useradd: add a user

  usermod: Modify a User

  Options:

  -u: Specifies the user's UID

  -g: Specifies the user group ID

  -d: Specifies the home directory

  -c: Alternate specified user information

  -s: Specifies the user with shell

  userdel: Delete User

  -r: completely delete user

  Tip: For the above things: useradd user

                                          passwd user

                                         Two instructions all use to create a user

                                           userdel -r user  

                                           To completely delete a user

For the management group, we have three commands: groupadd, groupdel, groupmod

    groupadd: Add a group  

    groupdel: delete a user

    groupmod: modify a user

  Optional parameters:

     -g: group name modification

     -n: name of the modified group

Rights management file, directory

  Whether it is for file and directory, all files exist in the form of memory inside, which there is a rights management for different files under different user in Linux:

  For purposes of the file: r (read), w (write), x (executable) is represented by these things

  For purposes of Contents: r (read), w (create, delete, rename) x (enter switch)

  For files and directories, it will include the following attributes:

  Number of hard links permission information owner is a group of file size file creation time of the file name

  -rw-------.

  The first: a text message on behalf of

  -: representatives plain text

  d: is the target file type

  l: soft links

  b: block device file

  p: pipe file

  2-4: owner permissions ----> u

  Permissions three categories: r read w write x execute

  Bit 5-7: is a group of permissions -> g

  Permission is above

  8 - 10: Other users -> o

  Ditto

  Representatives are safety signs

  User permissions to view:

  ll: permission to view the current file directory

  ll -d / home / alex /: View alex directory permissions

Add this: how to execute the file: ./ file path name

  Permissions on the file / directory changes

  chomd u = + rwx alex write directly to the file name or directory name to execute the action

  chown modify the name of the owner and is a group of

  chown  root.root  a.txt

  Recursive changes owner and name is a group of

  chown root.root  {1....9}.txt

  Modifies its catalog circulation as well as the following directories and files

  chown   -R lhf.lhf  /test/

  Add that: performing read and write to the above, we can also use the numbers represent: r = 4, w = 2, x = 1; how much added directly, then give u / g users like it.

  >: Represents the contents of the left cover to the right of the file

  >>: Represents the additional content on the left to the right

  old cat file> new file

  echo 'hello'> New File

  two cat File> New File

  Additional mention two instructions:

     |: The contents of the previous output as input on behalf of the back of the input

    wc -l file: Shows the number of lines in the file

  File

  tar -c (create) v (version) f (filename) test.tar plurality of files

  Representative test.tar compressed files into a plurality of files and displaying compressed process

  tar -t (View) f test.tar  

  View the contents of compressed files compressed behalf of

  tar xvf filename specified path -C   

  Representative specific location unpack

  

                                            

  

Guess you like

Origin www.cnblogs.com/liuxinkai94/p/10922234.html