Skip to main content

Linux Commands

Get Linux Version

uname -r
hostnamectl
cat /etc/os-release

Get hostname

hostname

Get IP Address

hostname -I

Set KUBECONFIG

mkdir -p ~/.kube/my-cluster/
scp root@KUBE_MASTET_IPADDRESS:/root/.kube/config ~/.kube/my-cluster/config
export KUBECONFIG=~/.kube/my-cluster/config

Add user in sudoer list in centos/RHEL7

usermod -aG wheel

Run Docker commands without sudo

  1. Add the docker group if it doesn't already exist $ sudo groupadd docker
  2. Add the connected user $USER to the docker group Optionally change the username to match your preferred user. $ sudo gpasswd -a $USER docker IMPORTANT: Log out and log back in so that your group membership is re-evaluated.
  3. Restart the docker daemon $ sudo service docker restart If you are on Ubuntu 14.04-15.10, use docker.io instead: $ sudo service docker.io restart

Kill Running Job

kill $(jobs -p)

Bring background process to foreground

fg

Set Update-alternatives

Check the master link for alternative python,

sudo update-alternatives --display python
sudo alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 1000100