Last active
May 8, 2023 14:28
-
-
Save nutrino/02fb597826cb0d8a6cf1c00c3815ade1 to your computer and use it in GitHub Desktop.
Linux useful scripts
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
| # https://news.hada.io/topic?id=7286 | |
| alias df='df -h -x tmpfs -x devtmpfs -x squashfs' | |
| alias xc='xclip -sel clipboard' | |
| alias ttfb='curl -so /dev/null -w "HTTP %{http_version} %{http_code} Remote IP: %{remote_ip}\nConnect: %{time_connect}\nTTFB: %{time_starttransfer}\nTotal time: %{time_total}\nDownload speed: %{speed_download}bps\nBytes: %{size_download}\n"' | |
| ap() { | |
| https $@ Accept:application/activity+json | |
| } | |
| shodan() { | |
| xdg-open https://shodan.io/domain/$1 | |
| dig +short $1 | xargs -i xdg-open https://shodan.io/host/{} | |
| } | |
| check_mtu() { | |
| local target=$1 | |
| shift | |
| local lower=0 | |
| local upper=1500 | |
| until [[ $((lower + 1)) -eq $upper ]]; do | |
| current=$(((lower + upper) / 2)) | |
| echo -n "lower: $lower, upper: $upper, testing: $current -- " | |
| if ping -M do -s $current -c 2 -i 0.2 $target $@ &>/dev/null; then | |
| echo "ok" | |
| lower=$current | |
| else | |
| echo "fail" | |
| upper=$current | |
| fi | |
| done | |
| echo "max packet size: $lower, mtu: $((lower + 28))" | |
| } | |
| # https://news.hada.io/topic?id=9118 | |
| killport() { | |
| if [ $# -ne 0 ]; then | |
| for port in "$@"; do | |
| pids=$(lsof -ti ":$port") | |
| if [ -n "$pids" ]; then | |
| echo "Processes listening on port $port: $pids" | |
| echo "$pids" | xargs kill -9 >/dev/null 2>&1 | |
| echo "Processes listening on port $port have been terminated" | |
| else | |
| echo "No process found listening on port $port" | |
| fi | |
| done | |
| else | |
| echo "No arguments provided" | |
| fi | |
| } |
Author
Author
change wayland to X11
rustdesk/rustdesk#670
sudo nano /etc/gdm3/custom.conf
Author
systemctl status display-manager.service
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
script -c "ls --color=auto" output.txt