Skip to main content

Bash Alias Setup

Whenever you type a long command on the command line, do you often find yourself searching for a command that you previously typed in the bash history? You'll appreciate bash aliases if you answered yes to any of those questions. You can use bash aliases to create a short-term shortcut command that will represent a longer command in a memorable way. It is important to realize that Bash aliases are essentially shortcuts that can save you time in the command line, since they can reduce the amount of typing required to remember long commands. For example, you could use the alias tgz as a shortcut for the tar -xvfz command when working on the command line.

mac file location

.bash_profile

Oh-my-zsh

.zshrc

to refresh after changes

source ~/.bash_profile

show ll in testa file

grep ll testa

does not contain ll in testa file

grep -v ll testa

show with line number -n flag

grep -n ll testa

list file name contains current work directory

grep -l ll *

list file name contains current work directory - ignore case sensitive

grep -i ll *

count number of ll in each file in cwd

grep -c ll *

add line number each line of testa file

grep -n '^' testa