当前位置:网站首页>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 :
边栏推荐
- 如果不知道這4種緩存模式,敢說懂緩存嗎?
- Debug:==42==ERROR: AddressSanitizer: heap-buffer-overflow on address
- Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 2
- What is an excellent architect in my heart?
- Batch distribution of SSH keys and batch execution of ansible
- 有老师知道 继承RichSourceFunction自定义读mysql怎么做增量吗?
- Linked list operation can never change without its roots
- How to use diff and patch to update the source code
- Huge number multiplication (C language)
- System. Currenttimemillis() and system Nanotime (), which is faster? Don't use it wrong!
猜你喜欢
Rhcsa learning practice
六月份阶段性大总结之Doris/Clickhouse/Hudi一网打尽
[200 opencv routines] 218 Multi line italic text watermark
[Galaxy Kirin V10] [server] NUMA Technology
system design
Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 2
Linked list operation can never change without its roots
uniapp 处理过去时间对比现在时间的时间差 如刚刚、几分钟前,几小时前,几个月前
183 sets of free resume templates to help everyone find a good job
Delayed message center design
随机推荐
使用 C# 提取 PDF 文件中的所有文字(支持 .NET Core)
Rhcsa - day 13
system design
leetcode729. My schedule 1
基于线性函数近似的安全强化学习 Safe RL with Linear Function Approximation 翻译 2
How to use diff and patch to update the source code
BGP advanced experiment
Ruby时间格式转换strftime毫秒匹配格式
Use the data to tell you where is the most difficult province for the college entrance examination!
Vs201 solution to failure to open source file HPP (or link library file)
Development guidance document of CMDB
今日睡眠质量记录78分
Talk about scalability
Write a program to judge whether the two arrays are equal, and then write a similar program to compare the two vectors.
[Galaxy Kirin V10] [server] soft RAID configuration
Write a program that uses pointers to set all elements of an int array to 4.18: 0.
/*The rewriter outputs the contents of the IA array. It is required that the type defined by typedef cannot be used in the outer loop*/
Button wizard business running learning - commodity quantity, price reminder, judgment Backpack
How do microservices aggregate API documents? This wave of show~
The most detailed teaching -- realize win10 multi-user remote login to intranet machine at the same time -- win10+frp+rdpwrap+ Alibaba cloud server