Assign a value to a variable and show it on output $ someVar = “hello world!” $ echo $someVar Assign a command into a variable and run it $ someVar = “ps -a” $ $someVar (runs the command contained in the string) Find command’s actual path which ls –> shows /usr/bin/ls […]
Month: July 2022
Powershell Core reference and handy stuff
Note: “$_” is used to refer to the “current object” which is passed to foreach in the loop. And $_.name is the “name” property of the current object in the loop. Use a list of item PIPED to a bash command – Echo $list_of_items | xargs -L1 bash -c ‘<some bash command’ Example: az group […]
Ubuntu Linux – Handy stuff
Update all packaged : $ sudo apt-get update Upgrade all packages: $ sudo apt-get upgrade What’s my Machine name and Linux Version $ > hostname $ > cat /etc/os-release What’s my Private IP $ > hostname -i $ > hostname -I |'{print $1}’ $ > ip route get 1.2.3.4 | awk ‘{print $7}’ What’s my […]