Overview
When it comes to very large files, e.g while visiting some log files, the user may want to jump to the last line of the file to see the latest entry. The below command can be used to jump at the last line of a file which is opened with vi or vim command:
Example
- Create a temp file with some content:
# touch temp.txt
# echo $'this is line 1\nthis is line 2\nthis is line 3\nthis is line 4\nThis is last line' > temp.txt
- Check the content of the temp file using cat command:
# cat temp.txt
this is line 1
this is line 2
this is line 3
this is line 4
This is last line
- Open temp file with vi or vim and type “:$” to go to the last line of the file. Notice that the cursor is at the last line:
this is line 1
this is line 2
this is line 3
this is line 4
This is last line
~
~
~
~
:$