Shell 命令合集
在 macOS 上使用 Touch ID 进行 sudo 认证
sed "s/^#auth/auth/" /etc/pam.d/sudo_local.template | sudo tee /etc/pam.d/sudo_local
修改 Windows 的默认 OpenSSH 服务的登陆 shell
$NewItemPropertyParams = @{
Path = "HKLM:\SOFTWARE\OpenSSH"
Name = "DefaultShell"
Value = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
PropertyType = "String"
Force = $true
}
New-ItemProperty @NewItemPropertyParams
开启 Windows 公钥登陆
$keys = Invoke-RestMethod -Uri https://github.com/waterlens.keys -Method Get
Add-Content -Force -Path $env:ProgramData\ssh\administrators_authorized_keys -Value $keys
icacls.exe "$env:ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"
使用 fd 查找包含特定后缀(如 .h, .hpp)文件的文件夹,并进行去重
fd -e h -e hpp -e inc -x echo {//} | sort -u