Last active
November 29, 2025 10:27
-
-
Save headersalreadysent/aea785ad09b5542c2bd26b2534f62237 to your computer and use it in GitHub Desktop.
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
| #!/bin/bash | |
| #screen alias | |
| alias ls='ls -alhS --color' | |
| alias screen-new='screen -S' | |
| alias screen-list='screen -ls' | |
| alias screen-attach='screen -r' | |
| alias screen-reconnect='screen -d -r' | |
| alias screen-kill='screen -X quit' | |
| alias screen-kill-by-name='screen -S' | |
| alias screen-reconnect-or-new='screen -d -r || screen -S' | |
| #docker alias | |
| alias dcud='docker compose up -d' | |
| alias dcudu='docker compose up -d --pull always --remove-orphans' | |
| alias dnano='nano docker-compose.yml && docker compose up -d' | |
| alias ctop="ctop -a -s cpu" | |
| dbash() { | |
| local container="$1" | |
| if [ -z "$container" ]; then | |
| echo "Usage: dbash <container_name>" | |
| return 1 | |
| fi | |
| docker exec -it "$container" bash | |
| } | |
| dlog() { | |
| local container="$1" | |
| if [ -z "$container" ]; then | |
| echo "Usage: dlog <container_name>" | |
| return 1 | |
| fi | |
| docker logs -ft -n 50 "$container" bash | |
| } | |
| renice_container() { | |
| local cname="$1" | |
| local nice_value="$2" | |
| if [[ -z "$cname" || -z "$nice_value" ]]; then | |
| echo "Kullanım: renice_container <container_adı> <nice_değeri>" | |
| return 1 | |
| fi | |
| # Container'ın ana PID'sini bul | |
| local cpid | |
| cpid=$(docker inspect --format '{{.State.Pid}}' "$cname") | |
| if [[ -z "$cpid" || "$cpid" == "0" ]]; then | |
| echo "Container bulunamadı veya çalışmıyor." | |
| return 2 | |
| fi | |
| # renice uygula | |
| sudo renice -n "$nice_value" -p "$cpid" | |
| } | |
| renice_search() { | |
| local keyword="$1" | |
| local nice_value="$2" | |
| if [[ -z "$keyword" || -z "$nice_value" ]]; then | |
| echo "Kullanım: renice_search <arama_kelimesi> <nice_değeri>" | |
| return 1 | |
| fi | |
| # Arama kelimesini içeren process PID'lerini bul | |
| local pids | |
| pids=$(ps aux | grep "$keyword" | grep -v "grep" | awk '{print $2}') | |
| if [[ -z "$pids" ]]; then | |
| echo "Process bulunamadı." | |
| return 2 | |
| fi | |
| # Her PID için nice değerini değiştir | |
| for pid in $pids; do | |
| echo "Process: $pid ($keyword) için nice değeri $nice_value olarak ayarlanıyor..." | |
| sudo renice -n "$nice_value" -p "$pid" | |
| done | |
| } | |
| #filesystem | |
| alias dush='sudo du -hs ./* | sort -h' | |
| watcher() { | |
| local target="${1:-.}" | |
| while true; do | |
| local size=$(du -sh "$target" 2>/dev/null | cut -f1) | |
| local count=$(find "$target" -type f 2>/dev/null | wc -l) | |
| local latest=$(find "$target" -type f -printf '%T@ %p\n' 2>/dev/null | sort -n | tail -1 | cut -d' ' -f2-) | |
| printf "\rSize: %s | Files: %d | Latest: %s" "$size" "$count" "${latest:-N/A}" | |
| sleep 1 | |
| done | |
| } | |
| #helper | |
| alias bashrc='nano ~/.bashrc && source ~/.bashrc' | |
| alias helperUpdate='git clone https://gist.github.com/aea785ad09b5542c2bd26b2534f62237.git /tmp/gist_tmp && cp /tmp/gist_tmp/bashHelper.sh ~/bashHelper.sh && rm -rf /tmp/gist_tmp && source ~/.bashrc' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment