LInux third week of knowledge summary

vim and pipes

1.vim

1) various modes
2) shortcuts.
3) does not support the extended regular expression
command mode how to copy specified to be inserted between the two lines?

2. The standard input, output, error

exec command action
fd: file descriptor
passwd modify passwords neither be deployed to standard input standard output, and error

3. <|> Redirect

/ dev / pts / #: indicates the file each terminal
error and redirected to a file ll three methods
(1) &> Folder:
(2) 1> File 2> & 1: sequence fail, down first error will be output to the screen without an error will be required to access file

(3) 2> File 1> & 2

1)> repeatedly directed a file will cause the file to be covered.

2)> / dev / null redirect corresponds to the trash

3)> + large files, you can free up memory indirect

4) <file> file empty the ask price

5) <file >> unlimited write to a file

6) The default is to allow global coverage

 set -C 不允许覆盖 : >| 文件 可以强制覆盖。  
 set + C 允许覆盖 

4. >> Additional

\ >> added more than a touch safety reasons: >> When an existing file, nothing changed. The touch will change the file three times (command; command) command can content () to do with the treatment, instead; separates the two commands.

5. << sent to the multi-line STDIN

1) Default cat> file: you will have created a file line by line to line input, line input and the first carriage return.

2) cat> file << EOF: terminator ended when the input file was generated,

3) When writing the script called in order to allow alignment cat> file << - EOF before terminator plus - can automatically align

4) echo \ "a >> top model will enter multi-line input

6.tr

1) common options -c -d -s -t

2) When tr "abc" "When the matching to 12" c c do not correspond to the corresponding rear -t brought immediately canceled 2

When converted to 3) tr converter not consistent with the front rear wildcards letters.

 注意:windows 文件与 linux文本文件的区别 :Oa 在acII码中是 换行 在win 中 od  oa  是换行: 将windows文本文件装化成linux文将方法:  

 1.以二进制的方式将od 删除
 2.vim 
 3.dos2nux 软件

7.mail

mail -s 'hello' wang content
default settings in the mail delivery system, a user can

8. |

1) Standard Output | Standard Input Output | Output

Performance Test this command - tar -xvf | - tar -cvf / home: - 2) Usage

3) tee usage command | tee file (| command) output to the screen (as input to another command)

9.seq

-s separator disposed default delimiter is newline

echo {1..10..2} outputted from 2 to 1 to 10 as a difference.
seq 50 -3 30

Users and Groups

1.user

Principle 1) users get file permissions: Token

2) uid unique user identification, root uid = 0

3) account does not have a problem but the home directory can log

4) UID allocation

2.group

1) may be compared to the same user and group names linux with windos

2) a user can have only one primary group, there may be a plurality of additional groups (private group) the user's permission additional set = + + main group other personal +

3) a group will be deleted when no members. (Referring to this or that group is not a member of the administrator is not?)

4 groups) did not create a general password that only created a group password can be added, root user by modifying the group file and gshadow files can also be.
Group administrators can do?

3./etc/passwd

1) Format: username + X + UID + primary group ID + GECOS (described account number) the SHELL + + home directory type.

2) to store the password before you can modify the position of the X position of the password stored by the command: pwunconv, recovery: pwconv.

3) description of the account-related commands: chfn add detailed information describing the user's finger for the user

4./etc/shadow

1) format: user name + password + user password was last changed time (from 1970 the number of days) + + minimum password to change the password of the maximum validity period of a few days notice before it expires + password + + a few days after the expiration of overdue accounts can Validity

2) the user password: $ 6 is represented by the first two encrypted way sha512 $ 1 is MD5 encryption, encrypted by base64 treatment (the same passwords for different ways to get the same plaintext encrypted, the encrypted password is different will add salt has been obtained plaintext)

3) When the shadow password position is there! The account number is locked, (centos is not allowed without the password to unlock the account after 6) usermod -L unlock the lock usermod -u

4) last password change time is set to 0, it must change password at next logon

The shortest change of position 5) Password 0: You can always change your password

Maximum validity bit 6) password to 99999: Password permanent

4./etc/group

1)格式:  群组名称+群组密码+群组ID+当前组的用户列表  

2)  当前组的用户列表:必须与gshadow 文件的中的组成员列表相同,否则一些程序无法使用。  

5./etc/gshadow

1)格式:用户名+密码+组管理员+组成员
2)组成员一定要与group组成员相同。

6. The operation of the user set of files

vipw = vi /etc/passwd

Vigra = vi / etc / group

vipw -s =vi /etc/shadow

vigr -s = vi / etc / gshadow

(Vi open the file modification)

pwck passwd and shadow files may be detected member

Grpck format error checking / etc / group etc / gshadow files

7. User command

. 1) the useradd (-u -o -g -G -N -R & lt -C -d -s -m -M)
2) displays the useradd -D create user default
useradd -D - (sbg) Change
3) getent + group / gshadow / passwd / gpasswd [name of user or group]
. 4) the chfn + changing user description information.
chsh specified shell
finger viewing user details not installed by default.
5) usermod modify user information (-u -g -G -s -C -l -L -d -f -e -U)
the usermod -G + + username group name: covering to the original user belongs
-aG it is to add
a method to delete all the sub-groups of users usermod -G "" user
6) delete user userdel + user (-r delete the user's home directory: the default is not to delete the user's home directory will cause the same name can not be created when a new user)
7) chpasswd can add bulk to the user password
8) view user information id (-u -g -G -n) + user
9) su switch user su - user to switch entirely different:? and a user command to switch -c +
10) the passwd (-u -l -e -d -f -w -I -n the -X---stdin) username
-u Centos after 6 not unlock the user has no password
11) chage ( -d -E -I -m -M -W -l) . . Users modify user policies
12 is) The pwconv
13 is) changed the authconfig --passalgo = SHA256 encryption --update

8. The set of commands

1) groupadd (-g -r) group_name { systems account. 6 CentOS: ID <500; CentOS. 7 <1000
2) the gpasswd (-A -a -d)
. 3) the newgrp: temporary switchover to the ordinary user group (creates son of shall)
4) groupmod (-n -g) name
5) groupdel + name: If the group deletion of the user's primary group name can not be deleted.
6) groupmems (-g -a -d -p -l) -g what it means: This command does not take back the group name objects can only be specified in accordance with -g operation
7) groups view the list of groups the user belongs

9. The new user's documents

1) / etc / defalut / useradd
Group = 100 What does this mean? : When creating a user group settings are not created with the same name, the user's primary group is set to 100.
After INACTIVE = -1 how long can the user password expires, which is third from the bottom passwd file option (-1 means never locked)
EXPIRE Account the validity empty to never expire
2) / etc / skel into account the new template file folder.
Yes = spool
. 3) /etc/login.defs
set the parameters of the defined shadow gshadow

Guess you like

Origin blog.51cto.com/13678588/2426446