Skip to content

Instantly share code, notes, and snippets.

@yzdann
Last active October 1, 2019 15:28
Show Gist options
  • Save yzdann/869d497d77a53a0d8cd5d5e25c092293 to your computer and use it in GitHub Desktop.
Save yzdann/869d497d77a53a0d8cd5d5e25c092293 to your computer and use it in GitHub Desktop.
# number of occur
grep -c "error" logfile.txt

# show context lines before and after match
grep --context=6 successful logfile.txt

# case insensitive
grep -i 

# zip files
zgrep -i error *.gz

# display file name
grep -I error *.log

# $_ is a reference to the last parameter that was used
# create dir and then cd to that
mkdir foo && cd $_

# brace 
cp /some/path/to/file.txt{,.bak}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment