Linux Commands

From miki
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 -N. Pattern is a list of strings to match.
% grep -n PATTERN [FILE]              # Print matched line numbers.