Shell基础01
### 臨時配置網絡(ip,網關,dns)+永久配置
#臨時配置 ifconfig enp0s3 192.168.16.250 netmask 255.255.255.0 #配置IP地址與子網掩碼 route add default gw 192.168.16.254 #設置網關 #永久配置 vim /etc/sysconfig/ifcfg-enp0s3 TYPE="Ethernet" NAME="enp0s3" BOOTPROTO="static" ONBOOT="yes" DEVICE="enp0s3" IPADDR="192.168.16.250" NETMASK="255.255.255.0" GATEWAY="192.168.16.254" #重啟網絡使配置生效 systemctl restart network### 為集群內的機器設定主機名,利用/etc/hosts文件來解析自己的集群中所有的主機名,相應的,集群的配置應該改成使用主機名的方式
#虛擬機 hostnamectl set-hostname webserver01 #設置主機名 vim /etc/hosts 192.168.16.132 hello01 #主機 hostnamectl set-hostname hello01 vim /etc/hosts #測試 ping webserver01 PING webserver01 (192.168.16.150) 56(84) bytes of data. 64 bytes from webserver01 (192.168.16.150): icmp_seq=1 ttl=64 time=0.284 ms 64 bytes from webserver01 (192.168.16.150): icmp_seq=2 ttl=64 time=0.167 ms 64 bytes from webserver01 (192.168.16.150): icmp_seq=3 ttl=64 time=0.380 ms ^C --- webserver01 ping statistics ---### ssh登錄,scp上傳、下載,ssh秘鑰登錄,修改ssh server端的端口為8888然后進行登錄和scp測試
touch hello#建立測試文件 #上傳測試文件 scp hello root@webserver01:/ root@webserver01's password: hello 100% 0 0.0KB/s 00:00 rm -rf hello #刪除本地測試文件 #下載測試文件 scp root@webserver01:/hello . root@webserver01's password: hello 100% 0 0.0KB/s 00:00 #修改22端口 vim /etc/ssh/sshd_config Port 8888 systemctl restart sshd #登陸測試 ssh root@192.168.16.150 -p 8888 root@192.168.16.150's password: Last login: Tue Mar 21 16:40:50 2017 [root@webserver01 ~]#### 整理bash命令類型,驗證尋找一個命令的優先級
命令優先級:
| 1 | 別名 |
| 2 | 組合命令(if\while...) |
| 3 | 函數 |
| 4 | 內部命令(cd\ls...) |
| 5 | hash路徑緩存 |
| 6 | path環境變量 |
| 7 | 找不到命令 |
測試優先級
### 通配符實驗
~/Pictures ls Wallpaper0* Wallpaper01.jpeg Wallpaper03.jpg Wallpaper05.jpg Wallpaper02.jpg Wallpaper04.jpg Wallpaper06.jpg~/Pictures ls Wallpaper0?.jpg Wallpaper02.jpg Wallpaper04.jpg Wallpaper06.jpg Wallpaper03.jpg Wallpaper05.jpg轉載于:https://www.cnblogs.com/anyanyaaaa/p/6595649.html
總結
- 上一篇: python的多线程threading
- 下一篇: [Java并发编程(二)] 线程池 Fi