Linux Cheat Sheet

Below is a quick reference to the most useful commands and techniques for a Linux sysadmin:

List of useful commands:
netstat # shows network connections -a (all tcp/udp), -l (listening ports), -at (all tcp), -u (udp)
curl # send get command to URL: -I (retrieve header), -X POST --data "u=username&p=password" (execute post command, flag contains data), -o file.html (save to a file)
env # show environmental variables: printenv <var> (print), export <var>=<value> (change, non-persistent), vi .bashrc (set changes), source .bashrc (pull stored env configs), vi /etc/environment (make changes for all users)
whoami  #  show current username
rmdir  #  remove directory
tail  #  shows just the last 10 lines of file
man  #  display manual
rm  #  remove item	
date  #   shows current date and time
clear  #  clear terminal
touch  #  create a file
cat  #  read file
pwd  #  get current path
less  #  is the better more command
ls  #  list contents
mv  #  move or change file name
echo  #  printout to terminal
cd  #  change directory
cp  #  copy 
wc  #  word count
mkdir  #  make directory
head  #  shows first 10 lines
sort  #  sort a stream or text file
uniq  #  remove duplicates or show only uniques
diff  #  shows differences between 2 files or streams
find  #  search live (without using indexed db)
grep  #  search from file or stream
du -h  #  disk usage information in human readable format
df  #  disk free
history  #  list previous commands
ps  #  process status, use with -aux to show lots of info
top  #  show top processes
kill <pid>  #  kill a process by its pid
killall <processname>  #  kill all processes matching name
jobs  #  display current jobs
fg  #  switch background job into foreground
bg  #  switch foreground job into background
sleep  #  pause for a number of seconds
gzip  #  uses gzip with -f (force), -r (compress recursively), -d (decompress), -[1-9] (compression level)
gunzip  #  uses the smarter gunzip with -f (force), -c (view-only), -k (keep original zip after uncompressed), -r (recurse), -v (verbose), -d (decompress)
tar  #  create a tarball: cvzf (compress) vs xvzf (extract)
nano  #  text editor, most common
alias k='kubectl' # create an alias command basing on another command or script
xargs # accept output of a stream as arguments of a command. Example: echo 'one two three' | xargs mkdir
ln	# create a hard link, use -s for symlink
who	# shows all current users and sessions
su	# switch user account
sudo	# enter root context
passwd # change password of a user
chown	# change ownership of an item
chmod	# modify permissions of an item

# How to discover OS version
cat /etc/os-release

# How to get kernel version
uname -r
cat /proc/version
hostnamectl | grep Kernel

# Add a user
adduser user2 -g <groupname> # create new user and set its group membership
sudo passwd user2	# change password of user

# modify a user
sudo usermod -aG <groupname>,<group2> user2 # add user to more [non-primary] groups
sudo usermod -ag <groupname> user2 # change user's primary group
usermod -s /dev/null user2	# send user logon sessions to the black hole
usermod -d /home/user2newhome --move-home user2	# move a user's home directory
usermod -l <newusername> <oldusername>
usermod -L user2 # lock a user account
usermod -U user2 # unlock a user account
chage -l user2	# check age of user account

# Remove user
userdel -r user2

# groups management
groups <username>	# get membership of user
groupadd sales
groupmod -n sales_new sales	# change the group name
groupmod -gid GID <groupname>	# change group ID
groupdel sales_new

# commands to check logins
whoami
id <username>
who
what
pinky (replacement of finger command)
last

# password database
	- users: /etc/passwd
	- passwords: /etc/shadow
	- groups: /etc/group
	- group passwords: /etc/gshadow
# Edit users file
sudo vipw
# Edit shadow file
sudo vipws

# User Profiles
# System-wide
	- /etc/environment
	- /etc/bash.bashrc
	- /etc/bashrc
	- /etc/profile
# personal profiles
	- /home/username/.bashrc
	- /home/username/.profile
	- /home/username/.bash-profile

# Jobs management
ping google.com &  # run a command and put into background
jobs  # check jobs
ping google.com ... then [control-Z] to suspend job and put into background
bg [job number] # put background job into running status
fg [job number] # bring job into foreground
[control-Z] to halt job
nohup ping localhost &  # run jobs in the background and detach from current session
nohup ping localhost >/dev/null 2>&1 :Send standard output to /dev/null, plus sending standard errors (code 2) to same destination (which is also /dev/null).

# Search devices
# ls commands
lsblk # list block storage (hard drives, DVD-rom, usb-drive)
lscpu # show cpu info
lsdev # show devices
lspci # show all PCI devices
lsusb # show usb devices
# kernel messages
dmesg

# where to find kernel & device info
/proc/  # original container for process
/sys/	# new folder to contain kernel info
/dev/	# system devices

# use cache database to look for files
sudo updatedb # update name index database prior to issuing command
locate file.txt	# use indexed database to search for files
locate sshd.service # more common to search for expected libraries

# File viewing
touch
less
more
tail
cat file.txt | grep searchstring
grep searchstring file.txt

# command redirects
	- STDOUT: >
	- STDIN: < or |
	- STDERR: 2>
	- /dev/null 2>&1 : STDERR redirect to STDOUT of preceeding location (blackhole)
# command to manipulate files and streams
cat textfile.txt | tee textfile_copy.txt # STDOUT and output to a file or console
echo "newfolder" | xargs mkdir # takes STDIN as arguments and then execute
echo "test" > /dev/null > 2>&1	# send stream and errors to the void
printf '4\n1\n2\n3\n'|sort	# sort the output
cut -c 1 textfile.txt	# show the 1st character in each line
paste file1.txt file2.txt > joined.txt
wc -m file1.txt # display the characters count of file
awk '{print $1}' file1.txt	# print first word of each line
echo "searchword other" | sed s/searchword/replaceword/g # search and replace

# soft-links and hard-links
ln -s file1.txt file1_shortcut.txt
ln file1_hardlink.txt file1.txt
find ~ -samefile file1.txt	# look in user directory for files with same pointer to storage location as file1.txt
ls -li # list files with inode info

# search for file in real-time
find . -name file.txt	# look in current location for file matching name
find / -name *file.txt* 2> /dev/null		# redirect errors into void to show only matching results

# secure copy using scp
scp user1@linuxbox:/home/user1/testfile.txt ~/ # Get 1 file
scp testfile.txt user1@linuxbox:/home/user1/ # Put 1 file

# Network copying using rsync
rsync -av user1@linuxbox:/home/user1 .  # get files recursively
rsync -av /home/user1/Desktop user1@linuxbox:/home/user1/Desktop # Put files

# Debian/Ubuntu runlevels
0 = halt
1 = single user mode
2 = full, multi-user mode [with GUI if installed]
3-5 unused
6 = Reboot

# Redhat/Centos runlevels
0 = halt (systemd boot target: poweroff)
1 = single user mode (rescue)
2 = multi-user, no network
3 = multi-user, with network (multi-user)
4 = unused
5 = multi-user with GUI (graphical)
6 = Reboot (reboot)

# systemd boot targets
poweroff
rescue
multi-user
graphical
reboot

# change runlevel
runlevel # check current runlevel
telinit 6 # reboot
vi /etc/inittab # edit default runlevels

# change boot targets
systemctl get-default # view default mode
systemctl set-default multi-user.target # change the boot target, effective on next reboot
systemctl isolate multi-user # switch to mode immediately

# systemd commands to control services
systemctl status kubelet
systemctl disable kubelet # change bootup status
systemctl enable kubelet
systemctl start kubelet
systemctl stop kubelet

# service commands
service httpd start
service httpd stop
service httpd status
chkconfig --list httpd # check config of service on runlevels
chkconfig httpd on # turn service on runlevels 2-5
chkconfig --level 1 httpd on # turn service on at specific runlevel

# Cron
# search for pre-made cron files
root@linuxbox:/$  cd /etc && ls -d -1 "$PWD/"**|grep cron
/etc/cron.d
/etc/cron.daily
/etc/cron.hourly
/etc/cron.monthly
/etc/crontab
/etc/cron.weekly

# format: minute hour day-of-month month day-of-week
crontab -e # edit personal crontab
# add lines to run scheduled tasks
* * * * * echo "something" # every minute
*/15 * * * * echo "something" # every 15 minutes
30 12 9-15 * 2 echo "something" # every 2nd Tuesday of each month at 12:30am

# delayed execution using at daemon
at now +1 hour # run something 1 hour from now

# printing with CUPS
web GUI is located at http://localhost:631
"Print this line" | lpr # send test to printer
lpr textfile.txt 	# print text file
lpq	# list running print jobs
lprm [jobId]	# remote a print job

# How to mount drives

# check drives

# scan for usb drives
user1@linuxbox:~$ lsusb
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 136b:2300 STEC FlashLink All-in-One Reader
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 18a5:0302 Verbatim, Ltd Flash Drive	# this is the USB drive being plugged in
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

user1@linuxbox:~$ usb-devices
T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 9
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev=05.04
S:  Manufacturer=Linux 5.4.0-132-generic xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=0000:12:00.0
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#=0x0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub

T:  Bus=01 Lev=01 Prnt=01 Port=07 Cnt=01 Dev#=  4 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=18a5 ProdID=0302 Rev=02.00
S:  Manufacturer=Verbatim
S:  Product=STORE N GO
S:  SerialNumber=7716151047687633054
C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:  If#=0x0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage

kim@linux03:~$ lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE   MOUNTPOINT
sda       8:0    0 931.5G  0 disk
└─sda1    8:1    0 931.5G  0 part
  └─md0   9:0    0   1.8T  0 raid10 /
sdb       8:16   0 931.5G  0 disk
└─sdb1    8:17   0 931.5G  0 part
  └─md0   9:0    0   1.8T  0 raid10 /
sdc       8:32   1  29.8G  0 disk
├─sdc1    8:33   1   512M  0 part   /boot/efi
└─sdc2    8:34   1  29.3G  0 part   /
sdf       8:80   0 931.5G  0 disk
└─sdf1    8:81   0 931.5G  0 part
  └─md0   9:0    0   1.8T  0 raid10 /
sdg       8:96   0 931.5G  0 disk
└─sdg1    8:97   0 931.5G  0 part
  └─md0   9:0    0   1.8T  0 raid10 /
sdh       8:112  1  14.5G  0 disk	# this is matching the expected usb drive
└─sdh1    8:113  1  14.5G  0 part

user1@linux01:/$ udevadm info /dev/sdh
P: /devices/pci0000:00/0000:00:01.2/0000:12:00.0/usb1/1-8/1-8:1.0/host10/target10:0:0/10:0:0:0/block/sdh
N: sdh
L: 0
S: disk/by-path/pci-0000:12:00.0-usb-0:8:1.0-scsi-0:0:0:0
S: disk/by-id/usb-Verbatim_STORE_N_GO_7716151047687633054-0:0
E: DEVPATH=/devices/pci0000:00/0000:00:01.2/0000:12:00.0/usb1/1-8/1-8:1.0/host10/target10:0:0/10:0:0:0/block/sdh
E: DEVNAME=/dev/sdh
E: DEVTYPE=disk
E: MAJOR=8
E: MINOR=112
E: SUBSYSTEM=block
E: USEC_INITIALIZED=4395690127950
E: SCSI_TPGS=0
E: SCSI_TYPE=disk
E: SCSI_VENDOR=Verbatim
E: SCSI_VENDOR_ENC=Verbatim
E: SCSI_MODEL=STORE_N_GO
E: SCSI_MODEL_ENC=STORE\x20N\x20GO\x20\x20\x20\x20\x20\x20
E: SCSI_REVISION=2.00
E: ID_SCSI=1
E: ID_SCSI_INQUIRY=1
E: ID_VENDOR=Verbatim
E: ID_VENDOR_ENC=Verbatim
E: ID_MODEL=STORE_N_GO
E: ID_MODEL_ENC=STORE\x20N\x20GO\x20\x20\x20\x20\x20\x20
E: ID_REVISION=2.00
E: ID_TYPE=disk
E: MPATH_SBIN_PATH=/sbin
E: ID_VENDOR_ID=18a5
E: ID_MODEL_ID=0302
E: ID_SERIAL=Verbatim_STORE_N_GO_7716151047687633054-0:0
E: ID_SERIAL_SHORT=7716151047687633054
E: ID_INSTANCE=0:0
E: ID_BUS=usb
E: ID_USB_INTERFACES=:080650:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=usb-storage
E: ID_PATH=pci-0000:12:00.0-usb-0:8:1.0-scsi-0:0:0:0
E: ID_PATH_TAG=pci-0000_12_00_0-usb-0_8_1_0-scsi-0_0_0_0
E: ID_PART_TABLE_UUID=0112df30
E: ID_PART_TABLE_TYPE=dos
E: DEVLINKS=/dev/disk/by-path/pci-0000:12:00.0-usb-0:8:1.0-scsi-0:0:0:0 /dev/disk/by-id/usb-Verbatim_STORE_N_GO_7716151047687633054-0:0
E: TAGS=:systemd:

# Create a custom rule to mount the usb-drive
sudo su
...
cat << EOF > /etc/udev/rules.d/10-usb-drive.rules
KERNEL=="sdh1", SUBSYSTEM=="block", SYMLINK="usb-drive"
EOF

# rescan drives and reactive rules
udevadm trigger
ls -l /dev | grep usb

# validate the auto detection
root@linux01:/# ls -l /dev | grep usb
lrwxrwxrwx  1 root root           3 Jan 12 03:30 usb-drive -> sdh

# test writing a file into the hard-link (expect to fail)
root@linuxbox:/media# touch /dev/usb-drive/test0.txt
touch: cannot touch '/dev/usb-drive/test0.txt': Not a directory

# Mounting a device
root@linuxbox:# mkdir /media/usb-drive
root@linuxbox:# mount /dev/usb-drive /media/usb-drive
root@linuxbox:# touch /media/usb-drive/test.txt
root@linuxbox:# ls /media/usb-drive/
'System Volume Information'   test.txt

# Partition Editor
fdisk /dev/sdh
m	# display help menu

g	# create gpt partitioning table
# Example
Command (m for help): g
Created a new GPT disklabel (GUID: DB913469-586B-3F48-9B11-6B2C1A57B04E).
The old dos signature will be removed by a write command.

n	# create new partition
# Example
Command (m for help): n
Partition number (1-128, default 1):
First sector (2048-30433246, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-30433246, default 30433246):
Created a new partition 1 of type 'Linux filesystem' and of size 14.5 GiB.

q	# exit without saving changes
w	# write changes and exit

# Setup RAID
# use fdisk to create partitions as a recommended practice prior to setting up RAID
# create array
mdadm --create /dev/md0 --level=5 --raid-devices=4 /dev/sd{h,i,j,k}1
# check array
cat /proc/mdstat
# save existing config into config file for persistency
mdadm --detail --scan > /etc/adadm/adadm.conf

# Using parted
sudo parted /dev/sdh mklabel gpt
sudo parted -a opt /dev/sdh mkpart primary ext4 0% 100%	# Create primary partition and reserve the entire disk for it

# Creating file system on partitions
# Options:
# mkfs.[ext4,btrfs,msdos,xfs,cramfs,fat,minix,vfat]
mkfs.ext4 -L usb-drive /dev/sdh1	# create an ext4 file system
lsblk -f	# shows disks along with file systems

# Logical Volume Manager
 - Volume Group
 - Logical Volume
 - Physical Volume
pvdisplay	 # shows existing PV config
lvdisplay	 # shows existing LV config
pvcreate /dev/sdh /dev/sdi
vgcreate <groupname> /dev/sdh /dev/sdi
lvcreate -L 10G -N <lvname> <groupname>
mkfs.ext4 /dev/<groupname>/<lvname>
lvextend -L+10G /dev/<groupname>/<lvname>

# Mounting drives
mkdir -p /media/usb-drive
mount /dev/sdh1 /media/usb-drive
mount -a # reload mounts

# persist mounting on reboots
vi /etc/fstab
### add this line
LABEL=usb-drive /media/usb-drive ext4 defaults 0 0
UUID=<output from: ls /dev/sdh1> /media/usb-drive ext4 defaults 0 0
# reload automounts
sudo mount -av

# Quotas
# Enable quota on certain disks
vi /etc/fstab	# ensure that usrquota or grpquota is marked as options for certain volumes (e.g. /dev/sdb1)
sudo quotacheck -au	# generate quota checks file on all partitions indexing by usernames
sudo quotaon -a # turn on quota features
sudo edquota user2 # edit quota for user

# how to scan file system

# View current thresholds for 'Maximum mount count'
tune2fs -l /dev/sdh1

# set /etc/fstab to activate scanning (triggered by combination of max mount count and pass value)
# example server config to activate scanning
/dev/sdh1 /mnt/usb-drive ext4 defaults 0 2 # the last value representing pass number greater than 0, which means it will scan if mount count threshold has been surpassed
tune2fs -c 2 /dev/sdh1 # set file scan threshold at 2
# example laptop to disable scanning
tune2fs -c 2 /dev/sdh1 # set file scan threshold at -1

# how to blacklist a device
vi /etc/modprobe.d/blacklist.conf
# insert a sample line
blacklist <device-name> 

# modules
kernel=$(uname -r)
ls /lib/modules/$kernel/kernel/drivers/net # look for network modules
modprobe hamradio # insert module using the wrapper for insmod command with dependencies autoresolve
rmmod hamradio
depmod # update currently loaded modules' system map

# networking commands
ip route # check route table

# NIC bonding
# mode 0 = balance-rr (round-robin, requires switch support) 
# mode 4 = 802.3ad (advanced switch support)
# mode 6 = balance-alb (no need switch support)

# Ubuntu/Debian
vi /etc/netplan/00-installer-config.yaml
# edit the file
network:
  renderer: networkd
  ethernets:
    enp37s0:
      dhcp4: false
	enp37s1:
	  dhcp4: false
  bonds:
    bond0:
	  dhcp4: false
	  interfaces:
	    - enp37s0
		- enp37s1
	  addresses: [10.10.10.100/24]
	  gateway4: 10.10.10.1
	  parameters:
	    mode: balance-alb
	  nameservers:
		addresses: [8.8.8.8]
  version: 2
### save file
cat /proc/net/bonding/bond0
netplan apply

# Redhat/Centos
vi /etc/sysconfig/network-scripts/ifconfig-bond0
# edit the master bond0 file
DEVICE=bond0
NAME=bond0
BONDING_OPTS="mode=6 miimon=100"
BONDING_MASTER=yes
IPADDR=10.10.10.101
PREFIX=24
ONBOOT=yes
BOOTPROTO=none
# edit the slave eno{49,50,51,52} files
vi /etc/sysconfig/network-scripts/ifconfig-eth0
# edit the file
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
NAME=eth0
ONBOOT=yes
MASTER=bond0
SLAVE=yes

# network config files
/etc/hosts	# local dns file
/etc/resolv.conf	# shows the dns servers list
/etc/nsswitch.conf	# shows more info about name resolutions

# Redhat network config
ls /etc/sysconfig/network-scripts

# Ubuntu/Debian network config
ls /etc/netplan
vi /etc/netplan/<config.file>
sudo netplan apply # make changes effective
nmtui # GUI version

# DNS resolutions
dig @8.8.8.8 yahoo.com
nslookup <host> 8.8.8.8
host yahoo.com 8.8.8.8

# Manual installation using tarballs
tar -zxvf program.tar.gz
cd program/
./config
make
make install OR mv program /usr/local/bin

# Manual install using dpkg
sudo dpkg -i program.deb
sudo dpkg -r program

# Install using apt
ls /ect/apt/	# check for existing sources.list
# add ssl key
wget -qO https://URL | apt-key add -
apt-key list
# automatically adding ssl key
add-apt-respostory ppa:vendorname/appname
# hold currently installed package version
apt-mark hold kubeadm kubelet kubectl
# hold currently installed package version
apt-mark unhold kubeadm kubelet kubectl

# Install using yum (Yellow Dog manager)
yum install program
yum upgrade
# edit main yum config file
vi /etc/yum.conf
# add new repos
vi /etc/yum.repos.d/newrepo.repo
# installing new repo the easy way
yum install epel-release
# install version lock
yum -y install yum-versionlock
# lock a version
yum versionlock nginx
# unlock a version
yum versionlock delete nginx
# view current locks
yum versionlock nginx

# Install using dnf (Dandified YUM)
dnf search packagename
dnf install packagename
dnf remove packagename
sudo dnf upgrade --exclude=packagename
# edit config
vi /etc/dnf/dnf.conf
# lock currently installed package
sudo dnf versionlock add package
# unlock
sudo dnf versionlock delete package

Sample bash shell scripts

# Download firmware from Internet and recursively execute bin files
mkdir -p ~/firmware/r640;
cd ~/firmware/r640;
wget -ml1 https://dl.dell.com/FOLDER08967860M/1/;
chmod +x ;
for i in .BIN;do ./$i -q;done

How to Upgrade Kubernetes Ingress Nginx Deployed via Helm

# How to upgrade ingress-nginx:
helm upgrade --reuse-values ingress-nginx ingress-nginx/ingress-nginx -n ingress-nginx

# Sample output of a failure scenario:

brucelee@k8-controller:~$ helm upgrade --reuse-values ingress-nginx ingress-nginx/ingress-nginx -n ingress-nginx
Error: UPGRADE FAILED: template: ingress-nginx/templates/admission-webhooks/job-patch/job-patchWebhook.yaml:52:24: executing "ingress-nginx/templates/admission-webhooks/job-patch/job-patchWebhook.yaml" at <.Values.controller.admissionWebhooks.patchWebhookJob.resources>: nil pointer evaluating interface {}.resources

 

# How to force uninstall ingress-nginx and re-install it:
 
helm delete ingress-nginx -n ingress-nginx
# Delete a pod stuck in terminating status
podName=ingress-nginx-controller-zlqbl
kubectl delete pod $podName --grace-period=0 --force --namespace ingress-nginx
# Pull most updated versions of applications from source
helm repo update
# Export helm's ingress-nginx yaml config file
helm show values ingress-nginx/ingress-nginx > ingress-nginx.yaml
# edit the values
vim ingress-nginx.yaml

# change these three (3) values

  hostNetwork: true # change this value to true
 

  hostPort:
    enabled: true # set this value to true


  kind: DaemonSet # modify this from Deployment to DaemonSet
# Reinstall ingress-nginx using the edited yaml file:
helm install ingress-nginx ingress-nginx/ingress-nginx -n ingress-nginx --values ingress-nginx.yaml
# Check results:
k -n ingress-nginx get all

Kubernetes Broken Due To Unknown Reasons

Problem 1: Admin User Unable to Login to Cluster via Controller (Master Node)

# SSL Error:
The connection to the server x.x.x.x:6443 was refused - did you specify the right host or port?

# Resolution to the SSL problem:
sudo -i
swapoff -a
exit
strace -eopenat kubectl version

# User privilege error:
kim@controller01:~$ kubectl cluster-info
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
error: You must be logged in to the server (Unauthorized)

kim@controller01:~$ kubectl version
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.10", GitCommit:"8152330a2b6ca3621196e62966ef761b8f5a61bb", GitTreeState:"clean", BuildDate:"2021-08-11T18:06:15Z", GoVersion:"go1.15.15", Compiler:"gc", Platform:"linux/amd64"}
error: You must be logged in to the server (the server has asked for the client to provide credentials)

# Resolution to Admin user privilege error:
# Grant current user admin privileges on Kubernetes
# mkdir -p $HOME/.kube # this was done during previous setup
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
# sudo chown $(id -u):$(id -g) $HOME/.kube/config # this was done during previous setup

Problem 2: SSL Certificates Not Automatically Renewed

# Error message with kimconnect.com SSL Cert
Warning  Failed   84m (x328 over 13d)  cert-manager  The certificate request has failed to complete and will be retried: Failed to wait for order resource "kimconnect-cert-qlnl9-1800784958" to become ready: order is in "invalid" state:

kim@controller01:~$ k get certificaterequests.cert-manager.io
NAME                          READY   AGE
kimconnect-cert-jqlvf         True    90d
kimconnect-cert-qlnl9         False   30d

# Try to delete cert requests and secrets, and wait for cert to regenerate
k delete certificaterequests kimconnect-cert-qlnl9
k delete secret kimconnect-cert

# Try to force cert to renew before 1440 hours (immediately)
kubectl patch certificate kimconnect-cert --patch '
- op: replace
  path: /spec/renewBefore
  value: 1440h
' --type=json

# Wait for cert to become ready, then reverse the change
kubectl patch certificate kimconnect-cert --patch '
- op: remove
  path: /spec/renewBefore
' --type=json

# Worst case scenario, delete the cert and recreate it
k delete cert kimconnect-cert
cat <<EOF > kimconnect-cert.yaml
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: kimconnect-cert
  namespace: default
  annotations:
    kubernetes.io/ingress.class: "nginx"
    acme.cert-manager.io/http01-edit-in-place: "true"
    kubernetes.io/tls-acme: "true"
spec:
  dnsNames:
    - kimconnect.com
    - www.kimconnect.com
  secretName: kimconnect-cert
  issuerRef:
    name: letsencrypt-prod
    kind: ClusterIssuer
EOF
kubectl apply -f kimconnect-cert.yaml

Intermittent Ping Request Time Out Due to An Outdated ARP Table Entry of a Ubuntu Server

Scenario:

– Server A and Server B hardware are of the same model and capacity
– Server A and Server B hard drives were been swapped recently, where Server A hard drives had been transferred to be installed in Server B and vice versa
– Server A was running Ubuntu Linux, and Server B’s OS was VMWare
– Server A, which had Server B’s VMWare OS was able to boot without any problems
– Server B, which had Server A’s Ubuntu Server OS was able to boot.
– Other servers on the same VLAN were able to connect to Server B without problems
– Users from different VLANs complained that they could not reach Server B using its original Server A’s Ubuntu Linux IP address, even though that IP was statically configured on Server A prior to the hard drive switching incident
– Ping results to Server B were intermittent successes and failures

From 10.10.140.128 icmp_seq=760 Destination Host Unreachable
From 10.10.140.128 icmp_seq=761 Destination Host Unreachable
From 10.10.140.128 icmp_seq=762 Destination Host Unreachable
64 bytes from 10.10.100.228: icmp_seq=1 ttl=64 time=1.199 ms
From 10.10.140.128 icmp_seq=760 Destination Host Unreachable
From 10.10.140.128 icmp_seq=761 Destination Host Unreachable
From 10.10.140.128 icmp_seq=762 Destination Host Unreachable
From 10.10.140.128 icmp_seq=762 Destination Host Unreachable
64 bytes from 10.10.100.228: icmp_seq=1 ttl=64 time=1.199 ms
Troubleshooting:

– On clients with issues connecting to the server, run the ‘arp -a’ command to discover the MAC address associated with the server’s ip
– It appeared that the MAC address for the original server A’s IP, which now resided in Server B’s chassis, pointed to Server B mac address.
– It was also confirmed on Server B by running either ‘ifconfig’ or ‘ip addr show’

testuser@ubuntu-server:~$ ifconfig
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.10.100.228 netmask 255.255.255.0 broadcast 192.168.100.255
ether 72:c8:fb:5e:1d:eb txqueuelen 1000 (Ethernet)
RX packets 543498 bytes 634630257 (634.6 MB)
RX errors 0 dropped 5 overruns 0 frame 0
TX packets 118913 bytes 17683157 (17.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0xb8a00000-b8a20000
testuser@ubuntu-server:/home/kim# ip addr show
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 72:c8:fb:5e:1d:eb brd ff:ff:ff:ff:ff:ff
inet 10.10.100.228/24 brd 192.168.100.255 scope global dynamic noprefixroute eno1
valid_lft 85514sec preferred_lft 85514sec
Resolution:

Whenever a Ubuntu Server hard drive has been moved to a different server, one must also reconfigure its MAC address to reflect its new host’s network interface.

Here’s the instruction via GUI: click on the network icon > select Edit connections > Select your current network > Edit the selected connection > select the Ethernet tab > set Clone Mac address = {input the desired MAC address}, stable, or Permanent > Disconnect > re-connect the interface

CLI method:

# Edit the interfaces file
sudo vim /etc/network/interfaces
# add this entry for the eth0 interface
iface eth0 inet static
hwaddress ether 00:00:00:00:MAC-ADDRESS-HERE
# restart server
sudo reboot now

Optional: the intermediary routers and switches should automatically update its ARP table with the changes so that clients could be redirected to the desired and correct Server. Here are some commands to flush the ARP table on switch or router running a Linux based OS:

# flush Mac Table of a Linux based router/switch
admin@test-switch:~$ sudo ip -s -s neigh flush all
[sudo] password for kim:
10.10.100.100 dev eno1 used 1420/1495/1417 probes 6 FAILED
10.10.100.50 dev eno1 lladdr 00:0c:29:27:3b:13 used 2599/2159/2099 probes 6 STALE
10.10.100.2 dev eno1 used 1026/1338/1023 probes 6 FAILED
10.10.100.1 dev eno1 lladdr 74:83:c2:df:f9:8b ref 1 used 2617/0/2617 probes 4 REACHABLE
10.10.100.11 dev eno1 used 971/2677/969 probes 6 FAILED
10.10.100.5 dev eno1 lladdr 00:11:32:e4:c5:ca used 137/132/108 probes 1 STALE

*** Round 1, deleting 6 entries ***
*** Flush is complete after 1 round ***

Linux: How To Create XDG-MIME Association for Google Voice in Unbuntu

Google Voice is a great application that is available on IOS and Android. However, it is lacking a Desktop application version that could be installed on mainstream Linux and Windows (that I know of). Hence, I’ve devised this workaround to associate Google Voice as an xdg-mime type association that could be invoked while browsing Internet websites that feature clickable telephone numbers. Here are the commands for your convenience:

# Change running context as root
sudo su

# Create a desktop file
cat << EOF > /usr/share/applications/gv-tel.desktop
[Desktop Entry]
Name=gv tel
Comment=Google Voice telephone application shortcut
Exec=bash -c 'xdg-open "https://voice.google.com/u/0/calls?a=nc,%2B${0//tel:/}"' %u
Icon=/usr/share/icons/Humanity/apps/32/vinagre.svg
Terminal=false
Type=Application
Categories=Utility
Actions=
MimeType=x-scheme-handler/tel;
EOF

# Exit root context
exit

# Change xdg-open default in the context of the current user - this is important!
xdg-mime default gv-tel.desktop x-scheme-handler/tel

# validate
xdg-mime query default x-scheme-handler/tel

Linux: How To Use Dig

Checking Name Server(s)

kim@kim-linux:~$ dig @8.8.8.8 microsoft.com

; <<>> DiG 9.16.1-Ubuntu <<>> @8.8.8.8 microsoft.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47352
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;microsoft.com.			IN	A

;; ANSWER SECTION:
microsoft.com.		816	IN	A	104.215.148.63
microsoft.com.		816	IN	A	40.76.4.15
microsoft.com.		816	IN	A	40.112.72.205
microsoft.com.		816	IN	A	40.113.200.201
microsoft.com.		816	IN	A	13.77.161.179

;; Query time: 4 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri Oct 29 09:41:15 PDT 2021
;; MSG SIZE  rcvd: 122

Looking Up TXT Records (Including SPF)

kim@kim-linux:~$ dig @8.8.8.8 microsoft.com txt

; <<>> DiG 9.16.1-Ubuntu <<>> @8.8.8.8 microsoft.com txt
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42064
;; flags: qr rd ra; QUERY: 1, ANSWER: 16, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;microsoft.com.			IN	TXT

;; ANSWER SECTION:
microsoft.com.		2127	IN	TXT	"docusign=d5a3737c-c23c-4bd0-9095-d2ff621f2840"
microsoft.com.		2127	IN	TXT	"v=spf1 include:_spf-a.microsoft.com include:_spf-b.microsoft.com include:_spf-c.microsoft.com include:_spf-ssg-a.microsoft.com include:spf-a.hotmail.com include:_spf1-meo.microsoft.com -all"
microsoft.com.		2127	IN	TXT	"google-site-verification=Zv1IvEEZg4N9wbEXpBSSyAiIjDyyB3S-fzfFClb7D1E"
microsoft.com.		2127	IN	TXT	"adobe-sign-verification=c1fea9b4cdd4df0d5778517f29e0934"
microsoft.com.		2127	IN	TXT	"docusign=52998482-393d-46f7-95d4-15ac6509bfdd"
microsoft.com.		2127	IN	TXT	"google-site-verification=8-zFCaUXhhPcvN29EVw2RvtASDCaDPQ02L1HJ8Om8I0"
microsoft.com.		2127	IN	TXT	"adobe-idp-site-verification=8aa35c528af5d72beb19b1bd3ed9b86d87ea7f24b2ba3c99ffcd00c27e9d809c"
microsoft.com.		2127	IN	TXT	"d365mktkey=4d8bnycx40fy3581petta4gsf"
microsoft.com.		2127	IN	TXT	"8RPDXjBzBS9tu7Pbysu7qCACrwXPoDV8ZtLfthTnC4y9VJFLd84it5sQlEITgSLJ4KOIA8pBZxmyvPujuUvhOg=="
microsoft.com.		2127	IN	TXT	"google-site-verification=1TeK8q0OziFl4T1tF-QR65JkzHZ1rcdgNccDFp78iTk"
microsoft.com.		2127	IN	TXT	"d365mktkey=3uc1cf82cpv750lzk70v9bvf2"
microsoft.com.		2127	IN	TXT	"facebook-domain-verification=fwzwhbbzwmg5fzgotc2go51olc3566"
microsoft.com.		2127	IN	TXT	"apple-domain-verification=0gMeaYyYy6GLViGo"
microsoft.com.		2127	IN	TXT	"google-site-verification=pjPOauSPcrfXOZS9jnPPa5axowcHGCDAl1_86dCqFpk"
microsoft.com.		2127	IN	TXT	"fg2t0gov9424p2tdcuo94goe9j"
microsoft.com.		2127	IN	TXT	"t7sebee51jrj7vm932k531hipa"

;; Query time: 4 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri Oct 29 09:39:39 PDT 2021
;; MSG SIZE  rcvd: 1261

Bash Shell: Rename Files – Prepend and Append

Pre-pending

# Prepend any file that doesn't have the word "/thumbs_" in its full path
regex="\/thumbs_"
for file in */thumbs/*.jpg ; do
    if [[ "$file"  =~ ${regex} ]]
    then
      echo "skipping: $file"
    else      
      mv "$file" "$(dirname "$file")/thumbs_$(basename "$file")"
    fi
done

Appending

# Append any file that doesn't have the word ".bak" in its full path
regex=".bak"
for file in */thumbs/*.jpg ; do
    if [[ "$file"  =~ ${regex} ]]
    then
      echo "skipping: $file"
    else      
      mv "$file" "$(dirname "$file")/$(basename "$file").bak"
    fi
done
# Appending file name right before extension
keyword=dragon
for file in *.jpg; do
    echo mv -- "$file" "${file%.jpg}_$keyword.jpg"
done

Installing Simple NFS GUI (for Ubuntu / Mint / Debian)

Overview:

Simple NFS GUI is a Linux application that automates the whole NFS share configuration process. In NFS server mode, the tool automatically sets up the /etc/exports configuration. Security is enforced via /etc/hosts.deny and /etc/hosts.allow. In NFS client mode, the application automatically creates a directory for the mount point by adding the NFS mount to the /etc/fstab file with the necessary users option as required for accessing by non-root users.

# Source: https://github.com/Philippe734/Simple.NFS.GUI

# Installation
sudo add-apt-repository ppa:gambas-team/gambas3 -y && sudo apt-get update
wget https://github.com/Philippe734/Simple.NFS.GUI/raw/master/Linux/1.0.16/simple-nfs-gui_1.0.16-0ubuntu1_all.deb -P ~ && sudo dpkg -i ~/simple-nfs-gui_1.0.16-0ubuntu1_all.deb
sudo apt-get install -fy && rm ~/simple-nfs-gui_1.0.16-0ubuntu1_all.deb && sudo -H Simple_NFS_GUI

# Run Application
sudo -H Simple_NFS_GUI
# Log of installation
kim@kim-linux:~$ sudo add-apt-repository ppa:gambas-team/gambas3 -y && sudo apt-get update && wget https://github.com/Philippe734/Simple.NFS.GUI/raw/master/Linux/1.0.16/simple-nfs-gui_1.0.16-0ubuntu1_all.deb -P ~ && sudo dpkg -i ~/simple-nfs-gui_1.0.16-0ubuntu1_all.deb && sudo apt-get install -fy && rm ~/simple-nfs-gui_1.0.16-0ubuntu1_all.deb && sudo -H Simple_NFS_GUI
You are about to add the following PPA:
 More info: https://launchpad.net/~gambas-team/+archive/ubuntu/gambas3
Executing: /tmp/apt-key-gpghome.jtw69cec1c/gpg.1.sh --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys BEC4D34EA23B1DA104D3F98450B027516CAEE58D
gpg: key 50B027516CAEE58D: public key "Launchpad PPA for Gambas Ubuntu Maintainers" imported
gpg: Total number processed: 1
gpg:               imported: 1
Ign:1 http://packages.linuxmint.com ulyssa InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable InRelease                   
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]      
Hit:4 http://archive.canonical.com/ubuntu focal InRelease                      
Hit:5 http://packages.linuxmint.com ulyssa Release                             
Get:6 https://packages.microsoft.com/repos/vscode stable InRelease [3,959 B]   
Hit:7 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease         
Get:8 https://packages.microsoft.com/repos/code stable InRelease [10.4 kB]     
Hit:9 http://dl.google.com/linux/earth/deb stable InRelease                    
Hit:10 http://archive.ubuntu.com/ubuntu focal InRelease                        
Get:12 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]       
Get:13 https://packages.microsoft.com/repos/vscode stable/main amd64 Packages [266 kB]
Get:14 https://packages.microsoft.com/repos/code stable/main arm64 Packages [52.6 kB]
Get:15 https://packages.microsoft.com/repos/code stable/main amd64 Packages [51.9 kB]
Get:16 https://packages.microsoft.com/repos/code stable/main armhf Packages [52.5 kB]
Get:17 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [949 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]     
Get:19 http://archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [551 kB]
Get:20 http://security.ubuntu.com/ubuntu focal-security/main i386 Packages [297 kB]
Get:21 http://security.ubuntu.com/ubuntu focal-security/main Translation-en [178 kB]
Get:22 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [29.0 kB]
Get:23 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [483 kB]
Get:24 http://security.ubuntu.com/ubuntu focal-security/restricted Translation-en [69.2 kB]
Get:25 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [63.6 kB]
Get:26 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:27 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,298 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [283 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [524 kB]
Get:30 http://archive.ubuntu.com/ubuntu focal-updates/universe i386 Packages [642 kB]
Get:31 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [867 kB]
Get:32 http://archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [186 kB]
Get:33 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [363 kB]
Get:34 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [19.3 kB]
Get:35 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [940 B]
Get:36 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [10.4 kB]
Get:37 http://ppa.launchpad.net/gambas-team/gambas3/ubuntu focal InRelease [17.5 kB]
Hit:38 http://ppa.launchpad.net/gezakovacs/ppa/ubuntu focal InRelease          
Get:39 http://ppa.launchpad.net/gambas-team/gambas3/ubuntu focal/main amd64 Packages [15.6 kB]
Get:40 http://ppa.launchpad.net/gambas-team/gambas3/ubuntu focal/main i386 Packages [6,008 B]
Get:41 http://ppa.launchpad.net/gambas-team/gambas3/ubuntu focal/main Translation-en [6,220 B]
Fetched 7,627 kB in 43s (176 kB/s)                                             
Reading package lists... Done
--2021-10-26 10:38:51--  https://github.com/Philippe734/Simple.NFS.GUI/raw/master/Linux/1.0.16/simple-nfs-gui_1.0.16-0ubuntu1_all.deb
Resolving github.com (github.com)... 192.30.255.112
Connecting to github.com (github.com)|192.30.255.112|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/Philippe734/Simple.NFS.GUI/master/Linux/1.0.16/simple-nfs-gui_1.0.16-0ubuntu1_all.deb [following]
--2021-10-26 10:38:51--  https://raw.githubusercontent.com/Philippe734/Simple.NFS.GUI/master/Linux/1.0.16/simple-nfs-gui_1.0.16-0ubuntu1_all.deb
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 29220 (29K) [application/octet-stream]
Saving to: ‘/home/kim/simple-nfs-gui_1.0.16-0ubuntu1_all.deb’

simple-nfs-gui_1.0. 100%[===================>]  28.54K  --.-KB/s    in 0.002s  

2021-10-26 10:38:51 (13.8 MB/s) - ‘/home/kim/simple-nfs-gui_1.0.16-0ubuntu1_all.deb’ saved [29220/29220]

Selecting previously unselected package simple-nfs-gui.
(Reading database ... 388728 files and directories currently installed.)
Preparing to unpack .../simple-nfs-gui_1.0.16-0ubuntu1_all.deb ...
Unpacking simple-nfs-gui (1.0.16-0ubuntu1) ...
dpkg: dependency problems prevent configuration of simple-nfs-gui:
 simple-nfs-gui depends on gambas3-runtime (>= 3.14); however:
  Package gambas3-runtime is not installed.
 simple-nfs-gui depends on gambas3-runtime (<< 3.99.0); however:
  Package gambas3-runtime is not installed.
 simple-nfs-gui depends on gambas3-gb-form (>= 3.14); however:
  Package gambas3-gb-form is not installed.
 simple-nfs-gui depends on gambas3-gb-form (<< 3.99.0); however:
  Package gambas3-gb-form is not installed.
 simple-nfs-gui depends on gambas3-gb-gtk3 (>= 3.14); however:
  Package gambas3-gb-gtk3 is not installed.
 simple-nfs-gui depends on gambas3-gb-gtk3 (<< 3.99.0); however:
  Package gambas3-gb-gtk3 is not installed.
 simple-nfs-gui depends on gambas3-gb-image (>= 3.14); however:
  Package gambas3-gb-image is not installed.
 simple-nfs-gui depends on gambas3-gb-image (<< 3.99.0); however:
  Package gambas3-gb-image is not installed.

dpkg: error processing package simple-nfs-gui (--install):
 dependency problems - leaving unconfigured
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.24+linuxmint1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Errors were encountered while processing:
 simple-nfs-gui

# Attempting to install the missing library
kim@kim-linux:~$ sudo apt install gambas3-gb-form -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 gambas3-gb-form : Depends: gambas3-runtime (>= 3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.1) but it is not going to be installed
                   Depends: gambas3-gui (>= 3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.1) but it is not going to be installed
 simple-nfs-gui : Depends: gambas3-runtime (>= 3.14) but it is not going to be installed
                  Depends: gambas3-runtime (< 3.99.0) but it is not going to be installed
                  Depends: gambas3-gb-gtk3 (>= 3.14) but it is not going to be installed
                  Depends: gambas3-gb-gtk3 (< 3.99.0) but it is not going to be installed
                  Depends: gambas3-gb-image (>= 3.14) but it is not going to be installed
                  Depends: gambas3-gb-image (< 3.99.0) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

# Fix the broken installs
kim@kim-linux:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  gambas3-gb-form gambas3-gb-gtk gambas3-gb-gtk3 gambas3-gb-gtk3-wayland
  gambas3-gb-gtk3-x11 gambas3-gb-image gambas3-gui gambas3-runtime
The following NEW packages will be installed:
  gambas3-gb-form gambas3-gb-gtk gambas3-gb-gtk3 gambas3-gb-gtk3-wayland
  gambas3-gb-gtk3-x11 gambas3-gb-image gambas3-gui gambas3-runtime
0 upgraded, 8 newly installed, 0 to remove and 4 not upgraded.
1 not fully installed or removed.
Need to get 1,190 kB of archives.
After this operation, 4,682 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ppa.launchpad.net/gambas-team/gambas3/ubuntu focal/main amd64 gambas3-runtime amd64 3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.1 [522 kB]
Get:2 http://ppa.launchpad.net/gambas-team/gambas3/ubuntu focal/main amd64 gambas3-gb-image amd64 3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.1 [32.9 kB]
Get:3 http://ppa.launchpad.net/gambas-team/gambas3/ubuntu focal/main amd64 gambas3-gb-gtk amd64 3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.1 [201 kB]
Get:4 http://ppa.launchpad.net/gambas-team/gambas3/ubuntu focal/main amd64 gambas3-gb-gtk3-x11 amd64 3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.1 [14.4 kB]
Get:5 http://ppa.launchpad.net/gambas-team/gambas3/ubuntu focal/main amd64 gambas3-gb-gtk3-wayland amd64 3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.1 [7,884 B]
Get:6 http://ppa.launchpad.net/gambas-team/gambas3/ubuntu focal/main amd64 gambas3-gb-gtk3 amd64 3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.1 [188 kB]
Get:7 http://ppa.launchpad.net/gambas-team/gambas3/ubuntu focal/main amd64 gambas3-gui all 3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.1 [6,380 B]
Get:8 http://ppa.launchpad.net/gambas-team/gambas3/ubuntu focal/main amd64 gambas3-gb-form all 3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.1 [218 kB]
Fetched 1,190 kB in 1min 22s (14.6 kB/s)                                       
Selecting previously unselected package gambas3-runtime.
(Reading database ... 388744 files and directories currently installed.)
Preparing to unpack .../0-gambas3-runtime_3.16.3+git202109141524.185a3d4a3+build
15~ubuntu20.04.1_amd64.deb ...
Unpacking gambas3-runtime (3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.
1) ...
Selecting previously unselected package gambas3-gb-image.
Preparing to unpack .../1-gambas3-gb-image_3.16.3+git202109141524.185a3d4a3+buil
d15~ubuntu20.04.1_amd64.deb ...
Unpacking gambas3-gb-image (3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04
.1) ...
Selecting previously unselected package gambas3-gb-gtk.
Preparing to unpack .../2-gambas3-gb-gtk_3.16.3+git202109141524.185a3d4a3+build1
5~ubuntu20.04.1_amd64.deb ...
Unpacking gambas3-gb-gtk (3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.1
) ...
Selecting previously unselected package gambas3-gb-gtk3-x11.
Preparing to unpack .../3-gambas3-gb-gtk3-x11_3.16.3+git202109141524.185a3d4a3+b
uild15~ubuntu20.04.1_amd64.deb ...
Unpacking gambas3-gb-gtk3-x11 (3.16.3+git202109141524.185a3d4a3+build15~ubuntu20
.04.1) ...
Selecting previously unselected package gambas3-gb-gtk3-wayland.
Preparing to unpack .../4-gambas3-gb-gtk3-wayland_3.16.3+git202109141524.185a3d4
a3+build15~ubuntu20.04.1_amd64.deb ...
Unpacking gambas3-gb-gtk3-wayland (3.16.3+git202109141524.185a3d4a3+build15~ubun
tu20.04.1) ...
Selecting previously unselected package gambas3-gb-gtk3.
Preparing to unpack .../5-gambas3-gb-gtk3_3.16.3+git202109141524.185a3d4a3+build
15~ubuntu20.04.1_amd64.deb ...
Unpacking gambas3-gb-gtk3 (3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.
1) ...
Selecting previously unselected package gambas3-gui.
Preparing to unpack .../6-gambas3-gui_3.16.3+git202109141524.185a3d4a3+build15~u
buntu20.04.1_all.deb ...
Unpacking gambas3-gui (3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.1) .
..
Selecting previously unselected package gambas3-gb-form.
Preparing to unpack .../7-gambas3-gb-form_3.16.3+git202109141524.185a3d4a3+build
15~ubuntu20.04.1_all.deb ...
Unpacking gambas3-gb-form (3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.
1) ...
Setting up gambas3-runtime (3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04
.1) ...
Setting up gambas3-gb-image (3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.0
4.1) ...
Setting up gambas3-gb-gtk (3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.
1) ...
Setting up gambas3-gui (3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04.1) 
...
Setting up gambas3-gb-form (3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04
.1) ...
Setting up gambas3-gb-gtk3-wayland (3.16.3+git202109141524.185a3d4a3+build15~ubu
ntu20.04.1) ...
Setting up gambas3-gb-gtk3 (3.16.3+git202109141524.185a3d4a3+build15~ubuntu20.04
.1) ...
Setting up gambas3-gb-gtk3-x11 (3.16.3+git202109141524.185a3d4a3+build15~ubuntu2
0.04.1) ...
Setting up simple-nfs-gui (1.0.16-0ubuntu1) ...
Processing triggers for shared-mime-info (1.15-1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for man-db (2.9.1-1) ...

# Test triggering the application
kim@kim-linux:~$ sudo -H Simple_NFS_GUI

Screenshots:

Linux: Performing Speed Test via Command Line Interface (CLI)

Install Speed-Test (if not already installed):

kimconnect@linux-client:~$ sudo apt install speedtest-cli
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  speedtest-cli
0 upgraded, 1 newly installed, 0 to remove and 8 not upgraded.
Need to get 24.0 kB of archives.
After this operation, 106 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu focal-updates/universe amd64 speedtest-cli all 2.1.2-2ubuntu0.20.04.1 [24.0 kB]
Fetched 24.0 kB in 0s (97.3 kB/s)        
Selecting previously unselected package speedtest-cli.
(Reading database ... 145042 files and directories currently installed.)
Preparing to unpack .../speedtest-cli_2.1.2-2ubuntu0.20.04.1_all.deb ...
Unpacking speedtest-cli (2.1.2-2ubuntu0.20.04.1) ...
Setting up speedtest-cli (2.1.2-2ubuntu0.20.04.1) ...
Processing triggers for man-db (2.9.1-1) ...

Run a Speed Test

kimconnect@linux-client:~$ speedtest
Retrieving speedtest.net configuration...
Testing from Frontier Communications (47.157.16.139)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Genesis Adaptive Hosting, INC. (Los Angeles, CA) [27.48 km]: 8.218 ms
Testing download speed................................................................................
Download: 465.91 Mbit/s
Testing upload speed......................................................................................................
Upload: 435.51 Mbit/s

Bash: How To Join Array With Comma Delimiter

# The following function joins an array of numbers
# Limitation: the delimiter is expected to be a single character, such as a comma
array=$(echo {1..6000})
function joinArray { local IFS="$1"; shift; echo "$*";}
joinArray , $array
# Sample output
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415,1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520,1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535,1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640,1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670,1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685,1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700,1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715,1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727,1728,1729,1730,1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745,1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775,1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805,1806,1807,1808,1809,1810,1811,1812,1813,1814,1815,1816,1817,1818,1819,1820,1821,1822,1823,1824,1825,1826,1827,1828,1829,1830,1831,1832,1833,1834,1835,1836,1837,1838,1839,1840,1841,1842,1843,1844,1845,1846,1847,1848,1849,1850,1851,1852,1853,1854,1855,1856,1857,1858,1859,1860,1861,1862,1863,1864,1865,1866,1867,1868,1869,1870,1871,1872,1873,1874,1875,1876,1877,1878,1879,1880,1881,1882,1883,1884,1885,1886,1887,1888,1889,1890,1891,1892,1893,1894,1895,1896,1897,1898,1899,1900,1901,1902,1903,1904,1905,1906,1907,1908,1909,1910,1911,1912,1913,1914,1915,1916,1917,1918,1919,1920,1921,1922,1923,1924,1925,1926,1927,1928,1929,1930,1931,1932,1933,1934,1935,1936,1937,1938,1939,1940,1941,1942,1943,1944,1945,1946,1947,1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033,2034,2035,2036,2037,2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2048,2049,2050,2051,2052,2053,2054,2055,2056,2057,2058,2059,2060,2061,2062,2063,2064,2065,2066,2067,2068,2069,2070,2071,2072,2073,2074,2075,2076,2077,2078,2079,2080,2081,2082,2083,2084,2085,2086,2087,2088,2089,2090,2091,2092,2093,2094,2095,2096,2097,2098,2099,2100,2101,2102,2103,2104,2105,2106,2107,2108,2109,2110,2111,2112,2113,2114,2115,2116,2117,2118,2119,2120,2121,2122,2123,2124,2125,2126,2127,2128,2129,2130,2131,2132,2133,2134,2135,2136,2137,2138,2139,2140,2141,2142,2143,2144,2145,2146,2147,2148,2149,2150,2151,2152,2153,2154,2155,2156,2157,2158,2159,2160,2161,2162,2163,2164,2165,2166,2167,2168,2169,2170,2171,2172,2173,2174,2175,2176,2177,2178,2179,2180,2181,2182,2183,2184,2185,2186,2187,2188,2189,2190,2191,2192,2193,2194,2195,2196,2197,2198,2199,2200,2201,2202,2203,2204,2205,2206,2207,2208,2209,2210,2211,2212,2213,2214,2215,2216,2217,2218,2219,2220,2221,2222,2223,2224,2225,2226,2227,2228,2229,2230,2231,2232,2233,2234,2235,2236,2237,2238,2239,2240,2241,2242,2243,2244,2245,2246,2247,2248,2249,2250,2251,2252,2253,2254,2255,2256,2257,2258,2259,2260,2261,2262,2263,2264,2265,2266,2267,2268,2269,2270,2271,2272,2273,2274,2275,2276,2277,2278,2279,2280,2281,2282,2283,2284,2285,2286,2287,2288,2289,2290,2291,2292,2293,2294,2295,2296,2297,2298,2299,2300,2301,2302,2303,2304,2305,2306,2307,2308,2309,2310,2311,2312,2313,2314,2315,2316,2317,2318,2319,2320,2321,2322,2323,2324,2325,2326,2327,2328,2329,2330,2331,2332,2333,2334,2335,2336,2337,2338,2339,2340,2341,2342,2343,2344,2345,2346,2347,2348,2349,2350,2351,2352,2353,2354,2355,2356,2357,2358,2359,2360,2361,2362,2363,2364,2365,2366,2367,2368,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2383,2384,2385,2386,2387,2388,2389,2390,2391,2392,2393,2394,2395,2396,2397,2398,2399,2400,2401,2402,2403,2404,2405,2406,2407,2408,2409,2410,2411,2412,2413,2414,2415,2416,2417,2418,2419,2420,2421,2422,2423,2424,2425,2426,2427,2428,2429,2430,2431,2432,2433,2434,2435,2436,2437,2438,2439,2440,2441,2442,2443,2444,2445,2446,2447,2448,2449,2450,2451,2452,2453,2454,2455,2456,2457,2458,2459,2460,2461,2462,2463,2464,2465,2466,2467,2468,2469,2470,2471,2472,2473,2474,2475,2476,2477,2478,2479,2480,2481,2482,2483,2484,2485,2486,2487,2488,2489,2490,2491,2492,2493,2494,2495,2496,2497,2498,2499,2500,2501,2502,2503,2504,2505,2506,2507,2508,2509,2510,2511,2512,2513,2514,2515,2516,2517,2518,2519,2520,2521,2522,2523,2524,2525,2526,2527,2528,2529,2530,2531,2532,2533,2534,2535,2536,2537,2538,2539,2540,2541,2542,2543,2544,2545,2546,2547,2548,2549,2550,2551,2552,2553,2554,2555,2556,2557,2558,2559,2560,2561,2562,2563,2564,2565,2566,2567,2568,2569,2570,2571,2572,2573,2574,2575,2576,2577,2578,2579,2580,2581,2582,2583,2584,2585,2586,2587,2588,2589,2590,2591,2592,2593,2594,2595,2596,2597,2598,2599,2600,2601,2602,2603,2604,2605,2606,2607,2608,2609,2610,2611,2612,2613,2614,2615,2616,2617,2618,2619,2620,2621,2622,2623,2624,2625,2626,2627,2628,2629,2630,2631,2632,2633,2634,2635,2636,2637,2638,2639,2640,2641,2642,2643,2644,2645,2646,2647,2648,2649,2650,2651,2652,2653,2654,2655,2656,2657,2658,2659,2660,2661,2662,2663,2664,2665,2666,2667,2668,2669,2670,2671,2672,2673,2674,2675,2676,2677,2678,2679,2680,2681,2682,2683,2684,2685,2686,2687,2688,2689,2690,2691,2692,2693,2694,2695,2696,2697,2698,2699,2700,2701,2702,2703,2704,2705,2706,2707,2708,2709,2710,2711,2712,2713,2714,2715,2716,2717,2718,2719,2720,2721,2722,2723,2724,2725,2726,2727,2728,2729,2730,2731,2732,2733,2734,2735,2736,2737,2738,2739,2740,2741,2742,2743,2744,2745,2746,2747,2748,2749,2750,2751,2752,2753,2754,2755,2756,2757,2758,2759,2760,2761,2762,2763,2764,2765,2766,2767,2768,2769,2770,2771,2772,2773,2774,2775,2776,2777,2778,2779,2780,2781,2782,2783,2784,2785,2786,2787,2788,2789,2790,2791,2792,2793,2794,2795,2796,2797,2798,2799,2800,2801,2802,2803,2804,2805,2806,2807,2808,2809,2810,2811,2812,2813,2814,2815,2816,2817,2818,2819,2820,2821,2822,2823,2824,2825,2826,2827,2828,2829,2830,2831,2832,2833,2834,2835,2836,2837,2838,2839,2840,2841,2842,2843,2844,2845,2846,2847,2848,2849,2850,2851,2852,2853,2854,2855,2856,2857,2858,2859,2860,2861,2862,2863,2864,2865,2866,2867,2868,2869,2870,2871,2872,2873,2874,2875,2876,2877,2878,2879,2880,2881,2882,2883,2884,2885,2886,2887,2888,2889,2890,2891,2892,2893,2894,2895,2896,2897,2898,2899,2900,2901,2902,2903,2904,2905,2906,2907,2908,2909,2910,2911,2912,2913,2914,2915,2916,2917,2918,2919,2920,2921,2922,2923,2924,2925,2926,2927,2928,2929,2930,2931,2932,2933,2934,2935,2936,2937,2938,2939,2940,2941,2942,2943,2944,2945,2946,2947,2948,2949,2950,2951,2952,2953,2954,2955,2956,2957,2958,2959,2960,2961,2962,2963,2964,2965,2966,2967,2968,2969,2970,2971,2972,2973,2974,2975,2976,2977,2978,2979,2980,2981,2982,2983,2984,2985,2986,2987,2988,2989,2990,2991,2992,2993,2994,2995,2996,2997,2998,2999,3000,3001,3002,3003,3004,3005,3006,3007,3008,3009,3010,3011,3012,3013,3014,3015,3016,3017,3018,3019,3020,3021,3022,3023,3024,3025,3026,3027,3028,3029,3030,3031,3032,3033,3034,3035,3036,3037,3038,3039,3040,3041,3042,3043,3044,3045,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055,3056,3057,3058,3059,3060,3061,3062,3063,3064,3065,3066,3067,3068,3069,3070,3071,3072,3073,3074,3075,3076,3077,3078,3079,3080,3081,3082,3083,3084,3085,3086,3087,3088,3089,3090,3091,3092,3093,3094,3095,3096,3097,3098,3099,3100,3101,3102,3103,3104,3105,3106,3107,3108,3109,3110,3111,3112,3113,3114,3115,3116,3117,3118,3119,3120,3121,3122,3123,3124,3125,3126,3127,3128,3129,3130,3131,3132,3133,3134,3135,3136,3137,3138,3139,3140,3141,3142,3143,3144,3145,3146,3147,3148,3149,3150,3151,3152,3153,3154,3155,3156,3157,3158,3159,3160,3161,3162,3163,3164,3165,3166,3167,3168,3169,3170,3171,3172,3173,3174,3175,3176,3177,3178,3179,3180,3181,3182,3183,3184,3185,3186,3187,3188,3189,3190,3191,3192,3193,3194,3195,3196,3197,3198,3199,3200,3201,3202,3203,3204,3205,3206,3207,3208,3209,3210,3211,3212,3213,3214,3215,3216,3217,3218,3219,3220,3221,3222,3223,3224,3225,3226,3227,3228,3229,3230,3231,3232,3233,3234,3235,3236,3237,3238,3239,3240,3241,3242,3243,3244,3245,3246,3247,3248,3249,3250,3251,3252,3253,3254,3255,3256,3257,3258,3259,3260,3261,3262,3263,3264,3265,3266,3267,3268,3269,3270,3271,3272,3273,3274,3275,3276,3277,3278,3279,3280,3281,3282,3283,3284,3285,3286,3287,3288,3289,3290,3291,3292,3293,3294,3295,3296,3297,3298,3299,3300,3301,3302,3303,3304,3305,3306,3307,3308,3309,3310,3311,3312,3313,3314,3315,3316,3317,3318,3319,3320,3321,3322,3323,3324,3325,3326,3327,3328,3329,3330,3331,3332,3333,3334,3335,3336,3337,3338,3339,3340,3341,3342,3343,3344,3345,3346,3347,3348,3349,3350,3351,3352,3353,3354,3355,3356,3357,3358,3359,3360,3361,3362,3363,3364,3365,3366,3367,3368,3369,3370,3371,3372,3373,3374,3375,3376,3377,3378,3379,3380,3381,3382,3383,3384,3385,3386,3387,3388,3389,3390,3391,3392,3393,3394,3395,3396,3397,3398,3399,3400,3401,3402,3403,3404,3405,3406,3407,3408,3409,3410,3411,3412,3413,3414,3415,3416,3417,3418,3419,3420,3421,3422,3423,3424,3425,3426,3427,3428,3429,3430,3431,3432,3433,3434,3435,3436,3437,3438,3439,3440,3441,3442,3443,3444,3445,3446,3447,3448,3449,3450,3451,3452,3453,3454,3455,3456,3457,3458,3459,3460,3461,3462,3463,3464,3465,3466,3467,3468,3469,3470,3471,3472,3473,3474,3475,3476,3477,3478,3479,3480,3481,3482,3483,3484,3485,3486,3487,3488,3489,3490,3491,3492,3493,3494,3495,3496,3497,3498,3499,3500,3501,3502,3503,3504,3505,3506,3507,3508,3509,3510,3511,3512,3513,3514,3515,3516,3517,3518,3519,3520,3521,3522,3523,3524,3525,3526,3527,3528,3529,3530,3531,3532,3533,3534,3535,3536,3537,3538,3539,3540,3541,3542,3543,3544,3545,3546,3547,3548,3549,3550,3551,3552,3553,3554,3555,3556,3557,3558,3559,3560,3561,3562,3563,3564,3565,3566,3567,3568,3569,3570,3571,3572,3573,3574,3575,3576,3577,3578,3579,3580,3581,3582,3583,3584,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,3643,3644,3645,3646,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,3676,3677,3678,3679,3680,3681,3682,3683,3684,3685,3686,3687,3688,3689,3690,3691,3692,3693,3694,3695,3696,3697,3698,3699,3700,3701,3702,3703,3704,3705,3706,3707,3708,3709,3710,3711,3712,3713,3714,3715,3716,3717,3718,3719,3720,3721,3722,3723,3724,3725,3726,3727,3728,3729,3730,3731,3732,3733,3734,3735,3736,3737,3738,3739,3740,3741,3742,3743,3744,3745,3746,3747,3748,3749,3750,3751,3752,3753,3754,3755,3756,3757,3758,3759,3760,3761,3762,3763,3764,3765,3766,3767,3768,3769,3770,3771,3772,3773,3774,3775,3776,3777,3778,3779,3780,3781,3782,3783,3784,3785,3786,3787,3788,3789,3790,3791,3792,3793,3794,3795,3796,3797,3798,3799,3800,3801,3802,3803,3804,3805,3806,3807,3808,3809,3810,3811,3812,3813,3814,3815,3816,3817,3818,3819,3820,3821,3822,3823,3824,3825,3826,3827,3828,3829,3830,3831,3832,3833,3834,3835,3836,3837,3838,3839,3840,3841,3842,3843,3844,3845,3846,3847,3848,3849,3850,3851,3852,3853,3854,3855,3856,3857,3858,3859,3860,3861,3862,3863,3864,3865,3866,3867,3868,3869,3870,3871,3872,3873,3874,3875,3876,3877,3878,3879,3880,3881,3882,3883,3884,3885,3886,3887,3888,3889,3890,3891,3892,3893,3894,3895,3896,3897,3898,3899,3900,3901,3902,3903,3904,3905,3906,3907,3908,3909,3910,3911,3912,3913,3914,3915,3916,3917,3918,3919,3920,3921,3922,3923,3924,3925,3926,3927,3928,3929,3930,3931,3932,3933,3934,3935,3936,3937,3938,3939,3940,3941,3942,3943,3944,3945,3946,3947,3948,3949,3950,3951,3952,3953,3954,3955,3956,3957,3958,3959,3960,3961,3962,3963,3964,3965,3966,3967,3968,3969,3970,3971,3972,3973,3974,3975,3976,3977,3978,3979,3980,3981,3982,3983,3984,3985,3986,3987,3988,3989,3990,3991,3992,3993,3994,3995,3996,3997,3998,3999,4000,4001,4002,4003,4004,4005,4006,4007,4008,4009,4010,4011,4012,4013,4014,4015,4016,4017,4018,4019,4020,4021,4022,4023,4024,4025,4026,4027,4028,4029,4030,4031,4032,4033,4034,4035,4036,4037,4038,4039,4040,4041,4042,4043,4044,4045,4046,4047,4048,4049,4050,4051,4052,4053,4054,4055,4056,4057,4058,4059,4060,4061,4062,4063,4064,4065,4066,4067,4068,4069,4070,4071,4072,4073,4074,4075,4076,4077,4078,4079,4080,4081,4082,4083,4084,4085,4086,4087,4088,4089,4090,4091,4092,4093,4094,4095,4096,4097,4098,4099,4100,4101,4102,4103,4104,4105,4106,4107,4108,4109,4110,4111,4112,4113,4114,4115,4116,4117,4118,4119,4120,4121,4122,4123,4124,4125,4126,4127,4128,4129,4130,4131,4132,4133,4134,4135,4136,4137,4138,4139,4140,4141,4142,4143,4144,4145,4146,4147,4148,4149,4150,4151,4152,4153,4154,4155,4156,4157,4158,4159,4160,4161,4162,4163,4164,4165,4166,4167,4168,4169,4170,4171,4172,4173,4174,4175,4176,4177,4178,4179,4180,4181,4182,4183,4184,4185,4186,4187,4188,4189,4190,4191,4192,4193,4194,4195,4196,4197,4198,4199,4200,4201,4202,4203,4204,4205,4206,4207,4208,4209,4210,4211,4212,4213,4214,4215,4216,4217,4218,4219,4220,4221,4222,4223,4224,4225,4226,4227,4228,4229,4230,4231,4232,4233,4234,4235,4236,4237,4238,4239,4240,4241,4242,4243,4244,4245,4246,4247,4248,4249,4250,4251,4252,4253,4254,4255,4256,4257,4258,4259,4260,4261,4262,4263,4264,4265,4266,4267,4268,4269,4270,4271,4272,4273,4274,4275,4276,4277,4278,4279,4280,4281,4282,4283,4284,4285,4286,4287,4288,4289,4290,4291,4292,4293,4294,4295,4296,4297,4298,4299,4300,4301,4302,4303,4304,4305,4306,4307,4308,4309,4310,4311,4312,4313,4314,4315,4316,4317,4318,4319,4320,4321,4322,4323,4324,4325,4326,4327,4328,4329,4330,4331,4332,4333,4334,4335,4336,4337,4338,4339,4340,4341,4342,4343,4344,4345,4346,4347,4348,4349,4350,4351,4352,4353,4354,4355,4356,4357,4358,4359,4360,4361,4362,4363,4364,4365,4366,4367,4368,4369,4370,4371,4372,4373,4374,4375,4376,4377,4378,4379,4380,4381,4382,4383,4384,4385,4386,4387,4388,4389,4390,4391,4392,4393,4394,4395,4396,4397,4398,4399,4400,4401,4402,4403,4404,4405,4406,4407,4408,4409,4410,4411,4412,4413,4414,4415,4416,4417,4418,4419,4420,4421,4422,4423,4424,4425,4426,4427,4428,4429,4430,4431,4432,4433,4434,4435,4436,4437,4438,4439,4440,4441,4442,4443,4444,4445,4446,4447,4448,4449,4450,4451,4452,4453,4454,4455,4456,4457,4458,4459,4460,4461,4462,4463,4464,4465,4466,4467,4468,4469,4470,4471,4472,4473,4474,4475,4476,4477,4478,4479,4480,4481,4482,4483,4484,4485,4486,4487,4488,4489,4490,4491,4492,4493,4494,4495,4496,4497,4498,4499,4500,4501,4502,4503,4504,4505,4506,4507,4508,4509,4510,4511,4512,4513,4514,4515,4516,4517,4518,4519,4520,4521,4522,4523,4524,4525,4526,4527,4528,4529,4530,4531,4532,4533,4534,4535,4536,4537,4538,4539,4540,4541,4542,4543,4544,4545,4546,4547,4548,4549,4550,4551,4552,4553,4554,4555,4556,4557,4558,4559,4560,4561,4562,4563,4564,4565,4566,4567,4568,4569,4570,4571,4572,4573,4574,4575,4576,4577,4578,4579,4580,4581,4582,4583,4584,4585,4586,4587,4588,4589,4590,4591,4592,4593,4594,4595,4596,4597,4598,4599,4600,4601,4602,4603,4604,4605,4606,4607,4608,4609,4610,4611,4612,4613,4614,4615,4616,4617,4618,4619,4620,4621,4622,4623,4624,4625,4626,4627,4628,4629,4630,4631,4632,4633,4634,4635,4636,4637,4638,4639,4640,4641,4642,4643,4644,4645,4646,4647,4648,4649,4650,4651,4652,4653,4654,4655,4656,4657,4658,4659,4660,4661,4662,4663,4664,4665,4666,4667,4668,4669,4670,4671,4672,4673,4674,4675,4676,4677,4678,4679,4680,4681,4682,4683,4684,4685,4686,4687,4688,4689,4690,4691,4692,4693,4694,4695,4696,4697,4698,4699,4700,4701,4702,4703,4704,4705,4706,4707,4708,4709,4710,4711,4712,4713,4714,4715,4716,4717,4718,4719,4720,4721,4722,4723,4724,4725,4726,4727,4728,4729,4730,4731,4732,4733,4734,4735,4736,4737,4738,4739,4740,4741,4742,4743,4744,4745,4746,4747,4748,4749,4750,4751,4752,4753,4754,4755,4756,4757,4758,4759,4760,4761,4762,4763,4764,4765,4766,4767,4768,4769,4770,4771,4772,4773,4774,4775,4776,4777,4778,4779,4780,4781,4782,4783,4784,4785,4786,4787,4788,4789,4790,4791,4792,4793,4794,4795,4796,4797,4798,4799,4800,4801,4802,4803,4804,4805,4806,4807,4808,4809,4810,4811,4812,4813,4814,4815,4816,4817,4818,4819,4820,4821,4822,4823,4824,4825,4826,4827,4828,4829,4830,4831,4832,4833,4834,4835,4836,4837,4838,4839,4840,4841,4842,4843,4844,4845,4846,4847,4848,4849,4850,4851,4852,4853,4854,4855,4856,4857,4858,4859,4860,4861,4862,4863,4864,4865,4866,4867,4868,4869,4870,4871,4872,4873,4874,4875,4876,4877,4878,4879,4880,4881,4882,4883,4884,4885,4886,4887,4888,4889,4890,4891,4892,4893,4894,4895,4896,4897,4898,4899,4900,4901,4902,4903,4904,4905,4906,4907,4908,4909,4910,4911,4912,4913,4914,4915,4916,4917,4918,4919,4920,4921,4922,4923,4924,4925,4926,4927,4928,4929,4930,4931,4932,4933,4934,4935,4936,4937,4938,4939,4940,4941,4942,4943,4944,4945,4946,4947,4948,4949,4950,4951,4952,4953,4954,4955,4956,4957,4958,4959,4960,4961,4962,4963,4964,4965,4966,4967,4968,4969,4970,4971,4972,4973,4974,4975,4976,4977,4978,4979,4980,4981,4982,4983,4984,4985,4986,4987,4988,4989,4990,4991,4992,4993,4994,4995,4996,4997,4998,4999,5000,5001,5002,5003,5004,5005,5006,5007,5008,5009,5010,5011,5012,5013,5014,5015,5016,5017,5018,5019,5020,5021,5022,5023,5024,5025,5026,5027,5028,5029,5030,5031,5032,5033,5034,5035,5036,5037,5038,5039,5040,5041,5042,5043,5044,5045,5046,5047,5048,5049,5050,5051,5052,5053,5054,5055,5056,5057,5058,5059,5060,5061,5062,5063,5064,5065,5066,5067,5068,5069,5070,5071,5072,5073,5074,5075,5076,5077,5078,5079,5080,5081,5082,5083,5084,5085,5086,5087,5088,5089,5090,5091,5092,5093,5094,5095,5096,5097,5098,5099,5100,5101,5102,5103,5104,5105,5106,5107,5108,5109,5110,5111,5112,5113,5114,5115,5116,5117,5118,5119,5120,5121,5122,5123,5124,5125,5126,5127,5128,5129,5130,5131,5132,5133,5134,5135,5136,5137,5138,5139,5140,5141,5142,5143,5144,5145,5146,5147,5148,5149,5150,5151,5152,5153,5154,5155,5156,5157,5158,5159,5160,5161,5162,5163,5164,5165,5166,5167,5168,5169,5170,5171,5172,5173,5174,5175,5176,5177,5178,5179,5180,5181,5182,5183,5184,5185,5186,5187,5188,5189,5190,5191,5192,5193,5194,5195,5196,5197,5198,5199,5200,5201,5202,5203,5204,5205,5206,5207,5208,5209,5210,5211,5212,5213,5214,5215,5216,5217,5218,5219,5220,5221,5222,5223,5224,5225,5226,5227,5228,5229,5230,5231,5232,5233,5234,5235,5236,5237,5238,5239,5240,5241,5242,5243,5244,5245,5246,5247,5248,5249,5250,5251,5252,5253,5254,5255,5256,5257,5258,5259,5260,5261,5262,5263,5264,5265,5266,5267,5268,5269,5270,5271,5272,5273,5274,5275,5276,5277,5278,5279,5280,5281,5282,5283,5284,5285,5286,5287,5288,5289,5290,5291,5292,5293,5294,5295,5296,5297,5298,5299,5300,5301,5302,5303,5304,5305,5306,5307,5308,5309,5310,5311,5312,5313,5314,5315,5316,5317,5318,5319,5320,5321,5322,5323,5324,5325,5326,5327,5328,5329,5330,5331,5332,5333,5334,5335,5336,5337,5338,5339,5340,5341,5342,5343,5344,5345,5346,5347,5348,5349,5350,5351,5352,5353,5354,5355,5356,5357,5358,5359,5360,5361,5362,5363,5364,5365,5366,5367,5368,5369,5370,5371,5372,5373,5374,5375,5376,5377,5378,5379,5380,5381,5382,5383,5384,5385,5386,5387,5388,5389,5390,5391,5392,5393,5394,5395,5396,5397,5398,5399,5400,5401,5402,5403,5404,5405,5406,5407,5408,5409,5410,5411,5412,5413,5414,5415,5416,5417,5418,5419,5420,5421,5422,5423,5424,5425,5426,5427,5428,5429,5430,5431,5432,5433,5434,5435,5436,5437,5438,5439,5440,5441,5442,5443,5444,5445,5446,5447,5448,5449,5450,5451,5452,5453,5454,5455,5456,5457,5458,5459,5460,5461,5462,5463,5464,5465,5466,5467,5468,5469,5470,5471,5472,5473,5474,5475,5476,5477,5478,5479,5480,5481,5482,5483,5484,5485,5486,5487,5488,5489,5490,5491,5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,5502,5503,5504,5505,5506,5507,5508,5509,5510,5511,5512,5513,5514,5515,5516,5517,5518,5519,5520,5521,5522,5523,5524,5525,5526,5527,5528,5529,5530,5531,5532,5533,5534,5535,5536,5537,5538,5539,5540,5541,5542,5543,5544,5545,5546,5547,5548,5549,5550,5551,5552,5553,5554,5555,5556,5557,5558,5559,5560,5561,5562,5563,5564,5565,5566,5567,5568,5569,5570,5571,5572,5573,5574,5575,5576,5577,5578,5579,5580,5581,5582,5583,5584,5585,5586,5587,5588,5589,5590,5591,5592,5593,5594,5595,5596,5597,5598,5599,5600,5601,5602,5603,5604,5605,5606,5607,5608,5609,5610,5611,5612,5613,5614,5615,5616,5617,5618,5619,5620,5621,5622,5623,5624,5625,5626,5627,5628,5629,5630,5631,5632,5633,5634,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646,5647,5648,5649,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659,5660,5661,5662,5663,5664,5665,5666,5667,5668,5669,5670,5671,5672,5673,5674,5675,5676,5677,5678,5679,5680,5681,5682,5683,5684,5685,5686,5687,5688,5689,5690,5691,5692,5693,5694,5695,5696,5697,5698,5699,5700,5701,5702,5703,5704,5705,5706,5707,5708,5709,5710,5711,5712,5713,5714,5715,5716,5717,5718,5719,5720,5721,5722,5723,5724,5725,5726,5727,5728,5729,5730,5731,5732,5733,5734,5735,5736,5737,5738,5739,5740,5741,5742,5743,5744,5745,5746,5747,5748,5749,5750,5751,5752,5753,5754,5755,5756,5757,5758,5759,5760,5761,5762,5763,5764,5765,5766,5767,5768,5769,5770,5771,5772,5773,5774,5775,5776,5777,5778,5779,5780,5781,5782,5783,5784,5785,5786,5787,5788,5789,5790,5791,5792,5793,5794,5795,5796,5797,5798,5799,5800,5801,5802,5803,5804,5805,5806,5807,5808,5809,5810,5811,5812,5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824,5825,5826,5827,5828,5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840,5841,5842,5843,5844,5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,5856,5857,5858,5859,5860,5861,5862,5863,5864,5865,5866,5867,5868,5869,5870,5871,5872,5873,5874,5875,5876,5877,5878,5879,5880,5881,5882,5883,5884,5885,5886,5887,5888,5889,5890,5891,5892,5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904,5905,5906,5907,5908,5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920,5921,5922,5923,5924,5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,5936,5937,5938,5939,5940,5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951,5952,5953,5954,5955,5956,5957,5958,5959,5960,5961,5962,5963,5964,5965,5966,5967,5968,5969,5970,5971,5972,5973,5974,5975,5976,5977,5978,5979,5980,5981,5982,5983,5984,5985,5986,5987,5988,5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6000

Puppet Client Server Lab Setup

Server

# Setup client machine name
sudo vim /etc/hosts
## Insert this line ##
xx.xx.xx.xx puppet-client.local puppet-client # this will enable client to know client with DNS
xx.xx.xx.xx puppet-server.local puppet-server 

# Install puppet
curl -O https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb 
dpkg -i puppetlabs-release-pc1-xenial.deb

# Install puppet agent
sudo apt update
sudo apt install puppet-server -y 
systemctl enable puppetserver
systemctl start puppetserver

# Configure memory allocation
vim /etc/default/pupperserver
## change this line to fit your memory allowance ##
JAVA_ARGS="-Xms2g -Xmx2g -XX:MaxPermSize=256m"

# Config firewall
sudo ufw allow 8140

Client

# Setup client machine name
sudo vim /etc/hosts
## Insert this line ##
xx.xx.xx.xx puppet-client.local puppet-client
xx.xx.xx.xx puppet-server.local puppet-server # this will enable client to reach server

# Install puppet
wget https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb 
dpkg -i puppetlabs-release-pc1-xenial.deb

# Install puppet agent
sudo apt update
sudo apt install puppet-agent -y 
systemctl enable puppet
systemctl start puppet

Connecting Client To Server

# create cert signing request while login to client
/opt/puppetlabs/bin/puppet agent -t --server=puppet-master.local

# sign the cert signing request while login to server
/opt/puppetlabs/bin/puppet list --all # Check for existing certs and requests
/opt/puppetlabs/bin/puppet cert sign puppet-client.local # where puppet-client.local is the requesting node

# Test from client
/opt/puppetlabs/puppet/bin/puppet agent -t --server=puppet-master.local

Example of installing modules: Python

# While login to puppet-master

# set current directory as the modules folder
cd /etc/puppetlabs/code/environments/production/modules/

# search for a module from Puppet Forge
$ /opt/puppetlabs/bin/puppet module search python

# install the module we've selected
$ sudo /opt/puppetlabs/bin/puppet module install python

# Install the module to make it available to the manifest inclusions
/opt/puppetlabs/bin/puppet module install puppet-labs-python --version x.xx.x

# verify the module is installed
$ sudo /opt/puppetlabs/bin/puppet module list

# Pushing puppet image out to a client
vim /etc/puppetlabs/code/environments/production/manifests/site.pp
## Insert this content ##
node 'puppet-client.local' {
  include python
  include python::virtualenv
}

# pull the config while login to client
/opt/puppetlabs/puppet/bin/puppet agent -t --server=puppet-master.local

How to Install Selenium for Python on Windows or Linux

Windows

# This error would occur if pip is not up to date
PS C:\WINDOWS\system32> pip install selenium
Collecting selenium
  Downloading https://files.pythonhosted.org/packages/ad/24/39cab5fbaf425ff522e1e51cce79f94f10f9523f015d2b2251e43f45e8a2/selenium-4.0.0-py3-none-any.whl (954kB)
     |████████████████████████████████| 962kB ...
~ Truncated ~
Building wheels for collected packages: cryptography
  Building wheel for cryptography (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\python38\python.exe' 'c:\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\DRAGON~1\AppData\Local\Temp\tmprcrddpd1'
~ Truncated ~
  If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.

  This package requires Rust >=1.41.0.

      =============================DEBUG ASSISTANCE=============================
      If you are seeing a compilation error please try the following steps to
      successfully install cryptography:
      1) Upgrade to the latest pip and try again. This will fix errors for most
         users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
      2) Read https://cryptography.io/en/latest/installation/ for specific
         instructions for your platform.
      3) Check our frequently asked questions for more information:
         https://cryptography.io/en/latest/faq/
      4) Ensure you have a recent Rust toolchain installed:
         https://cryptography.io/en/latest/installation/#rust

      Python: 3.8.0
      platform: Windows-10-10.0.19041-SP0
      pip: n/a
      setuptools: 58.2.0
      setuptools_rust: 0.12.1
      =============================DEBUG ASSISTANCE=============================

  ----------------------------------------
  ERROR: Failed cleaning build dir for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
Failed to build cryptography
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 19.2.3, however version 21.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

# upgrade pip
PS C:\WINDOWS\system32> python -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/90/a9/1ea3a69a51dcc679724e3512fc2aa1668999eed59976f749134eb02229c8/pip-21.3-py3-none-any.whl (1.7MB)
     |████████████████████████████████| 1.7MB 6.4MB/s
Installing collected packages: pip
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
Successfully installed pip-21.3

# Successful installation of selenium
PS C:\WINDOWS\system32> pip install selenium
Collecting selenium
  Using cached selenium-4.0.0-py3-none-any.whl (954 kB)
Collecting trio-websocket~=0.9
  Using cached trio_websocket-0.9.2-py3-none-any.whl (16 kB)
Collecting trio~=0.17
  Using cached trio-0.19.0-py3-none-any.whl (356 kB)
Collecting urllib3[secure]~=1.26
  Using cached urllib3-1.26.7-py2.py3-none-any.whl (138 kB)
Collecting cffi>=1.14
  Using cached cffi-1.15.0-cp38-cp38-win_amd64.whl (179 kB)
Collecting idna
  Using cached idna-3.3-py3-none-any.whl (61 kB)
Collecting async-generator>=1.9
  Using cached async_generator-1.10-py3-none-any.whl (18 kB)
Collecting outcome
  Using cached outcome-1.1.0-py2.py3-none-any.whl (9.7 kB)
Collecting attrs>=19.2.0
  Using cached attrs-21.2.0-py2.py3-none-any.whl (53 kB)
Collecting sortedcontainers
  Using cached sortedcontainers-2.4.0-py2.py3-none-any.whl (29 kB)
Collecting sniffio
  Using cached sniffio-1.2.0-py3-none-any.whl (10 kB)
Collecting wsproto>=0.14
  Using cached wsproto-1.0.0-py3-none-any.whl (24 kB)
Collecting certifi
  Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting cryptography>=1.3.4
  Downloading cryptography-35.0.0-cp36-abi3-win_amd64.whl (2.1 MB)
     |████████████████████████████████| 2.1 MB 6.4 MB/s
Collecting pyOpenSSL>=0.14
  Using cached pyOpenSSL-21.0.0-py2.py3-none-any.whl (55 kB)
Collecting pycparser
  Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)
Collecting six>=1.5.2
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting h11<1,>=0.9.0
  Using cached h11-0.12.0-py3-none-any.whl (54 kB)
Installing collected packages: pycparser, cffi, attrs, sortedcontainers, sniffio, six, outcome, idna, h11, cryptography, async-generator, wsproto, urllib3, trio, pyOpenSSL, certifi, trio-websocket, selenium
Successfully installed async-generator-1.10 attrs-21.2.0 certifi-2021.10.8 cffi-1.15.0 cryptography-35.0.0 h11-0.12.0 idna-3.3 outcome-1.1.0 pyOpenSSL-21.0.0 pycparser-2.20 selenium-4.0.0 six-1.16.0 sniffio-1.2.0 sortedcontainers-2.4.0 trio-0.19.0 trio-websocket-0.9.2 urllib3-1.26.7 wsproto-1.0.0

Linux

# this would happen if python-pip module has not been installed
kim@kim-linux:~$ python -m pip install --upgrade pip
/usr/bin/python: No module named pip

# Install pip for Python3
kim@kim-linux:~$ which pip # check whether pip is indeed not installed
kim@kim-linux:~$ sudo apt-get install -y python3-pip

# Installing selenium
kim@kim-linux:~$ pip install selenium
Collecting selenium
  Downloading selenium-4.0.0-py3-none-any.whl (954 kB)
     |████████████████████████████████| 954 kB 21.5 MB/s 
Collecting urllib3[secure]~=1.26
  Downloading urllib3-1.26.7-py2.py3-none-any.whl (138 kB)
     |████████████████████████████████| 138 kB 88.3 MB/s 
Collecting trio-websocket~=0.9
  Downloading trio_websocket-0.9.2-py3-none-any.whl (16 kB)
Collecting trio~=0.17
  Downloading trio-0.19.0-py3-none-any.whl (356 kB)
     |████████████████████████████████| 356 kB 15.3 MB/s 
Collecting pyOpenSSL>=0.14; extra == "secure"
  Downloading pyOpenSSL-21.0.0-py2.py3-none-any.whl (55 kB)
     |████████████████████████████████| 55 kB 8.1 MB/s 
Requirement already satisfied: cryptography>=1.3.4; extra == "secure" in /usr/lib/python3/dist-packages (from urllib3[secure]~=1.26->selenium) (2.8)
Requirement already satisfied: certifi; extra == "secure" in /usr/lib/python3/dist-packages (from urllib3[secure]~=1.26->selenium) (2019.11.28)
Requirement already satisfied: idna>=2.0.0; extra == "secure" in /usr/lib/python3/dist-packages (from urllib3[secure]~=1.26->selenium) (2.8)
Collecting async-generator>=1.10
  Downloading async_generator-1.10-py3-none-any.whl (18 kB)
Collecting wsproto>=0.14
  Downloading wsproto-1.0.0-py3-none-any.whl (24 kB)
Collecting sortedcontainers
  Downloading sortedcontainers-2.4.0-py2.py3-none-any.whl (29 kB)
Collecting attrs>=19.2.0
  Downloading attrs-21.2.0-py2.py3-none-any.whl (53 kB)
     |████████████████████████████████| 53 kB 6.1 MB/s 
Collecting sniffio
  Downloading sniffio-1.2.0-py3-none-any.whl (10 kB)
Collecting outcome
  Downloading outcome-1.1.0-py2.py3-none-any.whl (9.7 kB)
Requirement already satisfied: six>=1.5.2 in /usr/lib/python3/dist-packages (from pyOpenSSL>=0.14; extra == "secure"->urllib3[secure]~=1.26->selenium) (1.14.0)
Collecting h11<1,>=0.9.0
  Downloading h11-0.12.0-py3-none-any.whl (54 kB)
     |████████████████████████████████| 54 kB 9.1 MB/s 
ERROR: pyopenssl 21.0.0 has requirement cryptography>=3.3, but you'll have cryptography 2.8 which is incompatible.
Installing collected packages: pyOpenSSL, urllib3, async-generator, sortedcontainers, attrs, sniffio, outcome, trio, h11, wsproto, trio-websocket, selenium
Successfully installed async-generator-1.10 attrs-21.2.0 h11-0.12.0 outcome-1.1.0 pyOpenSSL-21.0.0 selenium-4.0.0 sniffio-1.2.0 sortedcontainers-2.4.0 trio-0.19.0 trio-websocket-0.9.2 urllib3-1.26.7 wsproto-1.0.0

How To Run Python Interactive Command Line Mode (CLI)

Windows

PS C:\WINDOWS\system32> python
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

Use exit() or Ctrl-Z plus Return to exit
>>> quit
Use quit() or Ctrl-Z plus Return to exit
>>>
KeyboardInterrupt
>>> ^Z

Linux

# This would happen if python hasn't been installed
kim@kim-linux:~$ python
Command 'python' not found, did you mean:
  command 'python3' from deb python3
  command 'python' from deb python-is-python3
# Installing python
kim@kim-linux:~$ sudo apt install python
[sudo] password for kim:          
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'python-is-python2' instead of 'python'
The following NEW packages will be installed:
  python-is-python2
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,496 B of archives.
After this operation, 10.2 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/universe amd64 python-is-python2 all 2.7.17-4 [2,496 B]
Fetched 2,496 B in 0s (8,830 B/s)             
Selecting previously unselected package python-is-python2.
(Reading database ... 386392 files and directories currently installed.)
Preparing to unpack .../python-is-python2_2.7.17-4_all.deb ...
Unpacking python-is-python2 (2.7.17-4) ...
Setting up python-is-python2 (2.7.17-4) ...

# Enter python interactive mode
kim@kim-linux:~$ python
Python 2.7.18 (default, Mar  8 2021, 13:02:45) 
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> Ctrl+ D # exit python environment
kim@kim-linux:~$

Disable and Enable Sleep Mode on a Linux Workstation

The following commands would work on any Linux machine with SystemD (Ubuntu, Linux Mint, Redhat, Fedora, etc.)

# Disable Sleep
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

# Output sample:
kim@kim-linux:~$ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
[sudo] password for kim:
Created symlink /etc/systemd/system/sleep.target → /dev/null.
Created symlink /etc/systemd/system/suspend.target → /dev/null.
Created symlink /etc/systemd/system/hibernate.target → /dev/null.
Created symlink /etc/systemd/system/hybrid-sleep.target → /dev/null

# Enable Sleep
sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target

# Output Sample:
kim@kim-linux:~$ sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target
Removed /etc/systemd/system/sleep.target.
Removed /etc/systemd/system/suspend.target.
Removed /etc/systemd/system/hibernate.target.
Removed /etc/systemd/system/hybrid-sleep.target.

Linux SMB Mount via Command Line Bash Shell

  1. Install smbfs to include these functions
    1. smbmount
    2. smbunmount
  2. Here is a demonstration of smbmount to mount an SMB share called “testshare” from a machine called “smbserver”:
    [root@linux1]# smbmount "\\\\smbserver\\testshare" -U username -c 'mount /testshare -u 500 -g 100' Added interface ip=192.168.0.11 bcast=192.168.255.255 nmask=255.255.0.0 Got a positive name query response from 192.168.1.11 ( 192.168.1.11 ) Password: ************* Domain=[KIMCONNECT] OS=[Unix] Server=[Samba 2.0.3] security=user
  3. Check the mounts
    root@linux1]# mount                                                                                                    
    /dev/hda2 on / type ext2 (rw)
    none on /proc type proc (rw)
    none on /dev/pts type devpts (rw,mode=622)
    //smbserver/testshare on /testshare type smbfs (0)

Linux: How To Repair Corrupted Zip File

kimconnect@linuxbox:/media/data/newPhotos $ zip -FF corrupted.zip --out fixed.zip

Fix archive (-FF) - salvage what can
	zip warning: Missing end (EOCDR) signature - either this archive
                     is not readable or the end is damaged
Is this a single-disk archive?  (y/n): y
  Assuming single-disk archive
Scanning for entries...
 copying: IMG_1432.jpg  (9931009 bytes)
 copying: IMG_1433.jpg  (8932163 bytes)
 copying: IMG_1434.jpg  (8586891 bytes)
 copying: IMG_1435.jpg  (9703556 bytes)
 copying: IMG_1436.jpg  (10764218 bytes)
 copying: IMG_1437.jpg  (9423911 bytes)
 copying: IMG_1439.jpg  (10689551 bytes)
 copying: IMG_1440.jpg  (10562950 bytes)
 copying: IMG_1441.jpg  (9531534 bytes)
 copying: IMG_1442.jpg  (10681506 bytes)
 copying: IMG_1443.jpg  (10603245 bytes)
 copying: IMG_1444.jpg  (10641268 bytes)
 copying: IMG_1445.jpg  (10773751 bytes)
 copying: IMG_1446.jpg  (10251277 bytes)
 copying: IMG_1447.jpg  (8875128 bytes)
 copying: IMG_1448.jpg  (11836407 bytes)
 copying: IMG_1449.jpg  (7532016 bytes)
 copying: IMG_1450.jpg  (8242273 bytes)
 copying: IMG_1453.jpg  (10231604 bytes)
 copying: IMG_1454.jpg  (10158118 bytes)
 copying: IMG_1455.jpg  (10365642 bytes)
 copying: IMG_1456.jpg  (9608581 bytes)
 copying: IMG_1457.jpg  (9257520 bytes)
 copying: IMG_1458.jpg  (10370496 bytes)

Linux: Copy File Contents Into Clipboard

Install XCLIP (if not already installed)

sudo apt install xclip -y

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  xclip
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 18.4 kB of archives.
After this operation, 60.4 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/universe amd64 xclip amd64 0.13-1 [18.4 kB]
Fetched 18.4 kB in 0s (44.5 kB/s)
Selecting previously unselected package xclip.
(Reading database ... 386347 files and directories currently installed.)
Preparing to unpack .../xclip_0.13-1_amd64.deb ...
Unpacking xclip (0.13-1) ...
Setting up xclip (0.13-1) ...
Processing triggers for man-db (2.9.1-1) ...

Yank Contents of a File

xclip -sel c < simple-lightbox.js

How to Use ImageMagic to Resize Images

Converting PNG to JPG (optimized):

# This is an optimized resizing command to convert PNG to JPG with minimal loss of image quality
outputPath=./resized
size=1200 # width
mkdir $outputPath
originalFormat=png
newFormat=jpg
mogrify -path $outputPath -format $newFormat -resize $size -filter Triangle -define filter:support=2 -unsharp 0.25x0.25+8+0.065 -dither None -posterize 136 -quality 82 -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace none -colorspace sRGB -strip *.$originalFormat

Resizing JPG & PNG Files On First-level Child Folders

# Set image sizing variables
size=2475x1650
newFormat=jpg

# Look into current directory for any folders, then create a sub-folder named 'resized'. Afterward, trigger the command to resize any jpg or png images to be dumped into the 'resized' sub-folders of each directory

for d in */ ; do
    [ -L "${d%/}" ] && continue; # skip sym-links
    outputPath=$(echo "$d""resized");
    mkdir $outputPath;
    mogrify -path $outputPath -format $newFormat -resize "$size"">" -filter Triangle -define filter:support=2 -unsharp 0.25x0.25+8+0.065 -dither None -posterize 136 -quality 82 -define jpeg:fancy-upsampling=off -define -interlace none -colorspace sRGB -strip $d*.{jpg,JPG,png,PNG};
done

Resizing JPG Files (Optimized):

# This is an optimized resizing command to convert PNG to JPG with minimal loss of image quality
outputPath=./resized
size=2400x1600 # height x width
mkdir $outputPath
originalFormat=jpg
newFormat=jpg
mogrify -path $outputPath -format $newFormat -resize $size -filter Triangle -define filter:support=2 -unsharp 0.25x0.25+8+0.065 -dither None -posterize 136 -quality 82 -define jpeg:fancy-upsampling=off -define -interlace none -colorspace sRGB -strip *.$originalFormat

Resizing JPG Files:

# This command would pickup all PNG images of current directory and create resized versions of them in the ./resized folder
mkdir ./resized
mogrify -path ./resized -resize 1200 *.jpg

Resize All and Only Images In a Directory, Including Sub-Directories

path=./
size=2400x1600

find $path -type f -exec file \{\} \; | awk -F: '{if ($2 ~/image/) print $1}' \
| while IFS= read -r imageFile; do \
    mogrify -resize $size\> "$imageFile"; \
  done

This would happen if the resized directory doesn’t exist

kim@kim-linux:~$ cd ~
kim@kim-linux:/Scans$ mogrify -path ./resized -resize 1200 *.png 
mogrify-im6.q16: unable to open image `./resized//Military-Payment-Certificate-One-Dollar-Series-661-Backside.png': No such file or directory @ error/blob.c/OpenBlob/2874.
mogrify-im6.q16: WriteBlob Failed `./resized//Military-Payment-Certificate-One-Dollar-Series-661-Backside.png' @ error/png.c/MagickPNGErrorHandler/1641.

Uhhuh. NMI received for unknown reason 3d on CPU 4

Problem:

Message from syslogd@linux03 at Aug 31 04:28:21 ...
 kernel:[273033.123489] Uhhuh. NMI received for unknown reason 3d on CPU 4.

Message from syslogd@linux03 at Aug 31 04:28:21 ...
 kernel:[273033.123491] Do you have a strange power saving mode enabled?

Message from syslogd@linux03 at Aug 31 04:28:21 ...
 kernel:[273033.123491] Dazed and confused, but trying to continue

Solution: nothing… Error seems transient.

Ping Command’s First Packet Toward LDAP Server(s) Takes 2 Seconds to Start

Case 1: Are DNS servers working?
  • dig returns results right away => defined dns servers are working
  • dig returns results with a 2+ seconds delay or timeout => defined dns servers are NOT working

Recommendations:

  1. Test configuring client to use a different DNS server
    dig @dnsServer1.kimconnect.com ldapServerName
  2. Verify that routing and firewall rules are passing traffic from client to DNS servers
  3. Cleanup invalid DNS records in AD
Case 2: Is localhost able to cache hardware address?
  • apr -a command returns results right away, and the ldap server IP mac address is present => ARP is working fine
  • apr -a command takes awhile to populate => indication that localhost arp table is having issues, so it’s not caching mac to ip for fast lookups

Recommendations:

a. Add a static arp entry into localhost

Command:

arp -s ip-address-of-ldap-server hardware-address-of-ldap-server
# Example:
sudo arp -s 10.10.10.10 aa:11:bb:22:cc:44

# How to reverse the change:
sudo arp --delete 10.10.10.10

# How to check the ARP Table:
sudo arp -avn # more verbose
sudo arp -n # simple view

b. Clear ARP cash & DNS cache

ip -s -s neigh flush all
arp -n
service nscd restart