oh_my_zsh

github
config file: ~/.zshrc

install

archlinux

1
pacman -S zsh curl git

opensuse

1
zypper in zsh curl git

install

1
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

update

Manual Updates

1
omz update

Getting Updates: By default, you will be prompted to check for updates every 2 weeks.
You can choose other update modes by adding a line to your ~/.zshrc file, before Oh My Zsh is loaded:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled  # disable automatic updates
# zstyle ':omz:update' mode auto      # update automatically without asking
zstyle ':omz:update' mode reminder  # just remind me to update when it's time

# Uncomment the following line to change how often to auto-update (in days).
zstyle ':omz:update' frequency 13  # This will check for updates every 13 days
# zstyle ':omz:update' frequency 0   # This will check for updates every time you open the terminal (not recommended)

# Updates verbosity
# You can also limit the update verbosity with the following settings:
zstyle ':omz:update' verbose default  # default update prompt
# zstyle ':omz:update' verbose minimal  # only few lines
# zstyle ':omz:update' verbose silent  # only errors

config

config your ~/.zshrc file

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
#ZSH_THEME="darkblood"
ZSH_THEME="linuxonly"
#ZSH_THEME="frisk"
#ZSH_THEME="random"

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
#ZSH_THEME_RANDOM_CANDIDATES=("linuxonly" "frisk" "darkblood")

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git docker-compose kubectl)

docker-compose plugins

AliasCommandDescription
dcodocker-composeDocker-compose main command
dcbdocker-compose buildBuild containers
dcedocker-compose execExecute command inside a container
dcpsdocker-compose psList containers
dcrestartdocker-compose restartRestart container
dcrmdocker-compose rmRemove container
dcrdocker-compose runRun a command in container
dcstopdocker-compose stopStop a container
dcupdocker-compose upBuild, (re)create, start, and attach to containers for a service
dcupbdocker-compose up –buildSame as dcup, but build images before starting containers
dcupddocker-compose up -dSame as dcup, but starts as daemon
dcdndocker-compose downStop and remove containers
dcldocker-compose logsShow logs of container
dclfdocker-compose logs -fShow logs and follow output
dcpulldocker-compose pullPull image of a service
dcstartdocker-compose startStart a container
dckdocker-compose killKills containers

kubectl plugins

AliasCommandDescription
kkubectlThe kubectl command
kcakubectl –all-namespacesThe kubectl command targeting all namespaces
kafkubectl apply -fApply a YML file
ketikubectl exec -tiDrop into an interactive terminal on a container
Manage configuration quickly to switch contexts between local, dev and staging
kcuckubectl config use-contextSet the current-context in a kubeconfig file
kcsckubectl config set-contextSet a context entry in kubeconfig
kcdckubectl config delete-contextDelete the specified context from the kubeconfig
kccckubectl config current-contextDisplay the current-context
kcgckubectl config get-contextsList of contexts available
General aliases
kdelkubectl deleteDelete resources by filenames, stdin, resources and names, or by resources and label selector
kdelfkubectl delete -fDelete a pod using the type and name specified in -f argument
Pod management
kgpkubectl get podsList all pods in ps output format
kgpwkgp –watchAfter listing/getting the requested object, watch for changes
kgpwidekgp -o wideOutput in plain-text format with any additional information. For pods, the node name is included
kepkubectl edit podsEdit pods from the default editor
kdpkubectl describe podsDescribe all pods
kdelpkubectl delete podsDelete all pods matching passed arguments
kgplkgp -lGet pods by label. Example: kgpl “app=myapp” -n myns
kgpnkgp -nGet pods by namespace. Example: kgpn kube-system
Service management
kgskubectl get svcList all services in ps output format
kgswkgs –watchAfter listing all services, watch for changes
kgswidekgs -o wideAfter listing all services, output in plain-text format with any additional information
keskubectl edit svcEdit services(svc) from the default editor
kdskubectl describe svcDescribe all services in detail
kdelskubectl delete svcDelete all services matching passed argument
Ingress management
kgikubectl get ingressList ingress resources in ps output format
keikubectl edit ingressEdit ingress resource from the default editor
kdikubectl describe ingressDescribe ingress resource in detail
kdelikubectl delete ingressDelete ingress resources matching passed argument
Namespace management
kgnskubectl get namespacesList the current namespaces in a cluster
kcnkubectl config set-context –current –namespaceChange current namespace
kenskubectl edit namespaceEdit namespace resource from the default editor
kdnskubectl describe namespaceDescribe namespace resource in detail
kdelnskubectl delete namespaceDelete the namespace. WARNING! This deletes everything in the namespace
ConfigMap management
kgcmkubectl get configmapsList the configmaps in ps output format
kecmkubectl edit configmapEdit configmap resource from the default editor
kdcmkubectl describe configmapDescribe configmap resource in detail
kdelcmkubectl delete configmapDelete the configmap
Secret management
kgseckubectl get secretGetsecret for decoding
kdseckubectl describe secretDescribe secret resource in detail
kdelseckubectl delete secretDelete the secret
Deployment management
kgdkubectl get deploymentGet the deployment
kgdwkgd –watchAfter getting the deployment, watch for changes
kgdwidekgd -o wideAfter getting the deployment, output in plain-text format with any additional information
kedkubectl edit deploymentEdit deployment resource from the default editor
kddkubectl describe deploymentDescribe deployment resource in detail
kdeldkubectl delete deploymentDelete the deployment
ksdkubectl scale deploymentScale a deployment
krsdkubectl rollout status deploymentCheck the rollout status of a deployment
kreskubectl set env $@ REFRESHED_AT=…Recreate all pods in deployment with zero-downtime
Rollout management
kgrskubectl get rsTo see the ReplicaSet rs created by the deployment
krhkubectl rollout historyCheck the revisions of this deployment
krukubectl rollout undoRollback to the previous revision
Port forwarding
kpfkubectl port-forwardForward one or more local ports to a pod
Tools for accessing all information
kgakubectl get allList all resources in ps format
kgaakubectl get all –all-namespacesList the requested object(s) across all namespaces
Logs
klkubectl logsPrint the logs for a container or resource
klfkubectl logs -fStream the logs for a container or resource (follow)
File copy
kcpkubectl cpCopy files and directories to and from containers
Node management
kgnokubectl get nodesList the nodes in ps output format
kenokubectl edit nodeEdit nodes resource from the default editor
kdnokubectl describe nodeDescribe node resource in detail
kdelnokubectl delete nodeDelete the node
Persistent Volume Claim management
kgpvckubectl get pvcList all PVCs
kgpvcwkgpvc –watchAfter listing/getting the requested object, watch for changes
kepvckubectl edit pvcEdit pvcs from the default editor
kdpvckubectl describe pvcDescribe all pvcs
kdelpvckubectl delete pvcDelete all pvcs matching passed arguments
StatefulSets management
kgsskubectl get statefulsetList the statefulsets in ps format
kgsswkgss –watchAfter getting the list of statefulsets, watch for changes
kgsswide kgss -o wideAfter getting the statefulsets, output in plain-text format with any additional information
kesskubectl edit statefulsetEdit statefulset resource from the default editor
kdsskubectl describe statefulsetDescribe statefulset resource in detail
kdelsskubectl delete statefulsetDelete the statefulset
kssskubectl scale statefulsetScale a statefulset
krssskubectl rollout status statefulsetCheck the rollout status of a deployment
Service Accounts management
kdsakubectl describe saDescribe a service account in details
kdelsakubectl delete saDelete the service account
DaemonSet management
kgdskubectl get daemonsetList all DaemonSets in ps output format
kgdswkgds –watchAfter listing all DaemonSets, watch for changes
kedskubectl edit daemonsetEdit DaemonSets from the default editor
kddskubectl describe daemonsetDescribe all DaemonSets in detail
kdeldskubectl delete daemonsetDelete all DaemonSets matching passed argument
CronJob management
kgcjkubectl get cronjobList all CronJobs in ps output format
kecjkubectl edit cronjobEdit CronJob from the default editor
kdcjkubectl describe cronjobDescribe a CronJob in details
kdelcjkubectl delete cronjobDelete the CronJob
Tags: