Last active
May 10, 2025 16:09
-
-
Save asmyshlyaev177/7302d6e9bae2f55ecfc984e5bd77ee0a to your computer and use it in GitHub Desktop.
Linux stuff
This file contains hidden or 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
# Command to get program on port, use `ports 3000`, put in `~/.bashrc` or `~/.zshrc` | |
alias ports='ports(){ lsof -ti:$1;}; ports' | |
# kill program on port | |
ports | xargs kill -9 | |
# run program from another linux distribution, e.g. Playwright on Fedora | |
# create container | |
distrobox create --pull -i mcr.microsoft.com/playwright:v1.48.1-noble --name ubuntu | |
# enter container | |
distrobox enter ubuntu-22-04 | |
# exit | |
exit | |
# stop container | |
distrobox stop ubuntu -Y | |
# process by memory usage | |
ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 30 | |
# or better | |
ps aux | awk '{print int($6/1024) "\t" $11}' | sort -k2rn | datamash -s -W groupby 2 sum 1 | sort -k2rn | xargs -n2 printf "%-60s%s\n" | head -n 25 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment