Bash to Powershell Commands
These are just some common bash commands I use and a Powershell equivalent.
| Bash | PowerShell |
| touch filename.txt | echo $null >> filename |
| nano filename.txt | bash -c “nano filename.txt” |
| Ssh key location | cd ~.ssh| |
| Disable root | $ sudo vim /etc/passwd Change the line: root:x:0:0:root:/root:/bin/bashTo ==----------------------------'/ root:x:0:0:root:/root:/sbin/nologin |
| Diable root in single command for cloud-init | sudo sed -i 's/root:x:0:0:root:/root:/bin/bash/root:x:0:0:root:/root:/sbin/nologin/g' /etc/passwd |
| Copy to clip board | cat |
| Un-stashing in git | Git stash pop |
| Gzip | compress-archive -path 'c:\wwwroot\logs' -destinationpath '.\logs.zip' -compressionlevel optimal |