saving time on the command-line
[C-a]
beginning of the line[C-e]
end of the line[C-b]
back one character[C-f]
forward one character[A-b]
back one word (Configure alt to +ESC in iterm profile)[A-f]
forward one word[C-u]
delete to beginning of line[C-w]
delete word[C-y]
paste[A-d]
delete word in front$_
or [ESC].
vim ~/.bashrc
source $_
ls ~/workspace/lumos_rails/config/
cat $_/[TAB]file.txt
^replace^word
memroy show production lumosity
-bash: memroy: command not found
^ro^or
memory show production lumosity
...
command subtitution: $(cmd)
, `cmd`
xargs
VAR=`ls`
echo $VAR
seq 1 10
for n in `seq 1 10`; do echo "loop $n"; done;
!!
, ![NUMBER]
vim /etc/hosts
[readonly]
sudo !!
which memory
/Users/mleung/bin/memory
vim `!!`
Curly Brace Expansion
cp /etc/hosts{,.bak}
sudo !! # <-- see what i did thar
touch ~/workspace/long_filename_with_bad_file_extensiont.xt
mv ~/workspace/long_filename_with_bad_file_extension{t.xt,.txt}
reverse-i-search [C-r]
cd -
[~] cd ~/workspace/
[~/workspace] cd -
/Users/mleung
[~]
[C-x][C-e]
(in-terminal editor only)
for f in `ls ~`; do [C-x][C-e]
echo "file: $f";
done;
[C-z]
, fg
vim some_script.rb
[C-z]
ruby some_script.rb
fg
alias lock='/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend'
alias git=hub
hub
alias ls='ls -F'
Better cd
. Find yourself running cd; ls
all the time?
~/.bashrc
:c() { cd "$@" && ls; }
alias hgrep="history | grep -i"
![NUMBER]
~/.bashrc
:export HISTSIZE=500000
export HISTFILESIZE=100000
export HISTIGNORE="&:exit:bg:fg:clear"
export HISTTIMEFORMAT="%m/%d/%y %T "
export HISTCONTROL=ignoreboth:erasedups # ignore commands starting with a space, and ignore duplicates
Get current branch
~/.bashrc
:alias tgb='git symbolic-ref --short HEAD'
gpo `tgb`
My git aliases
~/.bashrc
:alias pull="git pull origin"
alias gb="git branch"
alias gl="git log"
alias glp="git log -p"
alias gs="git status"
alias gc="git commit -m"
alias ga="git add"
alias gck="git checkout"
alias gd="git diff"
alias gdc="git diff --cached"
pbcopy
, pbpaste
(mac exclusive)
STDIN
into your clipboard / pastes your clipboardgrep alias ~/.bashrc | pbcopy
pbpaste > /tmp/my_aliases
pbpaste | wc -l
watch
gem install iStats # <-- capital S
istats all --no-graphs
watch -n1 !!
hub
git
brew install hub
hub
over git
git clone lumoslabs/knife_memory
git checkout -b test_hub_command
echo "test" > TEST
git add TEST
git commit -m 'Testing hub'
git push origin `tgb`
git browse
git pull-request
curl ifconfig.co
htop
top
brew install htop
reset
[32605:mleung-mbp][~] cat /sbin/* # <-- for whatever reason I can only reproduce in terminal
s7???b4Y6)??E????F?.??ö?å;f?N???̡?;????"?q-s?*j??zr?Ä??Å??bäh&?6??YgÅ"?
??Dg???-ö6?? ??.)?掲å?Ä?ÅV?3?fÄ32605:mleung-mbpÅÄüÅ 1;2c
Ä32605:mleung-mbpÅÄüÅ reset