1.管道符 | & grep命令
命令1 | 命令2
cat jepson.log | grep 22node
cat jepson.log | wc -llinux
[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]# shell
2.passwd
passwd--》
1.登錄不上
2.家目錄變動
3.-bash-4.1$ 不影響使用
4.cp /etc/skel/.* 新的家目錄
權限修改apache
3.權限
讀 r 4 cat more
寫 w 2 > >> vi
執行 x 1 shell腳本
無權限 -centos
[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]# bash
rw- r-- r-- ==》644
第一組: rw- 6 表明root用戶對這個文件或文件夾的權限
第二組: r-- 4 表明root用戶組的全部成員對這個文件或文件夾的權限
第二組: r-- 4 表明其餘組的全部成員對這個文件或文件夾的權限網絡
777 rwxrwxrwx
rwxrw-rw- 766dom
執行:
shell腳本:
1.頭部: !/bin/bash
2.賦予x
[jepson@hadoop000 ~]$ vi test.sh
#!/bin/bashssh
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 ~]$ tcp
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
做業: 1.linux對照作一次 博客寫1次