Linux Commands

From miki
Revision as of 00:52, 7 September 2008 by Mip (talk | contribs) (→‎grep: typo)
Jump to navigation Jump to search

Frequently Used Shell Commands

grep

% grep -Rsl PATTERN [FILE]            # Recursive, no error output, only list filename
% grep BASIC-REG-EXP-PATTERN [FILE]   # Use classic regexp (like "dma\|DMA")
% egrep EXT-REG-EXP-PATTERN [FILE]    # Same as grep -E. Use extended regexp (like "dma|DMA")
% fgrep FIXED-STRINGS-REG-EXP [FILE]  # Same as grep -F. Pattern is a list of strings to match.
% grep -n PATTERN [FILE]              # Print matched line numbers.