您的位置:首页 > 运维架构 > Shell

【备忘】Linux, Shell 常用命令,不定时更新

2014-02-19 19:26 483 查看
1. 获取当前系统时间:

$ date
Wed Feb 19 19:22:15 CST 2014

$ date +%Y%m%d
20140219

$ date +%Y-%m-%d
2014-02-19

$ date +%Y%m%d%H%M%S
20140219192653

$ date '+%Y-%m-%d %H:%M:%S'
2014-02-19 19:27:50


2. Create a new usersudo useradd -m jason

sudo passwd jason
-m auto create the main folder

-g assign a group for the user

-s define the default shell(-s /bin/bash)
3. Create a new groupsudo groupadd newgroup 
4. Delete usersudo userdel jason-r also delete the main folder of the user
5. User Managementsudo usermod-r modify the main folder

-e modify the expire date

-g modify the group

-l modify the name of the user

-s modify the defalut using shell after user login

e.g. sudo usermod -l mike -d /home/mike -e 02/20/2014 jason
6. 搜索已经安装的软件:  dpkg -l  (dpkg -l | grep <关键字搜索>)

7. 搜索对应的软件进程:ps -aux | grep <name>

8. 搜索对应的软件端口:netstat -lnpt | grep <name>

9. 强制删除某进程:       kill -s 9 <pid>

10. 设置当服务器启动后自动启动某个应用: 修改 /etc/rc.local 添加对应的程序启动命令即可

11. 查看内存占用前10名的进程:ps -aux | sort -k4nr | head -n 10
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: