美文网首页
Linux常用命令

Linux常用命令

作者: Tsun424 | 来源:发表于2018-10-29 05:20 被阅读0次

查看所有用户和用户组

You can display with the help of compgen builtin command as follows:

To display all users run following command:

compgen -u

To display all groups run following command:

compgen -g

常看软件版本

apt-cache policy <package name>

查看当前文件夹下的文件夹大小

-- check folder size under current directory

du -h --max-depth=1 | sort -hr

查看当前登录的用户

w

查看最近修改的文件

find . -type f -mtime -7 -exec ls -l {} \;

查看domain的dns信息

dig test.com

替换文件中的环境变量并在原文件输出

envsubst < migration/environments/development.properties | dd of=migration/environments/development.properties

端口信息

netstat -ntplu

查看systemd日志

journalctl -u vt-server

sudo不需要输入密码

root用户执行 visudo

在最底部添加

ec2-user        ALL=(ALL)       NOPASSWD: ALL

如果只允许执行某些命名不需要password

# jenkins can run restart nginx witout password
Defaults:jenkins !requiretty,!lecture
jenkins ALL=NOPASSWD: /bin/systemctl restart nginx

Nginx 检查配置

nginx -T | grep syntax

相关文章

网友评论

      本文标题:Linux常用命令

      本文链接:https://www.haomeiwen.com/subject/lyeooftx.html