1.管道符 | & grep命令
命令1 | 命令2
cat jepson.log | grep 22
cat jepson.log | wc -l
[root@hadoop000 ruozedata]# cat jepson.log | wc -l
1
[root@hadoop000 ruozedata]# echo "www.ruozedata.com" >> jepson.log
[root@hadoop000 ruozedata]#
[root@hadoop000 ruozedata]#
[root@hadoop000 ruozedata]# cat jepson.log | wc -l
2
[root@hadoop000 ruozedata]# cat jepson.log | grep 22
[root@hadoop000 ruozedata]# cat jepson.log | grep "ruoze"
www.ruozedata.com
[root@hadoop000 ruozedata]#
[root@hadoop000 ruozedata]# echo "www.ruojepson.com" >> jepson.log
[root@hadoop000 ruozedata]#
[root@hadoop000 ruozedata]# cat jepson.log | grep "ruoze"
www.ruozedata.com
[root@hadoop000 ruozedata]# cat jepson.log | grep "ruo"
www.ruozedata.com
www.ruojepson.com
[root@hadoop000 ruozedata]#
2.passwd
passwd--》
1.登陆不上
2.家目录变更
3.-bash-4.1$ 不影响使用
4.cp /etc/skel/.* 新的家目录
权限修改
3.权限
读 r 4 cat more
写 w 2 > >> vi
执行 x 1 shell脚本
无权限 -
[root@hadoop000 ruozedata]# ll
total 12
drwxr-xr-x. 4 root root 4096 Sep 7 22:29 1
drwxr-xr-x. 2 root root 4096 Sep 7 21:32 4
-rw-r--r--. 1 root root 40 Sep 9 20:08 jepson.log
[root@hadoop000 ruozedata]#
rw- r-- r-- ==》644
第一组: rw- 6 代表root用户对这个文件或文件夹的权限
第二组: r-- 4 代表root用户组的所有成员对这个文件或文件夹的权限
第二组: r-- 4 代表其他组的所有成员对这个文件或文件夹的权限
777 rwxrwxrwx
rwxrw-rw- 766
执行:
shell脚本:
1.头部: !/bin/bash
2.赋予x
[jepson@hadoop000 ~]$ vi test.sh
#!/bin/bash
date
[jepson@hadoop000 ~]$ ll
total 4
-rw-rw-r--. 1 jepson jepson 18 Sep 9 20:48 test.sh
[jepson@hadoop000 ~]$
[jepson@hadoop000 ~]$ sh test.sh
Sun Sep 9 20:48:32 CST 2018
[jepson@hadoop000 ~]$
[jepson@hadoop000 ~]$ ./test.sh
-bash: ./test.sh: Permission denied
[jepson@hadoop000 ~]$
[jepson@hadoop000 ~]$ chmod 764 test.sh
[jepson@hadoop000 ~]$
[jepson@hadoop000 ~]$
[jepson@hadoop000 ~]$ ./test.sh
Sun Sep 9 20:49:24 CST 2018
[jepson@hadoop000 ~]$ ll
total 4
-rwxrw-r--. 1 jepson jepson 18 Sep 9 20:48 test.sh
[jepson@hadoop000 ~]$
4.网络安装(yum rpm ps -ef|grep netstat -nlp|grep kill -9)
yum search http
yum install httpd
yum -y install httpd
yum --help
[root@hadoop000 ~]# service httpd status
httpd is stopped
[root@hadoop000 ~]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.137.190 for ServerName
[ OK ]
[root@hadoop000 ~]#
[root@hadoop000 ~]# ps -ef | grep http
root 2689 1 0 20:56 ? 00:00:00 /usr/sbin/httpd
apache 2692 2689 0 20:56 ? 00:00:00 /usr/sbin/httpd
apache 2693 2689 0 20:56 ? 00:00:00 /usr/sbin/httpd
apache 2694 2689 0 20:56 ? 00:00:00 /usr/sbin/httpd
apache 2695 2689 0 20:56 ? 00:00:00 /usr/sbin/httpd
apache 2696 2689 0 20:56 ? 00:00:00 /usr/sbin/httpd
apache 2697 2689 0 20:56 ? 00:00:00 /usr/sbin/httpd
apache 2698 2689 0 20:56 ? 00:00:00 /usr/sbin/httpd
apache 2699 2689 0 20:56 ? 00:00:00 /usr/sbin/httpd
root 2712 2504 0 20:57 pts/1 00:00:00 grep http
[root@hadoop000 ~]# ps -ef | grep http | grep -v grep
第一列 用户
第二列 pid 进程id
第三列
杀一个进程: kill -9 pid
杀死匹配的所有 kill -9 $(pgrep -f http)
[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
移除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
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31558266/viewspace-2216403/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31558266/viewspace-2216403/