Skip to content

Instantly share code, notes, and snippets.

@disulfidebond
Created August 30, 2018 23:08
Show Gist options
  • Save disulfidebond/02ca21dae79bc36242ba3ed938126355 to your computer and use it in GitHub Desktop.
Save disulfidebond/02ca21dae79bc36242ba3ed938126355 to your computer and use it in GitHub Desktop.
bash profile with comments
# standard bash profile
# segments borrowed from stephnell on Github
# PATH
# You need to have this line of code. It sets up your Bash $PATH, which is the file that directs Bash how to run programs
# the syntax is:
# export -> this tells Bash to set up PATH with the following values:
# PATH= -> this tells Bash to assign whatever your type next to the PATH variable
# $PATH: -> this is *very* important--it tells Bash not to throw away what was in your PATH already,
# # but to append to it instead. If you leave this out, your Bash shell may not work!
# the full command will look like this
export PATH="$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
# you can add additional options or locations to your $PATH like this using the same format as above
# remember, this will keep appending to your PATH
export "PATH=$PATH:/opt"
# Optional parameters
# These are optional to include, but usually make things run smoother.
export BLOCKSIZE=1k
# Aliases and shortcuts
alias ls='ls -Gp'
# this will tell bash to colorize output, if it can, and format directories in an easier-to-read way
# NOTE: this will replace the existing command 'ls', which is possible, but always be very careful when doing so.
alias ll='ls -FGlAhp'
# this will add the command 'll', which will provide more information
cd() { builtin cd "$@"; ll; } # cd and show contents of directory
# this tells Bash that when you type 'cd', also list the directory contents. You may or may not want this.
zipf () { zip -r "$1".zip "$1" ; }
# this simplifies using the zip commeand
alias qfind="find . -name "
# this is a little more advanced.
# It tells bash that when you run the command "qfind" it will automatically run the 'find' command with the options of searching by name
# In other words:
# qfind somefile
# Bash runs the command "find . -name " somefile
alias dhogal="ssh ${USER}@dhogal2.pathology.wisc.edu"
# this is a useful template for creating SSH shortcuts
# this will tell bash that when you type 'dhogal' followed by return, the following happens in this order:
# 1) bash looks up the value for $USER , which is a value that is built-in: it equals your username for the login on this computer
# # for example, let's say your login was 'gradstudent'
# 2) bash runs the command 'ssh [email protected]'
# # NOTE: If you do not have an account on the remote computer dhogal2.pathology.wisc.edu this command will fail!
# # But you can replace dhogal2.pathology.wisc.edu with another computer name
# Other Items
# sometimes a program may add a line to your bash_profile or bashrc file.
# As long as you ok'd the program to do this, it's nothing to worry about, but if you see something that you don't recognize, it's a good idea to delete it.
# Here is an example with Docker:
# docker-machine env setup
# eval $(docker-machine env)
# You can also build in other commands. Here is an example of creating a custom timestamp command
# To see how this works, comment out the 3 lines after the "timestamp command" line below , then open a new Terminal
# # and type "date" followed by return
# # then type "timestamp" followed by return. You should see an error after you type this, because you haven't told Bash what that command means.
# # Finally, uncomment the 3 lines that you commented out, open a new Terminal, and type "timestamp" followed by return
# timestamp command
timestamp() {
date +"%T"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment