Last active
May 3, 2024 10:52
-
-
Save Sysa/0fb41f97dd0488c672f840255e3bee47 to your computer and use it in GitHub Desktop.
linux/unix cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
disk usage (https://superuser.com/a/1573074/619805): | |
sudo du -hsx /* | sort -rh | head -n 40 | |
du -schx .[!.]* * | sort -h | |
get proc envs: | |
sudo cat /proc/803/environ | xargs -0 env -i | |
get public IP from CLI: | |
dig +short myip.opendns.com @resolver1.opendns.com | |
------ | |
ssh tunnels (with -L but with key auth): | |
`~/.ssh/config`: | |
Host computeinstance | |
HostName 20.22.222.222 | |
User azureuser | |
Port 50001 | |
IdentityFile ~/.ssh/id_rsa | |
ForwardAgent yes | |
LocalForward 6006 127.0.0.1:6006 | |
check active tunnels: | |
`lsof -i -n | egrep '\<ssh\>'` | |
--- | |
bash check port: | |
$ timeout 2 bash -c "</dev/tcp/HOST.com/80"; echo $? | |
0 -> means good | |
127 -> bad, port closed/firewall/vNet | |
124 -> port reachable but closed/disabled | |
macOS time shift: | |
sudo sntp -sS pool.ntp.org | |
Get amout of lines in the codebase: | |
find . -name '*.py' -o -name '*.tf' -o -name '*.yaml' -o -name '*.yml' | xargs wc -l | |
if you need an indicator of consumed space in your compute instance while dockering: | |
watch -n5.5 --no-title "df -h | head -2 | grep -o '.\{5\}$'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment