Display line numbers in vim. If a file is open with vim press ESC (if you are in insert mode) and then press colon (:) and type:
The above command will print line numbers in front of each line.
Now if you want to hide line numbers you just need to press colon again and type:
#vim #tricks #line_number #nonumber #number
set number
The above command will print line numbers in front of each line.
Now if you want to hide line numbers you just need to press colon again and type:
set nonumber
#vim #tricks #line_number #nonumber #number
If you grep a keyword in a text file and wants to print line number of the found keyword use
#linux #grep #line_number
-n
with your grep command:grep -n "hello world" *
#linux #grep #line_number