Skip to content

Instantly share code, notes, and snippets.

@nityanandmathur
Last active September 8, 2024 11:19
Show Gist options
  • Save nityanandmathur/5fa9ad41da7540a5c447a22f92b2db1c to your computer and use it in GitHub Desktop.
Save nityanandmathur/5fa9ad41da7540a5c447a22f92b2db1c to your computer and use it in GitHub Desktop.
Custom aliases for .bashrc file for smooth operation

List files aliases

alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
list() {
    total=0
    printf "%-50s %s\n" "Directory" "Count"
    for d in ./*; do
        if [ -d "$d" ]; then
            count=$(find "$d" -type f | wc -l)
            printf "%-50s %s\n" "$d" "$count"
            total=$((total + count))
        fi
    done
    printf "%-50s\n" "------------------------------------"
    printf "%-50s %s\n" "Total" "$total"
}

GPUstat aliases

alias gs='gpustat'
alias wgs='watch -d gpustat'

TMUX aliases

alias tls='tmux ls'
ta() {
    tmux attach -t "$1"
}

DU Alias

alias dus='du -sh * | sort -hr'

Folder Alias

alias <name>='<path to folder>'

Activating Conda Envs

alias ca<letter>='conda activate <env>'

Looking for Git Branch

git_branch() { 
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' 
}

Minimal profile with Git Branch

export PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u:\[\033[01;34m\]\w\[\033[00m\] \$(git_branch)\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment