Setup Ubuntu

Bash completion (incl. Kubectl)

Add to your ~/.bashrc:

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi
source <(kubectl completion bash)

Java version management

Use update-alternativesto switch between different java versions.

Add an alias to your ~/.bashrc:

alias java-select='sudo update-alternatives --config java'

Calling this alias java-select you can select one of the installed java versions.

Node version management

Use nvmto switch between different node versions.

Clone nvm repo to your home directory ~/:

git clone https://github.com/nvm-sh/nvm.git ~/.nvm

Add to your ~/.bashrc:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

Links: nvm-GitHub

GIT prompt

To see git branch and status inside your shell, add following code to your ~/.bashrc:

# GIT prompt
# store colors
MAGENTA="\[\033[0;35m\]"
YELLOW="\[\033[01;33m\]"
BLUE="\[\033[00;34m\]"
LIGHT_GRAY="\[\033[0;37m\]"
CYAN="\[\033[0;36m\]"
GREEN="\[\033[00;32m\]"
RED="\[\033[0;31m\]"
VIOLET='\[\033[01;35m\]'
 
function color_my_prompt {
  local __user_and_host="$GREEN\u@\h"
  local __cur_location="$BLUE\w"           # capital 'W': current directory, small 'w': full file path
  local __git_branch_color="$GREEN"
  local __prompt_tail="$VIOLET$"
  local __user_input_color="$LIGHT_GRAY"
  local __git_branch=$(__git_ps1 " (%s)"); 
  
  # colour branch name depending on state
  if [[ "${__git_branch}" =~ "*" ]]; then     # if repository is dirty
      __git_branch_color="$RED"
  elif [[ "${__git_branch}" =~ "$" ]]; then   # if there is something stashed
      __git_branch_color="$YELLOW"
  elif [[ "${__git_branch}" =~ "%" ]]; then   # if there are only untracked files
      __git_branch_color="$LIGHT_GRAY"
  elif [[ "${__git_branch}" =~ "+" ]]; then   # if there are staged files
      __git_branch_color="$CYAN"
  fi
   
  # Build the PS1 (Prompt String)
  PS1="$__user_and_host $__cur_location$__git_branch_color$__git_branch $__prompt_tail$__user_input_color "
#  PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
}
 
# configure PROMPT_COMMAND which is executed each time before PS1
export PROMPT_COMMAND=color_my_prompt
 
# if .git-prompt.sh exists, set options and execute it
if [ -f ~/.git-prompt.sh ]; then
  GIT_PS1_SHOWDIRTYSTATE=true
  GIT_PS1_SHOWSTASHSTATE=true
  GIT_PS1_SHOWUNTRACKEDFILES=true
  GIT_PS1_SHOWUPSTREAM="auto"
  GIT_PS1_HIDE_IF_PWD_IGNORED=true
  GIT_PS1_SHOWCOLORHINTS=true
  . ~/.git-prompt.sh
fi

Lazygit

Lazygit tool (see How-To Video)

sudo add-apt-repository ppa:lazygit-team/release
sudo apt-get update
sudo apt-get install lazygit

SSH key as id

Create ssh keypair (private-key/public-key):

# important: use a passphrase to be safe
# save the key to: /home/<user>/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -C "<label: e.g. my-ubuntu>"

SSH access to server using public key

Register your public key on the remote server:

ssh-copy-id -i .ssh/id_rsa.pub <remote-server-user>@<remote-server ip>

SSH Agent

To autostart/autoshutdown ssh-agent we can use the keychainapplication:

sudo apt-get install keychain

Add to ~/.bashrc:

# load ssh-agent
eval $(keychain --eval id_rsa)

SSH Config

To preconfigure some servers, that you want to access with an easy to remember name you can use the ssh config file.

Create this file if not exists in: ~/.ssh/config

Add following content for a server:

Host serverName
HostName 11.11.11.11
User myUsername
Port 22

Now you can use it like that:

> ssh serverName
> scp <sourceFile> serverName:<targetDirectory>

Network Scanner

Install Simple Scan:

sudo apt-get install simple-scan 

Add your scanner IP to the Sane configuration:

sudo nano /etc/sane.d/xerox_mfp.conf

#Dell MFP Laser Printer
tcp 192.168.178.60 9400

Start Simple Scan, your scanner should be found now.