- 创建新用户
[root@localhost~]# adduser name
[root@localhost~]# passwd name
切换用户 su - root 会切换用户变量
[liubo@liubo root]$ su - root
Password:
There were 3 failed login attempts since the last successful login.
Changing password for user name.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost~]# userdel username 删除用户username
[root@localhost~]# rm -rf username 删除用户username所在目录
- 添加用户组
[root@localhost~]# groupadd devgroup
[root@localhost~]# gpasswd -a userdevgroup 添加用户到组
[root@localhost~]# groupdel groupname 删除用户组
- Linux 删除文件夹和文件的命令
[root@localhosthome]# rm -rf test/
[root@localhosthome]# ll
删除文件使用实例:
rm -f /var/log/httpd/access.log
将会强制删除/var/log/httpd/access.log这个文件
删除文件夹实例:
rm -rf /var/log/httpd/access
将会删除/var/log/httpd/access目录以及其下所有文件、文件夹
- 查看杀死进程
ps -ef|grep 进程名
kill -9 进程号
- 查看日志
tail -100f test.log 实时监控100行日志
tail -n 10 test.log 查询日志尾部最后10行的日志
tail -n +10 test.log 查询10行之后的所有日志
cat -n test.log |grep "debug" 得到关键日志的行号
sed -n '/2014-12-17 16:17:20/,/2014-12-17 16:17:36/p' test.log
cat -n test.log |grep "debug" >debug.txt
6 上传文件/文件夹
上传文件
scp /Users/iubo/Desktop/timg.jpeg root@192.168.18.105:/home/img
上传文件夹
scp -r /Users/iubo/Desktop/dis root@192.168.18.105:/home/img