Skip to content

Instantly share code, notes, and snippets.

@RFullum
Last active August 17, 2023 15:11
Show Gist options
  • Save RFullum/d29c675b0e1c99f5df4aff069a9ff5af to your computer and use it in GitHub Desktop.
Save RFullum/d29c675b0e1c99f5df4aff069a9ff5af to your computer and use it in GitHub Desktop.
.bash_profile .bashrc custom functions
Just a collection of functions i add to my .bash_profile (mac) and .bashrc (linux) on almost every device i have.
# Simultaneously create and switch to new directory
function mkcd () { mkdir -p "$@" && cd "$@"; }
# Simultaneously change into directory and list files
function cdls () { cd "$@" && ls -ah "."; }
# Repleace spaces in filenames in a directory with an underscore
function repspace () { find . -type f -name "* *" -exec bash -c 'mv "$0" "${0// /_}"' {} ";" ; }
# Prompt
export PS1="\[\033[1;31m\]\u:\W$\[\033[0m\] "
# Add my ~/Scripts folder to PATH
export PATH=$PATH:$HOME/Scripts
# My aliases
alias aptUpgrade="sudo apt update && sudo apt upgrade && sudo apt autoclean"
alias aptUpdate="aptUpgrade"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment