文章目录
1. 如何给普通用户添加sudo权限
- 切换到root
- chmod u+w /etc/sudoers
- vi /etc/sudoers
- 找到这行 root ALL=(ALL) ALL,在下面添加:
root ALL=(ALL) ALL
your_name ALL=(ALL) NOPASSWD: ALL
它将允许用户执行sudo命令,并且在执行的时候不输入密码.
5. chmod u-w /etc/sudoers
2. 如何立刻关机
poweroff
3. 10分钟后自动关机
shutdown -h 10
如果希望终止上面执行的10分钟关机,则执行:
shutdown -c
4. 希望在22:00关闭计算机
shutdown -h 22:00
5. 查看Linux系统最近重启日志中的时间
last reboot
6. 删除当前路径下的所有空文件夹
find . -type d -empty -delete
7. 监控服务器当前的网络上传和下载速度
# 方法1:
yum install iftop
iftop
# 方法2:
yum install nload
nload
8. 每隔10小时运行nvidia-smi -l
0 */10 * * * if [ "$(pgrep -c nvidia-smi)" -eq 0 ]; then nvidia-smi -l; fi
9. 如何随系统启动时自动运行
编辑 /etc/rc.local,在文件的末尾,添加你的命令:
#!/bin/bash
nvidia-smi -l &
exit 0
10. centos7.2常见问题
报错内容:
ImportError: libssl.so.4: cannot open shared object file: No such file or directory
ImportError: libcrypto.so.4: cannot open shared object file: No such file or directory
解决办法:
ln -s /usr/lib64/libcrypto.so.10 /usr/lib64/libcrypto.so.4
ln -s /usr/lib64/libssl.so.10 /usr/lib64/libssl.so.4