1.管道符 | & grep
命令1 | 命令2
cat ws.log | grep(过滤) 22
cat ws.log | wc -l 快速看出有多少行
2.passwd
1、登录不上
2、家目录变更
3、-bash-4.1$ 不影响使用
4、cp /etc/skel/.* 新的家目录
权限修改
3.权限
读 r 4 cat more
写 w 2 > >> vi
执行 x 1 shell脚本
无权限 -
[root@hadoop001 ~]# ll
total 16
-rw-r–r– 1 root root 9 Sep 12 14:04 gaojun.log
-rw-r–r– 1 root root 1 Sep 7 23:14 test.log
-rw-r–r– 1 root root 4 Sep 11 09:12 ws.log
drwxr-xr-x 6 root root 4096 Sep 12 14:08 yy
-rw- r– r– ==》644
第一组:rw- 6 代表root用户对这个文件或文件夹的权限
第二组:r– 4 代表root用户组的所有成员对这个文件或文件夹的权限
第三组:r– 4 代表其他组的所有成员对这个文件或文件夹的权限
777 rwxrwxrwx
rwxrw-rw- 766
执行:
shell脚本:
1、头部:#!/bin/bash
2、赋予x权限
4.网络安装(yum rpm ps -ef |grep netstat -nlp |grep kill -9)
yum search http
yum install httpd
yum -y install httpd
yum –help
[root@hadoop001 ~]# ps -ef | grep http
root 17989 1 0 19:50 ? 00:00:00 /usr/sbin/httpd
apache 17991 17989 0 19:50 ? 00:00:00 /usr/sbin/httpd
apache 17992 17989 0 19:50 ? 00:00:00 /usr/sbin/httpd
apache 17993 17989 0 19:50 ? 00:00:00 /usr/sbin/httpd
apache 17994 17989 0 19:50 ? 00:00:00 /usr/sbin/httpd
apache 17995 17989 0 19:50 ? 00:00:00 /usr/sbin/httpd
apache 17996 17989 0 19:50 ? 00:00:00 /usr/sbin/httpd
apache 17997 17989 0 19:50 ? 00:00:00 /usr/sbin/httpd
apache 17998 17989 0 19:50 ? 00:00:00 /usr/sbin/httpd
root 18016 17817 0 19:54 pts/2 00:00:00 grep http
[root@hadoop001 ~]#
[root@hadoop001 ~]# ps -ef | grep http | grep -v grep
第一列 用户
第二列 pid 进程id
第三列
杀一个进程 : kill -9 pid
杀死匹配的所有 : kill -9 $(pgrep -f http )
杀死之前 ps -ef 查看确认一下 不要误杀
[root@hadoop000 ~]# netstat -nlp|grep 1380
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1380/sshd
tcp 0 0 :::22 :::* LISTEN 1380/sshd
[root@hadoop000 ~]#
[root@hadoop000 ~]# netstat -nlp|grep 2917
tcp 0 0 :::80 :::* LISTEN 2917/httpd
unix 2 [ ACC ] STREAM LISTENING 12917 1460/master private/scache
[root@hadoop000 ~]#
第四列:
0.0.0.0:22
:::22
127.0.0.1:22
192.168.137.190:22
0.0.0.0指的是本机上的所有IPV4地址
进程pid–>port(端口号)
例如:[root@hadoop001 ~]# ps -ef | grep http | grep -v grep(查看进程pid)
[root@hadoop001 ~]# netstat -nlp |grep 17989 (查看端口号)
移除rpm包 xxx.rpm
[root@hadoop000 ~]# rpm -qa | grep http
httpd-tools-2.2.15-69.el6.centos.x86_64
httpd-2.2.15-69.el6.centos.x86_64
[root@hadoop000 ~]# rpm -e(卸载) httpd-2.2.15-69.el6.centos.x86_64
error: Failed dependencies:
httpd >= 2.2.0 is needed by (installed) gnome-user-share-2.28.2-3.el6.x86_64
[root@hadoop000 ~]# rpm –help
[root@hadoop000 ~]# rpm -e –nodeps httpd-2.2.15-69.el6.centos.x86_64
[root@hadoop000 ~]# rpm -qa(查询) | grep http
httpd-tools-2.2.15-69.el6.centos.x86_64
[root@hadoop000 ~]#
[root@hadoop000 ~]# yum remove httpd-tools-2.2.15-69.el6.centos.x86_64
5.切换用户
su jepson
su - jepson
6.临时获取root权限
sudo xxx命令
vi /etc/sudoers
jepson ALL=(root) NOPASSWD:ALL
sudo su - jepson (LDAP权限管理系统)
有密码示例
无密码示例
7.权限
chmod 777 文件
chmod -R 777 文件夹
chown jepson:jepson 文件
chown -R jepson:jepson 文件夹
chmod +x xxx.sh
chmod u+x xxx.sh
chmod g+x xxx.sh
chmod o+x xxx.sh