This article is very simple, which is to record some points needing attention in the use of linux
ssh protocol is used for access between different hosts and adopts asymmetric encryption. The key is generally in ~ / ssh ， where id_rsa.pub = public key, id_rsa ， indicates the private key. If it does not exist, it can be generated through the ， ssh keygen ， command.
If the user who logs in to the ssh directory for the first time does not have the fingerprint of the local protocol, the user who logs in to the ssh directory will need to confirm the key of the first time_ Save the fingerprint of the logged in party in hosts.
There are two kinds of ssh login credentials: one is to use the key to verify each time, and the other is to save the public key of the login party in the authorized directory under the key of the registered party_ Keys} file.
Use SSH copy ID user @host You can upload the key directly.
When we use git, we can also save the local key in the GIT server, so we can use ssh protocol to push and other operations.
File properties are as follows
Methods of modifying attributes include
- chgrp change the group to which the file belongs
[root@www ~]# chgrp [-R] dirname/filename ... Options and parameters: - R : Recursion(recursive)Continuous change, that is, together with all files and directories in the secondary directory Are updated to become the meaning of this group. It is often used to change all the files in a directory. example: [root@www ~]# chgrp users install.log [root@www ~]# ls -l -rw-r--r-- 1 root users 68495 Jun 25 08:53 install.log [root@www ~]# chgrp testing install.log chgrp: invalid group name `testing' <== An error message has occurred～This group name cannot be found～ Copy code
- chown: change file owner
[root@www ~]# chown [-R] Account name file or directory [root@www ~]# chown [-R] Account name :Group name file or directory Options and parameters: - R : Recursion(recursive)Continuous change of, that is, all files in the secondary directory are changed Example: will install.logThe owner of is changed to bin This account: [root@www ~]# chown bin install.log [root@www ~]# ls -l -rw-r--r-- 1 bin users 68495 Jun 25 08:53 install.log Example: will install.logThe owner and group of are changed back to root: [root@www ~]# chown root:root install.log [root@www ~]# ls -l -rw-r--r-- 1 root root 68495 Jun 25 08:53 install.log Copy code
- chmod: change the permission of the file, where 4 represents r. for the file, it means that the content can be read; for the directory, it means that the directory structure list 2 represents w; for the file, it means that it can be edited but not deleted; for the directory, it means that it can be added, deleted and modified; for the file under the directory, 1 represents x; for the file, it means that it can be executed; for the directory, it means that it can be accessed
[root@www ~]# chmod [-R] xyz File or directory Options and parameters: xyz : It is the permission attribute of the digital type just mentioned. It is rwx Addition of attribute values -R : Recursion(recursive)Continuous change of, that is, all files in the secondary directory will be changed Copy code
See here for details
linux is a multi-user and multi task system, which can be used by multiple users at the same time. Therefore, many users can log in with ssh for related operations at the same time.
In order to better distinguish users, linux divides users into super users, system users and ordinary users. In order to facilitate management, users can also join different user groups. Each user has a uid that identifies the user and a gid that identifies the group.
The super user only has root, uid is 0, and has the highest permission of the system. The system user is used by the system running some services and cannot be used to log in. The uid is 1 ~ 499. Other users are ordinary users and the uid is 500 ~ 65535.
An ordinary user has limited permissions. If you need root permission, you can use # sudo other commands. The premise is that the super user is configured in / etc/sudoers # and of course you can also use # su # to switch to root
yum (Yellow dog Updater, Modified) is a package management tool similar to npm. For complete commands, please refer to here. Here are some common commands.
- yum install <package_ Name > installation
- yum remove <package_ Name > delete
- Create cache using yum makecache
- Clear cache using yum clean all
It is an ide. For common usage, please refer to here
We usually use commands to interact with linux. Here are some common ones. For details, please refer to man7 or rookie tutorial
Before introducing specific commands, introduce several special symbols
- |Pipe character, which can output the result of the command to another command for input
- ； Semicolon to execute multiple commands on one line
- &Background execution
- cat concatenat outputs the target file to the default command line
- ps process status, for example
ps -ef | grep Process keyword //View specific processes Copy code
- wget Download