(global regular expression print)
$grep “failed*” -i log_file
print all lines with the word “failed” + * (-i ignore case) in log_file file.
prints first 10 lines of a file.
$head -n 20 file_name
prints 20 lines of a file_name.
$head -17 file_name2
prints 17 lines of a file_name2.
Same as head but prints the tail of a file.
With the key -f keeps looking at the changes to the file
$sudo tail -f /var/log/faillog
$sudo tail -f /var/log/secure
prints in-real-time changes of a file. In this example it’s the authentication file.
more & less
viewing and navigation
shows the file and navigation with pageDown pageUp or line by line.
navigation & search (with ‘/searchWord’) in a file.