Linux TroubleShooting

  1. How to add user into sudo / super user group
sudo adduser <username>

2. List available users in Linux/Ubuntu

awk -F':' '{ print $1}' /etc/passwd

3. List users in sudo / super user group

grep '^sudo:.*$' /etc/group | cut -d: -f4

4. How to AWS instance details inside the Ubuntu instance.

# Install below mentioned module
sudo apt-get install cloud-utils

4. Ubuntu Profiles update

sudo vim ~/.profile
sudo vim /etc/profile

Golang environment variable update.

go env -w GO111MODULE=auto

Github Private repo access

git clone https://<User>:<Token><User>/BranchName.git

To Change (add/remove) permissions

sudo chmod +rwx <file/directory name>

To List Users from a group in Ubuntu

# list all members of specific group in linux #
-F':' '/<groupname>/{print $4}' /etc/group
# list all members of sudo group in linux #
awk -F':' '/sudo/{print $4}' /etc/group

List / Start / Restart/ Stop service in Ubuntu

#List all service status
systemctl list-unit-files --type service -all

Change ownership

sudo chown -R ubuntu:ubuntu $HOME/.kube
sudo chown -R $USER $HOME/.kube

batch : date time

set mydate=%DATE:~-4%-%DATE:~4,2%-%DATE:~7,2%_%time:~0,2%:%time:~3,2%:%time:~6,2%

echo %mydate%

Data disk attachment verification

sudo lsblk -o NAME,HCTL,SIZE,MOUNTPOINT | grep -i “sd”
sudo blkid -c /dev/nul | awk -F: ‘{print $1}’ | grep -i “/dev/sd”



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

I am an enthusiastic learner. Always want to challenge my last learning & keep hunting for new learning.