Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .bash_aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
alias bashconfig='$EDITOR ~/.bashrc'
alias ll='ls -alF --color=auto'
alias la='ls -A --color=auto'
alias l='ls -CF --color=auto'

alias vim='nvim'

# alias ls='eza -al --color=always --group-directories-first' # my preferred listing
# alias la='eza -a --color=always --group-directories-first' # all files and dirs
# alias ll='eza -l --color=always --group-directories-first' # long format
# alias lt='eza -aT --color=always --group-directories-first' # tree listing
# alias l.='eza -a | egrep "^\."'

# Colorize grep output (good for log files)
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'

alias df='df -h' # Human-readable sizes
alias free='free -m' # Display memory in MBs

alias psa='ps auxf'
alias psgrep='ps aux | grep -v grep | grep -i -e VSZ -e'
alias psmem='ps auxf | sort -nr -k 4'
alias pscpu='ps auxf | sort -nr -k 3'

alias tb='nc termbin.com 9999'
37 changes: 37 additions & 0 deletions .bash_functions
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
ex() {
if [ -f "$1" ]; then
case $1 in
*.tar.bz2 | *.tbz2) tar xjf "$1" ;;
*.tar.gz | *.tgz) tar xzf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.rar) unrar x "$1" ;;
*.gz) gunzip "$1" ;;
*.tar) tar xf "$1" ;;
*.zip) unzip "$1" ;;
*.Z) uncompress "$1" ;;
*.7z) 7z x "$1" ;;
*.deb) ar x "$1" ;;
*.tar.xz) tar xf "$1" ;;
*.tar.zst) unzstd "$1" ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}

download() {
local url="$1"
local output_file="$2"

if [ -z "$output_file" ]; then
output_file=$(basename "$url")
fi

if command -v wget &>/dev/null; then
wget -q --show-progress --progress=bar:force --no-check-certificate -O "$output_file" "$url" 2>&1
else
echo "Error: wget not found. Please install wget to use this function." >&2
return 1
fi
}
57 changes: 57 additions & 0 deletions .bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# If not running interactively, don't do anything
[[ $- != *i* ]] && return

# Enable shell options
shopt -s autocd # Change to named directory
shopt -s cdspell # Autocorrect cd misspellings
shopt -s cmdhist # Save multi-line commands in history as single line
shopt -s dotglob # Include hidden files in globs
shopt -s histappend # Do not overwrite history
shopt -s expand_aliases # Expand aliases
shopt -s checkwinsize # Check terminal size when bash regains control

# Export settings
export TERM="xterm-256color"
export HISTCONTROL=ignoredups:erasedups # No duplicate entries
export PATH="$HOME/.bin:$HOME/.local/bin:$PATH"


# Set default editor based on availability
if command -v nvim &>/dev/null; then
export EDITOR='nvim'
elif command -v vim &>/dev/null; then
export EDITOR='vim'
else
export EDITOR='nano'
fi

# Set terminal title
case ${TERM} in
xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|alacritty|st|konsole*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"'
;;
screen*)
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"'
;;
esac

# Load bash functions
if [ -f ~/.bash_functions ]; then
. ~/.bash_functions
fi

# Load bash aliases
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi


# Load zoxide if installed
if command -v zoxide &>/dev/null; then
eval "$(zoxide init bash)"
fi

# Load starship if installed
if command -v starship &>/dev/null; then
eval "$(starship init bash)"
fi
2 changes: 2 additions & 0 deletions .vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set nocp
set backspace=indent,eol,start
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# dotfiles

to be updated soon.