Basic linux commands II

Written by kisa

On May 17, 2020



(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

$more file_name

shows the file and navigation with pageDown pageUp or line by line.

$less file_name

navigation & search (with ‘/searchWord’) in a file.



Submit a Comment

Your email address will not be published. Required fields are marked *