当前位置:网站首页>File viewing commands and user management commands
File viewing commands and user management commands
2022-04-23 06:37:00 【*Flowers bloom on the street】
File view command
cat
1. Used to view file data
cat a.txt
2. Merge files
cat a.txt b.txt > c.txt
3. Write data to file
cat > d.txt
There is one thing to pay attention to when writing data in this way :cat > d.txt When entering data , Will be will be d.txt Empty data in .
cat >> d.txt
Enter data at the end of the file ,ctrl+d End input
“>>” Move the cursor to the end of the file , Then write data ( The original data will not be lost )
more
When the contents of the file are not displayed on the screen , You can use more command , Split screen content .
more filename
You can use spaces ( There are many contents in one jump ) Or return ( Look down a little ) Look down at the contents of the file , I don't want to check , Can pass q immediate withdrawal .
You can view the system through the red hat key .
less
less And more be similar , There is only one difference .
less And more The difference between :
less The displayed file content will not be left in the terminal interface
less The contents of the displayed file , There is no percentage in the lower left corner
less The contents of the displayed file You can use the arrow keys to view (more You can only go down )
head
Before displaying the file n That's ok , Default 10 That's ok
head -n filename
tail
After displaying the file n That's ok , Default 10 That's ok
tail -n filename
Used to view log files
tail This command is often used to view log files , Because log files generally only view recently generated log data , That is, look at the end of the log file
tail -f filename(-f follow Real time tracking display End of file information , Dynamic tracking )
QQ Recording screen 20220413210243
User management command
Storage of basic user information
user name , User password , group information , user ID, Description of the user , The address of the terminal
Storage location /etc/passwd
user name | password | UID | GID | Description information | Home directory | command interpreter |
root | x( It means there's a code ) | user ID | Group ID | A brief description of the user | It's usually a home directory | Default command interpretation |
For the sake of safety , After all user passwords are encrypted separately , Save in a file (/etc/shadow), This file can only root see
user name $ encryption algorithm ID$ secret key $ Ciphertext
Add new user
useradd user_name( A new user name )
When creating users , Generally speaking, a home directory with the same name will be created , Put it in /home Under
Red hat will create a home directory with the same name when creating a new user
uburtu Home day records will not be automatically added , We need to manually add , Or want to add home directory automatically , New users can be added through the graphical interface
Change Password
adopt passwd This command changes the password :
passwd user_name( Change user password )
You can switch between super users , Forcibly modify various passwords sudo passwd user_name
Delete user
userdel Delete user
Be careful :
1. The deleted user is not logged in
2.userdel After deleting users , The deleted user's home directory still exists
3.userdel -r user_name Deleting a user will also delete the home directory
版权声明
本文为[*Flowers bloom on the street]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230547206858.html
边栏推荐
猜你喜欢
随机推荐
【UDS统一诊断服务】四、诊断典型服务(1)— 诊断和通信管理功能单元
Rust:单元测试(cargo test )的时候显示 println 的输出信息
类的继承与派生
利用文件保存数据(c语言)
对象数组与对象指针
gcc ,g++,gdb的安装
Conversion between JS object and string
函数的调用过程
1007 go running (hdu6808) in the fourth game of 2020 Hangzhou Electric Multi school competition
爬取手游网站游戏详情和评论(MQ+多线程)
selenium+PhantomJS破解滑动验证2
C语言的运算符
Log4j2跨线程打印traceId
Tabbar implementation of dynamic bottom navigation bar in uniapp, authority management
Vscode custom comments
拷贝构造函数
爬取小米有品app商品数据
类和对象的初始化(构造函数与析构函数)
【学习一下】HF-Net 训练
C语言实现2048小游戏方向合并逻辑