当前位置:网站首页>VI text editor and user rights management, group management and time management
VI text editor and user rights management, group management and time management
2022-07-04 10:35:00 【Zhuge Bo】
vi Text editor
1. install :yum -y install vim*
2. vi/vim Three modes of and the conversion between each mode
3. Edit commands and shortcuts
Insert command :( General mode goes into insert mode ):
i Insert... In front of the cursor
I Insert... At the current line of the cursor
a Insert... After the cursor
A Insert... At the end of the current line of the cursor
o Insert a new line next to the current line of the cursor
O Insert a new line on the previous line of the cursor's current line
Locate the command ( Write in bottom line mode ):
:set nu According to the line Numbers
:set nonu Cancel the line Numbers
:n To... Of the text n That's ok
gg Go to the first line of the text G To the last line of the text
Replace and cancel commands ( In general mode ):
u undo, Cancel the previous operation ctrl + r redo, Back to undo Before
r Replace character at cursor
R Replace from where the cursor is , Press Esc Key end
The delete command :
x Deletes the character where the cursor is
nx Delete... After the cursor n Characters
dd Deletes the line where the cursor is located .
ndd Delete n That's ok
dG Delete all contents from the cursor line to the end line
D Delete the content from the cursor to the end of the line
:5,7d Deletes the row of the specified range
Common shortcut key :
Shift+ zz Save and exit , And “:wq” The same effect
v Enter character visual mode
V or Shift + v Enter line view mode
Ctrl + v Enter block view mode
ctrl+b: Screen moves back one page
ctrl+f: Move the screen forward one page
Press "$" Symbol moves the cursor to the end of the line
Press "^" Move the cursor to the beginning of the line
yy: Copy cursor line to buffer .
nyy: for example ,「6yy」 Indicates that the copy is from the line where the cursor is located " Count down "6 Line text .
Linuxroot password :aaaqy142
4. User authority management , Group management and time management
1. A file that holds user information :/etc/passwd
2. A file that stores user password information :/etc/shadow
3. The user classification :
The super user :(root,UID=0)
Ordinary users :(UID stay 1000 To 60000)
Dummy user :( UID stay 1 To 999)
4. Add user command useradd
-u Designated user ID(uid)
-g Specify the group name to which you belong (gid) The main group
-G Specify multiple groups , Comma “,” Separate (Groups) Other groups
-c User description (comment) ;
-e Failure time (expire date)
establish :
useradd -u 1888 -g users -G sys,root -c " Description information "uqy142a
(centos 7 Previous version , Pseudo user from 1-999 centos7 Then the pseudo user uses 1-999 Ordinary users of the current version ID Should be 1000 To 60000)
Set the password : passwd uqy142a// Set the password twice
Switching users su su -l uqy142a
5. Modify user command :usermod(user modify)
l Change user name (login)usermod -l a b(b Change it to a)
usermod -l uqy142cc uqy142c
-g add group usermod -g sys tom
usermod -g root uqy142a
-G Add multiple groups usermod -G sys,root tom
usermod -G sys,users uqy142a
–L Lock user account password (Lock) usermod -L uqy142b // lock b user , Even if ordinary users are locked ,root You can still log in
–U Unlock user account (Unlock)
su -l root // Switch to root Unlock
usermod -U uqy142b su -l uqy142a
su -l uqy142b // The password is found to be correct , Switch users
6. Delete user command :userdel
userdel uqy142d // Just delete user information
userdel -r uqy142e When deleting an account, delete the directory (remove
5. Group management
Save user group files :/etc/group
add group :groupadd:
groupadd -g 16666 groupa -g Appoint gid
tail /etc/group // After displaying the file 10 That's ok
Modify the set of :groupmod
groupmod -n groupaa groupa // hold groupa Change the name of groupaa
groups Display the user's group
groups uqy142a
Other group related commands :
chgrp Change the group to which the directory or file belongs ( Reorganize only )
ll |grep aaa // see aaa Subordinate to the group
chgrp groupb aaa change aaa Original group root Change it to groupb
chown Change directories or files Users and groups
ll |grep aaa // see aaa Users and groups
chown uqy142a:groupc aaa // change aaa The user and group of the directory
chown -R uqy142a:groupc aaa // The catalogue of descendants has changed
6.Sudo command
It is generally used in the non-medical field root Under the user , Temporary promotion is not root User's rights .
First step : Must be in /etc/sudoers Non root user
The second step : Carry out orders sudo reboot, Input user1 Password , Restart successful .
su -l uqy142a
sudo shutdown -h now // Tips uqy142a be not in sudoers In file Have no authority to execute
su -l root
vim /etc/sudoers
:100
Copy 100 Change user name
su -l uqy142a
sudo reboot // It's restarted
Any other ordinary user cannot execute commands , You can do that ....
7. time management
Synchronization time
yum -y install ntp ntpdate install ntp ntpdate service
ntpdate cn.pool.ntp.org Manual sync :
边栏推荐
- Reprint: summation formula of proportional series and its derivation process
- 基于线性函数近似的安全强化学习 Safe RL with Linear Function Approximation 翻译 2
- [untitled]
- Pod management
- Introduction to tree and binary tree
- Static comprehensive experiment ---hcip1
- Development guidance document of CMDB
- How to quickly parse XML documents through C (in fact, other languages also have corresponding interfaces or libraries to call)
- Es entry series - 6 document relevance and sorting
- Communication layer of csframework
猜你喜欢
六月份阶段性大总结之Doris/Clickhouse/Hudi一网打尽
Number of relationship models
From programmers to large-scale distributed architects, where are you (2)
Sword finger offer 05 (implemented in C language)
How do microservices aggregate API documents? This wave of show~
【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法
C language - stack
Doris / Clickhouse / Hudi, a phased summary in June
[FAQ] summary of common causes and solutions of Huawei account service error 907135701
PHP code audit 3 - system reload vulnerability
随机推荐
Write a program to judge whether the elements contained in a vector < int> container are 9.20: exactly the same as those in a list < int> container.
DCL statement of MySQL Foundation
AUTOSAR from getting started to mastering 100 lectures (106) - SOA in domain controllers
基于线性函数近似的安全强化学习 Safe RL with Linear Function Approximation 翻译 1
The most detailed teaching -- realize win10 multi-user remote login to intranet machine at the same time -- win10+frp+rdpwrap+ Alibaba cloud server
leetcode842. Split the array into Fibonacci sequences
PHP code audit 3 - system reload vulnerability
uniapp---初步使用websocket(长链接实现)
/*Write a loop to output the elements of the list container in reverse order*/
How to quickly parse XML documents through C (in fact, other languages also have corresponding interfaces or libraries to call)
uniapp 处理过去时间对比现在时间的时间差 如刚刚、几分钟前,几小时前,几个月前
Learning XML DOM -- a typical model for parsing XML documents
六月份阶段性大总结之Doris/Clickhouse/Hudi一网打尽
What is devsecops? Definitions, processes, frameworks and best practices for 2022
[Galaxy Kirin V10] [desktop] login system flash back
Sword finger offer 31 Stack push in and pop-up sequence
Write a program that uses pointers to set all elements of an int array to 4.18: 0.
/*Rewrite the program, find the value of the element, and return the iterator 9.13: pointing to the found element. Make sure that the program works correctly when the element you are looking for does
Basic principle of servlet and application of common API methods
If the uniapp is less than 1000, it will be displayed according to the original number. If the number exceeds 1000, it will be converted into 10w+ 1.3k+ display