当前位置:网站首页>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 :
边栏推荐
- Container cloud notes
- Use the data to tell you where is the most difficult province for the college entrance examination!
- 对于程序员来说,伤害力度最大的话。。。
- Velodyne configuration command
- Press the button wizard to learn how to fight monsters - identify the map, run the map, enter the gang and identify NPC
- [FAQ] summary of common causes and solutions of Huawei account service error 907135701
- [Galaxy Kirin V10] [server] failed to start the network
- 【OpenCV 例程200篇】218. 多行倾斜文字水印
- uniapp 处理过去时间对比现在时间的时间差 如刚刚、几分钟前,几小时前,几个月前
- 今日睡眠质量记录78分
猜你喜欢
From programmers to large-scale distributed architects, where are you (2)
Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 1
Three schemes of ZK double machine room
What is an excellent architect in my heart?
Network connection (II) three handshakes, four waves, socket essence, packaging of network packets, TCP header, IP header, ACK confirmation, sliding window, results of network packets, working mode of
基于线性函数近似的安全强化学习 Safe RL with Linear Function Approximation 翻译 1
Delayed message center design
Idea SSH channel configuration
Rhsca day 11 operation
Recursion and divide and conquer strategy
随机推荐
[Galaxy Kirin V10] [desktop] printer
[Galaxy Kirin V10] [desktop] login system flash back
Snake (C language)
From programmers to large-scale distributed architects, where are you (2)
Introduction to tree and binary tree
[Galaxy Kirin V10] [server] system startup failed
/*Write a loop to output the elements of the list container in reverse order*/
Doris / Clickhouse / Hudi, a phased summary in June
Rhcsa12
RHCE - day one
Write a program that uses pointers to set all elements of an int array to 4.18: 0.
20 minutes to learn what XML is_ XML learning notes_ What is an XML file_ Basic grammatical rules_ How to parse
Rhcsa - day 13
Button wizard business running learning - commodity quantity, price reminder, judgment Backpack
Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 2
C language - stack
基于线性函数近似的安全强化学习 Safe RL with Linear Function Approximation 翻译 1
Idea SSH channel configuration
【Day2】 convolutional-neural-networks
AUTOSAR from getting started to mastering 100 lectures (106) - SOA in domain controllers