1.解壓
tar -zxvf /home/images.tar.gz -C /specific dir //解壓到指定目錄
tar –xvf file.tar //解壓 tar包
tar -xjvf file.tar.bz2 //解壓 tar.bz2
tar –xZvf file.tar.Z //解壓tar.Z
2.yum安裝
安裝lrzsz
yum -y install lrzsz
3.遠程拷貝
scp [參數] [原路徑] [目標路徑]
scp local_file remote_username@remote_ip:remote_file
4.安裝 example.rpm 包並在安裝過程中顯示正在安裝的文件信息及安裝進度
rpm -ivh example.rpm
5.需要卸載的安裝包
rpm -e
6.RPM 查詢操作
rpm -q
附加查詢命令:
a 查詢所有已經安裝的包以下兩個附加命令用於查詢安裝包的信息;
eg: rpm -qa | grep tomcat8 查看tomcat8是否被安裝;
MySQL相關
1.登錄
mysql -u root -p
2.遠程授權登錄
給特定IP授權
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.100' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
給任意IP授權
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
3.顯示編碼
show variables like '%character%';
4.修改字符集爲utf8(修改/etc/my.cnf)
[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'
5.重啓MySQL服務
systemctl restart mysqld
6.修改密碼
ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpassword';
或
set password for 'root'@'localhost'=password('yourpassword');
防火牆相關(centos7)
1.啓動
systemctl start firewalld
2.停止
systemctl stop firewalld
3.禁用
systemctl disable firewalld
4.打開端口
打開3306端口
firewall-cmd --add-port=3306/tcp --permanent
5.顯示狀態
firewall-cmd --state
6.更新防火牆規則
firewall-cmd --reload
或者
firewall-cmd --complete-reload
docker相關
1.創建網絡
創建網絡docker_gwbridge
docker network create --subnet 172.21.0.0/16 \
--gateway 172.21.0.1 \
--opt com.docker.network.bridge.name=docker_gwbridge \
--opt com.docker.network.bridge.enable_icc=false \
docker_gwbridge
或
創建網絡 yournetname
docker network create yournetname --subnet 172.21.0.0/16 \
--gateway 172.21.0.1
2.重啓docker
systemctl daemon-reload
systemctl restart docker.service