Jump to the Beginning and End of File in Nano
Nano is an excellent beginner-friendly text editor for Linux command line. Learn to quickly go to the beginning or end of files in Nano.
"Everything is a file in Linux" so dealing with files constantly is the sole nature of Linux.
And the majority of those files are long (like really long) and jumping to the beginning and end of the line can get you a headache if you don't utilize nano properly.
I mean you can always use the up and down arrow keys to move line by line or page up and down keys to move up and down by pages. But with a few keystrokes, you can easily jump to the start or end of a file.
- Alt+\ or Ctrl+Home : Jump to the start of file
- Alt+/ or Ctrl+End: Jump to the end of file
Let's see it in details.
Jump to the beginning of the file in nano
I will be showing you two ways to jump to the beginning of the file so you can choose what suits your workflow the most.
I assume you already have opened a text file using and if not, you can refer to the given command:
nano text_file
Using Ctrl + Home
Once you open the text file with nano, you just have to use the keybinding of Ctrl + Home
and you will notice that the cursor is now at the beginning of the text file:
Pretty fast right? But wait, there is another way if you want to avoid Ctrl + Home
.
Using Alt + \
This is what I personally use as the home key is placed at extreme end of my keyboard.
So you just have to use the keybinding Alt + \
and your cursor will be at the beginning of the text file.
Jump to the end of the file in nano
Here, I'm going to use the same keybindings with minor differences so you can have it instantly on your muscle memory.
Using Crtl + End
This is perfect when you already have developed the habit of using Ctrl + Home
to jump to the beginning.
Once you have opened the desired file using nano, you just have to the keybinding Ctrl + End
and no matter where your cursor is, this will lend you to the end of the file:
And you guessed it right! There is yet another way to jump to the end of the file.
Using Alt + /
This is the perfect choice for jumping to the end of the file if you are already using Alt + \
to jump to the beginning.
So you just have to use the keybinding Alt + /
and it will lend you to the end of the text file.
Bonus: Yet another way to jump to the end
This is a two-step process and this is the reason why I'm mentioning this in the end.
- Press
Ctrl + W
and it will open a search prompt. - And then press
Ctrl + V
and it will lead you to the end of the file.
Wrapping Up
This was a quick tutorial on how you can jump to the beginning and at the end of the file in nano with multiple methods.
I hope the given solutions make editing text files with nano easier.
A software engineer who loves to tinker with hardware till it gets crashed. While reviving my crashed system, you can find me reading literature, manga, or watering my plants.