Last active
March 3, 2020 14:44
-
-
Save gpspake/0370fc4a99963e36249895b4b07ff4c6 to your computer and use it in GitHub Desktop.
DevMemphis Command Line Talk
This file contains 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
# in osx terminal | |
echo Hello # echo string | |
echo ${SHELL} # echo shell (zsh is the default shell in OSX) | |
# switch to iterm2 https://iterm2.com/ | |
echo ${SHELL} # still zsh | |
pwd # print working directory | |
ls # list | |
cd Desktop | |
pwd | |
ls | |
mkdir hello # create a folder (show in finder) | |
touch hello/world.txt # show in finder | |
man ls # man is short for manual | |
ls -l -a | |
ls -la # multiple flags can be combined | |
pwd | |
cd . # change in to same directory | |
pwd | |
cd .. # cd back to parent directory | |
pwd # notice directory in prompt | |
cd Desktop | |
cd ~ | |
cd Desktop | |
cd | |
cd /Users/George # 4 different ways to cd to home directory | |
cd ${HOME} | |
cd / # root | |
cd | |
# I've been typing ls -la a lot so let's make an alias for it | |
alias gs='ls -la' # create alias for a command | |
alias gs # check alias | |
gs # use alias | |
# close / re-open terminal | |
gs | |
alias gs # the alias is gone | |
echo 'alias gs="ls -la"' >> .my_profile # write alias to a file | |
cat .my_profile # check file (cat is short for concatenate) | |
gs | |
alias gs | |
source .my_profile # we need to source the file first | |
alias gs | |
gs | |
# close / re-open terminal | |
gs | |
alias gs # .my_profile does not get sourced automatically | |
echo $SHELL | |
cat .zshrc # this file is sourced each session | |
echo 'alias gs="ls -la"' >> .zshrc | |
alias gs | |
# close / re-open terminal | |
alias gs | |
gs | |
# install oh-my-zsh | |
# https://ohmyz.sh/ | |
# add plugin | |
# https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins | |
mkdir -p ~/.oh-my-zsh/custom/plugins/devmemphis | |
vim ~/.oh-my-zsh/custom/plugins/devmemphis/gpspake.plugin.zsh # alias gs="ls -la", # echo "Sourcing devmemphis plugin" | |
# add plugin to .zshrc | |
# close / re-open terminal | |
# see echo | |
alias gs # still there | |
# add zshedit and zshsource aliases | |
alias zshedit='vim ~/.oh-my-zsh/gpspake/gpspake.plugin.zsh' # edit zsh | |
alias zshsource='source ~/.oh-my-zsh/gpspake/gpspake.plugin.zsh' # source zsh after editing | |
# export zsh path | |
export ZSH_PLUGIN_PATH="${HOME}/.oh-my-zsh/gpspake/gpspake.plugin.zsh" | |
alias zshedit='vim ${ZSH_PLUGIN_PATH}' # edit zsh | |
alias zshsource='source ${ZSH_PLUGIN_PATH}' # source zsh after editing | |
# move zsh plugin to code/dotfiles and symlink | |
mkdir code/dotfiles/.zsh | |
echo ${ZSH_PLUGIN_PATH} # verify that variable we have exported | |
mv ${ZSH_PLUGIN_PATH} ~/code/dotfiles/.zsh | |
# create symlink | |
ln -ls ~/.zsh ~/code/dotfiles/.zsh | |
ls -la # see symlink | |
# pull code/dotfiles from github and symlink | |
rm ~/.zsh # remove the .zsh directory | |
rmdir ~/code/dotfiles # remove the dotfiles directory | |
cd ~/code | |
git clone git@github.com:gpspake/dotfiles.git | |
# recreate symlink | |
# use up arrow | |
# use ctrl+r ln # ln -ls ~/.zsh ~/code/dotfiles/.zsh | |
# close / re-open terminal | |
alias zshedit # cool | |
# exit vim | |
ln -ls ~/.zsh ~/code/dotfiles/.zsh | |
# reset everything | |
# pull down | |
# run script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment