然后, 使用source .bashrc使配置生效

下载 bashrc.tar.gz

# User specific aliases and functions

alias bye='logout'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias la='ls -a'
alias ll='ls -l'
alias lla='ls -l -a'

# docker commands

# start docker(启动docker)
alias docker-start='systemctl start docker; systemctl status docker;'

# restart docker(重启docker)
alias docker-restart='systemctl restart docker; systemctl status docker;'

# stop docker(关闭docker)
alias docker-stop='systemctl stop docker; systemctl status docker;'

# make configuration file of the service managed by systemctl take effect (使受systemctl管理的服务的配置文件生效)
alias service-reload='systemctl daemon-reload; systemctl restart docker; systemctl status docker;'

# view docker status(查看docker状态)
alias docker-status='systemctl status docker;'

# view docker containers status(查看docker容器信息)
alias docker-view-containers='docker ps -a'

# view infomation of specific docker container(查看指定docker容器的配置情况)
alias docker-view-container='docker inspect $1'

# enter docker container which is centos system based(进入docker容器(基于centos系统))
alias docker-enter-container='func() { docker exec -it $1 /bin/bash;}; func'

# enter docker container which is alpine system based(进入docker容器(基于alpine系统))
alias docker-enter-alpine='func() { docker exec -it $1 sh;}; func'

# start docker container(启动docker容器)
alias docker-start-container='func() { docker start $1; docker-view-containers;}; func'

# restart docker container(重启docker容器)
alias docker-restart-container='func() { docker stop $1; docker start $1; docker-view-containers;}; func'

# stop docker container(停止docker容器)
alias docker-stop-container='func() { docker stop $1; docker-view-containers;}; func'

# stop and remove docker container(停止并移除docker容器)
alias docker-remove-container='func() { docker stop $1; docker rm $1; docker-view-containers;}; func'

# view docker images' information(查看docker镜像信息)
alias docker-view-images='docker images'
alias docker-remove-image='func(){ docker rmi $1; docker-view-images; }; func'

# add specific port to firewall, with the format 'add-port <port>/tcp or add-port <port>/udp'(添加指定端口号到防火墙, 使用方式'add-port <port>/tcp 或 add-port <port>/udp')
alias add-port='func() { firewall-cmd --zone=public --add-port=$1 --permanent; firewall-cmd --reload; firewall-cmd --list-all; }; func'

# remove specific port from firewall, with the format 'remove-port <port>/tcp or remove-port <port>/udp'(添加指定端口号到防火墙, 使用方式'remove-port <port>/tcp 或 remove-port <port>/udp')
alias remove-port='func() { firewall-cmd --zone=public --remove-port=$1 --permanent; firewall-cmd --reload; firewall-cmd --list-all; }; func'

# view firewall details(查看防火墙详情)
alias show-firewall='func() { firewall-cmd --list-all; }; func'

# add specific service to the firewall(添加指定服务到防火墙)
alias add-service='func() { firewall-cmd --zone=public --add-service=$1 --permanent; firewall-cmd --reload; firewall-cmd --list-all; }; func'

# remove specific service from firewall(将指定服务从防火墙中移除)
alias remove-service='func() { firewall-cmd --zone=public --remove-service=$1 --permanent; firewall-cmd --reload; firewall-cmd --list-all; }; func'

# refresh the firewall(刷新防火墙配置)
alias refresh-firewall='func() { firewall-cmd --reload }; func'
# linux  bash 


Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now