Quick Tips from Ninja: Grep, Vim, Cat & Tar
Hey all, Ninja here, just thought I’d take a moment to post a couple of quick linux command line tips that some of you might find useful.
Grep
- Use the “-P” flag with grep for perl style regular expressions
- use the “–colour auto” flag to have grep automatically highlight the expression you’re looking for
- use the “-n” flag to include line numbers along with the output
Vim
- You can easily fix indenting in a file with vim by typing “gg=G” in edit mode
- New versions of vim can handle multiple tabs, use the “-p” flag from the command line, or type :tabnew to open new tabs
- You can split your vim window vertically, as well as horizontally, use :vsplit to split vertically, or :split for a horizontal split
- Vim also supports code folding, highlight what you want to fold with v, then type zf to fold, or zR to unfold. Check out the manual online for more information on code folding
Cat
- Did you know you can output the contents of a file from bottom to top with “tac”?
- add the “-n” flag to cat and you’ll get line numbers
Tar
- You probably know that you can use the “z” flag for gzipped tarballs, but did you know you can use “j” to handle bzip2 format as well?
About this entry
You’re currently reading “Quick Tips from Ninja: Grep, Vim, Cat & Tar”, an entry on alt the podcast
- Published:
- 10.01.07 / 6pm
- Category:
- Extras
- Tags:
- Post Navigation:
- « We are growing thanks to you!
AlternaGeek Episode 16: Got Gadgets? »

Comments are closed
Comments are currently closed on this entry.