[Linux]常用命令
来源:互联网 发布:导出来的sql带双引号 编辑:程序博客网 时间:2024/04/27 06:40
1、查找进程
命令:ps -ef |grep <查找内容>
如:ETL-FW:[/ytxt/jboss/server/default/deploy]$ps -ef |grep java
jyfx 6119 55252 0 11:33 pts/0 00:00:00 grep java
jyfx 15300 1 0 Aug07 ? 00:00:00 /bin/sh ./run.sh
2、关闭进程
命令:kill -9 <进程号>
如:kill -9 15300
3、修改文件或目录的所属用户
基本语法:
chown [-R] 账号名称 文件或目录
chown [-R] 账号名称:用户组名称 文件或目录
参数:
-R : 进行递归( recursive )的持续更改,即连同子目录下的所有文件、目录
都更新成为这个用户组。常常用在更改某一目录的情况。
示例1:
[root@localhost home]# touch testfile //由 root 用户创建文件
[root@localhost home]# ls testfile –l
-rw--w--w- 1 root root 0 Jun 7 19:35 testfile //文件的拥有者及拥有者级均为 root
[root@localhost home]# chown yangzongde testfile //修改文件拥有者为 yangzongde
[root@localhost home]# ls testfile -l
-rw--w--w- 1 yangzongde root 0 Jun 7 19:35 testfile //查看文件拥有者为 yangzongde,但组仍为 root
4、修改文件或者目录的用户组
基本语法:
chgrp [-R] 用户组名称 dirname/filename ...
参数:
-R : 进行递归( recursive )的持续更改,即连同子目录下的所有文件、目录
都更新成为这个用户组。常常用在更改某一目录的情况。
示例3
[root@localhost home]# ls testfile -l
-rw--w--w- 1 yangzongde root 0 Jun 7 19:35 testfile //查看文件拥有者为 yangzongde,但组为 root
[root@localhost home]# chgrp yangzongde testfile //修改拥有者组为 yangzongde
[root@localhost home]# ls testfile -l
-rw--w--w- 1 yangzongde yangzongde 0 Jun 7 19:35 testfile
[root@localhost home]# chown root:root testfile // 使用 chown 一次性修改拥有者及组
[root@localhost home]# ls testfile -l
-rw--w--w- 1 root root 0 Jun 7 19:35 testfile
示例4
[root@linux ~]# chgrp users install.log
[root@linux ~]# ls -l
-rw-r--r-- 1 root users 68495 Jun 25 08:53 install.log
示例5
更改为一个 /etc/group里不存在的用户组
[root@linux ~]# chgrp testing install.log
chgrp: invalid group name `testing' <== 出现错误信息~找不到这个用户组名~
0 0
- 【linux 常用命令】常用命令整理
- linux常用命令
- Linux常用命令
- LINUX 常用命令
- linux常用命令
- Linux 常用命令
- Linux 常用命令
- Linux常用命令
- LINUX常用命令
- Linux 常用命令
- linux常用命令
- Linux常用命令
- Linux常用命令
- Linux 常用命令
- Linux常用命令
- Linux 常用命令
- Linux 常用命令!
- Linux 常用命令
- 网络故障排查
- hdu 4930 Fighting the Landlords 多校第六场 斗地主纯模拟
- 【算法导论学习-008】算法时间复杂度的计算
- LinearLayout中layout_gravity控制控件位置
- dump_stack 和 trigger_all_cpu_backtrace
- [Linux]常用命令
- c++ Constructor FAQ 续
- 从HTML代码中提取文字,去掉HTML的标记
- 负载均衡(LB)详解
- 最大流-Edmonds-Karp算法
- 必须使用“控制面板”中的“打开或关闭Windows 功能”安装或配置microsoft.NET framework 2.0 SP2
- ul li
- 信息系统开发与管理(一)
- Redis配置详解