How to Jump to the End of the File Using Nano
- Use the Alt+/ Shortcut to Jump to the Last Line of a File in Linux
- Using the Ctrl+W and Ctrl+V Keyboard Shortcuts in Linux
The Nano
is one of the most basic editors available on Linux computers. Most Linux distributions come with it pre-installed.
When working on a text file, it’s common to move to the end or top of the file quickly.
You might wish to jump to the last line of a file when working with the nano
editor instead of scrolling through the full file. There are two ways to accomplish this, as listed below:
Use the Alt+/ Shortcut to Jump to the Last Line of a File in Linux
Create a text file and save it according to your preferences. The first step is to open a file in the nano
editor using the terminal command below:
thanos.txt
In 2018, twenty-three days after Thanos killed half of all life in the universe.
$ sudo nano thanos.txt
Output:
The cursor will point to the beginning of the file when you open it with the nano
editor.
Press Alt+/ or Alt+</kbd>, and you’ll find that your cursor has relocated to the end of your file’s last line, as illustrated above.
Using the Ctrl+W and Ctrl+V Keyboard Shortcuts in Linux
It will open a search box if you hit Ctrl+W. You can search for a word, which will direct you to that word.
$ sudo nano thanos.txt
Output:
As you can see in the output above, the cursor is over the searched word. i.e days
.
After the search prompt appears, hit Ctrl+V, and you’ll notice that your cursor is now pointed to the end of the last line of your file, as illustrated in the image below:
When working with huge files and needing to swiftly navigate to the end of the file or the last line, these ways come in handy.
Text files or any other file can be used as these files. In the nano
editor, the ways of getting to the last line of any file will remain the same.