Nano - jump to end of file
Clash Royale CLAN TAG#URR8PPP
up vote
15
down vote
favorite
I have some long log files. I can view the last lines with tail -n 50 file.txt
, but sometimes I need to edit those last lines.
How do I jump straight to the end of a file when viewing it with nano
?
nano
add a comment |Â
up vote
15
down vote
favorite
I have some long log files. I can view the last lines with tail -n 50 file.txt
, but sometimes I need to edit those last lines.
How do I jump straight to the end of a file when viewing it with nano
?
nano
4
Try outvim
:-P
â Hunter.S.Thompson
Jan 31 at 9:55
3
@Hunter.S.Thompson This was intended for non-hardcore users (lol)
â Marko Pacak
Jan 31 at 9:57
@Hunter.S.Thompson That does not work! You are using a user defined command! But now try outvim
in a portable way G
â Volker Siegel
Jan 31 at 10:17
1
@VolkerSiegel I can't tell whether you're being sarcastic, but it's not a user-defined command. It's an emoticon. We used to use these things before someone let Unicode smoke weed.
â NieDzejkob
Jan 31 at 16:19
Sarcastic, of course! I tried your command::
to open command line, than-
,P
and enter. That's what I got: "E464: Ambiguous use of user-defined command". All the best!
â Volker Siegel
Jan 31 at 16:26
add a comment |Â
up vote
15
down vote
favorite
up vote
15
down vote
favorite
I have some long log files. I can view the last lines with tail -n 50 file.txt
, but sometimes I need to edit those last lines.
How do I jump straight to the end of a file when viewing it with nano
?
nano
I have some long log files. I can view the last lines with tail -n 50 file.txt
, but sometimes I need to edit those last lines.
How do I jump straight to the end of a file when viewing it with nano
?
nano
edited Jan 31 at 10:01
asked Jan 31 at 9:53
Marko Pacak
3741211
3741211
4
Try outvim
:-P
â Hunter.S.Thompson
Jan 31 at 9:55
3
@Hunter.S.Thompson This was intended for non-hardcore users (lol)
â Marko Pacak
Jan 31 at 9:57
@Hunter.S.Thompson That does not work! You are using a user defined command! But now try outvim
in a portable way G
â Volker Siegel
Jan 31 at 10:17
1
@VolkerSiegel I can't tell whether you're being sarcastic, but it's not a user-defined command. It's an emoticon. We used to use these things before someone let Unicode smoke weed.
â NieDzejkob
Jan 31 at 16:19
Sarcastic, of course! I tried your command::
to open command line, than-
,P
and enter. That's what I got: "E464: Ambiguous use of user-defined command". All the best!
â Volker Siegel
Jan 31 at 16:26
add a comment |Â
4
Try outvim
:-P
â Hunter.S.Thompson
Jan 31 at 9:55
3
@Hunter.S.Thompson This was intended for non-hardcore users (lol)
â Marko Pacak
Jan 31 at 9:57
@Hunter.S.Thompson That does not work! You are using a user defined command! But now try outvim
in a portable way G
â Volker Siegel
Jan 31 at 10:17
1
@VolkerSiegel I can't tell whether you're being sarcastic, but it's not a user-defined command. It's an emoticon. We used to use these things before someone let Unicode smoke weed.
â NieDzejkob
Jan 31 at 16:19
Sarcastic, of course! I tried your command::
to open command line, than-
,P
and enter. That's what I got: "E464: Ambiguous use of user-defined command". All the best!
â Volker Siegel
Jan 31 at 16:26
4
4
Try out
vim
:-Pâ Hunter.S.Thompson
Jan 31 at 9:55
Try out
vim
:-Pâ Hunter.S.Thompson
Jan 31 at 9:55
3
3
@Hunter.S.Thompson This was intended for non-hardcore users (lol)
â Marko Pacak
Jan 31 at 9:57
@Hunter.S.Thompson This was intended for non-hardcore users (lol)
â Marko Pacak
Jan 31 at 9:57
@Hunter.S.Thompson That does not work! You are using a user defined command! But now try out
vim
in a portable way Gâ Volker Siegel
Jan 31 at 10:17
@Hunter.S.Thompson That does not work! You are using a user defined command! But now try out
vim
in a portable way Gâ Volker Siegel
Jan 31 at 10:17
1
1
@VolkerSiegel I can't tell whether you're being sarcastic, but it's not a user-defined command. It's an emoticon. We used to use these things before someone let Unicode smoke weed.
â NieDzejkob
Jan 31 at 16:19
@VolkerSiegel I can't tell whether you're being sarcastic, but it's not a user-defined command. It's an emoticon. We used to use these things before someone let Unicode smoke weed.
â NieDzejkob
Jan 31 at 16:19
Sarcastic, of course! I tried your command:
:
to open command line, than -
, P
and enter. That's what I got: "E464: Ambiguous use of user-defined command". All the best!â Volker Siegel
Jan 31 at 16:26
Sarcastic, of course! I tried your command:
:
to open command line, than -
, P
and enter. That's what I got: "E464: Ambiguous use of user-defined command". All the best!â Volker Siegel
Jan 31 at 16:26
add a comment |Â
6 Answers
6
active
oldest
votes
up vote
19
down vote
accepted
Open the file with nano file.txt
.
Now type Ctrl + _ and then Ctrl + V
5
You can also do Ctrl+W, Ctrl+V - depending on what is more comfortable for your hands :)
â psmears
Jan 31 at 18:00
add a comment |Â
up vote
12
down vote
Many editors support the +NNN
option on the command line to jump directly to line NNN. Luckily for you, nano
appears to jump to the end if the line number given is past the end of file, so you could use something like:
nano +999999 file
That also works in joe
, but not in, e.g. less
or VIM, they complain about going past EOF. (at least the ones on my system. less +G file
and vi +$ file
work in those.)
Of course something like $EDITOR +$(wc -l file) file
would probably work in most editors, but that's a bit silly and involves reading the file twice.
Coders ofnano
could change their positioning argument behavior in the future. That's why I likeghaberek
's answer more.
â Vlastimil
Feb 1 at 11:46
@vla, or we could post a patch to make+$
do the right thing.
â ilkkachu
Feb 1 at 11:54
add a comment |Â
up vote
8
down vote
From the built-in Nano help (^G
):
M- (^Home) Go to the first line of the file
M-/ (^End) Go to the last line of the file
So, press Alt+ to go to the first line or press Alt+/ to go to the last line.
- This would be the equivalent of gg (start) or G (end) in vim.
- This also states that Ctrl+Home or Ctrl+End should work, but
that's never worked for methey seem to work natively on console/desktop but not via SSH using PuTTY. - The way I remember this is that
/
is near the bottom of the keyboard andis near the top.
If you want a command, you could write a function in your .bashrc
or .bash_aliases
to use the line count from wc
:
function nano-end
Now just type nano-end filename
to open the file to its last line!
Don't use[[ .. ]]
where unnecessary, in this instance an ordinary test command[ .. ]
is appropriate. Further, don't use` .. `
when the$( .. )
can be used. And don't forget to double quote the argument.
â Vlastimil
Feb 1 at 11:26
add a comment |Â
up vote
2
down vote
OP wants me to add an answer for jumping to the last line in vim
.
ESC + ShiftG will get you to the beginning of the last line.
ESC + ShiftGA will get you to the end of last line and insert mode will be activated.
If you want to do this in insert mode, doC-o G
. Not that you would want to do that if you were using vim right...
â NieDzejkob
Jan 31 at 16:21
add a comment |Â
up vote
1
down vote
Ctrl+End is working, if you have a recent compiled version of nano
editor
If you don't know, how to do it, you may read Compiling Nano editor with options
add a comment |Â
up vote
-2
down vote
You can see the manual page of nano to find out the answer yourself. Just type
man nano
And hit Enter.
I hope you'll find another exciting things too.
Note: Just press ^V to reach the end ...
what would I do without you...
â Marko Pacak
Feb 1 at 9:09
add a comment |Â
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
19
down vote
accepted
Open the file with nano file.txt
.
Now type Ctrl + _ and then Ctrl + V
5
You can also do Ctrl+W, Ctrl+V - depending on what is more comfortable for your hands :)
â psmears
Jan 31 at 18:00
add a comment |Â
up vote
19
down vote
accepted
Open the file with nano file.txt
.
Now type Ctrl + _ and then Ctrl + V
5
You can also do Ctrl+W, Ctrl+V - depending on what is more comfortable for your hands :)
â psmears
Jan 31 at 18:00
add a comment |Â
up vote
19
down vote
accepted
up vote
19
down vote
accepted
Open the file with nano file.txt
.
Now type Ctrl + _ and then Ctrl + V
Open the file with nano file.txt
.
Now type Ctrl + _ and then Ctrl + V
edited Jan 31 at 10:08
galoget
36319
36319
answered Jan 31 at 9:53
Marko Pacak
3741211
3741211
5
You can also do Ctrl+W, Ctrl+V - depending on what is more comfortable for your hands :)
â psmears
Jan 31 at 18:00
add a comment |Â
5
You can also do Ctrl+W, Ctrl+V - depending on what is more comfortable for your hands :)
â psmears
Jan 31 at 18:00
5
5
You can also do Ctrl+W, Ctrl+V - depending on what is more comfortable for your hands :)
â psmears
Jan 31 at 18:00
You can also do Ctrl+W, Ctrl+V - depending on what is more comfortable for your hands :)
â psmears
Jan 31 at 18:00
add a comment |Â
up vote
12
down vote
Many editors support the +NNN
option on the command line to jump directly to line NNN. Luckily for you, nano
appears to jump to the end if the line number given is past the end of file, so you could use something like:
nano +999999 file
That also works in joe
, but not in, e.g. less
or VIM, they complain about going past EOF. (at least the ones on my system. less +G file
and vi +$ file
work in those.)
Of course something like $EDITOR +$(wc -l file) file
would probably work in most editors, but that's a bit silly and involves reading the file twice.
Coders ofnano
could change their positioning argument behavior in the future. That's why I likeghaberek
's answer more.
â Vlastimil
Feb 1 at 11:46
@vla, or we could post a patch to make+$
do the right thing.
â ilkkachu
Feb 1 at 11:54
add a comment |Â
up vote
12
down vote
Many editors support the +NNN
option on the command line to jump directly to line NNN. Luckily for you, nano
appears to jump to the end if the line number given is past the end of file, so you could use something like:
nano +999999 file
That also works in joe
, but not in, e.g. less
or VIM, they complain about going past EOF. (at least the ones on my system. less +G file
and vi +$ file
work in those.)
Of course something like $EDITOR +$(wc -l file) file
would probably work in most editors, but that's a bit silly and involves reading the file twice.
Coders ofnano
could change their positioning argument behavior in the future. That's why I likeghaberek
's answer more.
â Vlastimil
Feb 1 at 11:46
@vla, or we could post a patch to make+$
do the right thing.
â ilkkachu
Feb 1 at 11:54
add a comment |Â
up vote
12
down vote
up vote
12
down vote
Many editors support the +NNN
option on the command line to jump directly to line NNN. Luckily for you, nano
appears to jump to the end if the line number given is past the end of file, so you could use something like:
nano +999999 file
That also works in joe
, but not in, e.g. less
or VIM, they complain about going past EOF. (at least the ones on my system. less +G file
and vi +$ file
work in those.)
Of course something like $EDITOR +$(wc -l file) file
would probably work in most editors, but that's a bit silly and involves reading the file twice.
Many editors support the +NNN
option on the command line to jump directly to line NNN. Luckily for you, nano
appears to jump to the end if the line number given is past the end of file, so you could use something like:
nano +999999 file
That also works in joe
, but not in, e.g. less
or VIM, they complain about going past EOF. (at least the ones on my system. less +G file
and vi +$ file
work in those.)
Of course something like $EDITOR +$(wc -l file) file
would probably work in most editors, but that's a bit silly and involves reading the file twice.
answered Jan 31 at 10:16
ilkkachu
49.8k674137
49.8k674137
Coders ofnano
could change their positioning argument behavior in the future. That's why I likeghaberek
's answer more.
â Vlastimil
Feb 1 at 11:46
@vla, or we could post a patch to make+$
do the right thing.
â ilkkachu
Feb 1 at 11:54
add a comment |Â
Coders ofnano
could change their positioning argument behavior in the future. That's why I likeghaberek
's answer more.
â Vlastimil
Feb 1 at 11:46
@vla, or we could post a patch to make+$
do the right thing.
â ilkkachu
Feb 1 at 11:54
Coders of
nano
could change their positioning argument behavior in the future. That's why I like ghaberek
's answer more.â Vlastimil
Feb 1 at 11:46
Coders of
nano
could change their positioning argument behavior in the future. That's why I like ghaberek
's answer more.â Vlastimil
Feb 1 at 11:46
@vla, or we could post a patch to make
+$
do the right thing.â ilkkachu
Feb 1 at 11:54
@vla, or we could post a patch to make
+$
do the right thing.â ilkkachu
Feb 1 at 11:54
add a comment |Â
up vote
8
down vote
From the built-in Nano help (^G
):
M- (^Home) Go to the first line of the file
M-/ (^End) Go to the last line of the file
So, press Alt+ to go to the first line or press Alt+/ to go to the last line.
- This would be the equivalent of gg (start) or G (end) in vim.
- This also states that Ctrl+Home or Ctrl+End should work, but
that's never worked for methey seem to work natively on console/desktop but not via SSH using PuTTY. - The way I remember this is that
/
is near the bottom of the keyboard andis near the top.
If you want a command, you could write a function in your .bashrc
or .bash_aliases
to use the line count from wc
:
function nano-end
Now just type nano-end filename
to open the file to its last line!
Don't use[[ .. ]]
where unnecessary, in this instance an ordinary test command[ .. ]
is appropriate. Further, don't use` .. `
when the$( .. )
can be used. And don't forget to double quote the argument.
â Vlastimil
Feb 1 at 11:26
add a comment |Â
up vote
8
down vote
From the built-in Nano help (^G
):
M- (^Home) Go to the first line of the file
M-/ (^End) Go to the last line of the file
So, press Alt+ to go to the first line or press Alt+/ to go to the last line.
- This would be the equivalent of gg (start) or G (end) in vim.
- This also states that Ctrl+Home or Ctrl+End should work, but
that's never worked for methey seem to work natively on console/desktop but not via SSH using PuTTY. - The way I remember this is that
/
is near the bottom of the keyboard andis near the top.
If you want a command, you could write a function in your .bashrc
or .bash_aliases
to use the line count from wc
:
function nano-end
Now just type nano-end filename
to open the file to its last line!
Don't use[[ .. ]]
where unnecessary, in this instance an ordinary test command[ .. ]
is appropriate. Further, don't use` .. `
when the$( .. )
can be used. And don't forget to double quote the argument.
â Vlastimil
Feb 1 at 11:26
add a comment |Â
up vote
8
down vote
up vote
8
down vote
From the built-in Nano help (^G
):
M- (^Home) Go to the first line of the file
M-/ (^End) Go to the last line of the file
So, press Alt+ to go to the first line or press Alt+/ to go to the last line.
- This would be the equivalent of gg (start) or G (end) in vim.
- This also states that Ctrl+Home or Ctrl+End should work, but
that's never worked for methey seem to work natively on console/desktop but not via SSH using PuTTY. - The way I remember this is that
/
is near the bottom of the keyboard andis near the top.
If you want a command, you could write a function in your .bashrc
or .bash_aliases
to use the line count from wc
:
function nano-end
Now just type nano-end filename
to open the file to its last line!
From the built-in Nano help (^G
):
M- (^Home) Go to the first line of the file
M-/ (^End) Go to the last line of the file
So, press Alt+ to go to the first line or press Alt+/ to go to the last line.
- This would be the equivalent of gg (start) or G (end) in vim.
- This also states that Ctrl+Home or Ctrl+End should work, but
that's never worked for methey seem to work natively on console/desktop but not via SSH using PuTTY. - The way I remember this is that
/
is near the bottom of the keyboard andis near the top.
If you want a command, you could write a function in your .bashrc
or .bash_aliases
to use the line count from wc
:
function nano-end
Now just type nano-end filename
to open the file to its last line!
edited Feb 1 at 14:44
answered Jan 31 at 16:36
ghaberek
1815
1815
Don't use[[ .. ]]
where unnecessary, in this instance an ordinary test command[ .. ]
is appropriate. Further, don't use` .. `
when the$( .. )
can be used. And don't forget to double quote the argument.
â Vlastimil
Feb 1 at 11:26
add a comment |Â
Don't use[[ .. ]]
where unnecessary, in this instance an ordinary test command[ .. ]
is appropriate. Further, don't use` .. `
when the$( .. )
can be used. And don't forget to double quote the argument.
â Vlastimil
Feb 1 at 11:26
Don't use
[[ .. ]]
where unnecessary, in this instance an ordinary test command [ .. ]
is appropriate. Further, don't use ` .. `
when the $( .. )
can be used. And don't forget to double quote the argument.â Vlastimil
Feb 1 at 11:26
Don't use
[[ .. ]]
where unnecessary, in this instance an ordinary test command [ .. ]
is appropriate. Further, don't use ` .. `
when the $( .. )
can be used. And don't forget to double quote the argument.â Vlastimil
Feb 1 at 11:26
add a comment |Â
up vote
2
down vote
OP wants me to add an answer for jumping to the last line in vim
.
ESC + ShiftG will get you to the beginning of the last line.
ESC + ShiftGA will get you to the end of last line and insert mode will be activated.
If you want to do this in insert mode, doC-o G
. Not that you would want to do that if you were using vim right...
â NieDzejkob
Jan 31 at 16:21
add a comment |Â
up vote
2
down vote
OP wants me to add an answer for jumping to the last line in vim
.
ESC + ShiftG will get you to the beginning of the last line.
ESC + ShiftGA will get you to the end of last line and insert mode will be activated.
If you want to do this in insert mode, doC-o G
. Not that you would want to do that if you were using vim right...
â NieDzejkob
Jan 31 at 16:21
add a comment |Â
up vote
2
down vote
up vote
2
down vote
OP wants me to add an answer for jumping to the last line in vim
.
ESC + ShiftG will get you to the beginning of the last line.
ESC + ShiftGA will get you to the end of last line and insert mode will be activated.
OP wants me to add an answer for jumping to the last line in vim
.
ESC + ShiftG will get you to the beginning of the last line.
ESC + ShiftGA will get you to the end of last line and insert mode will be activated.
edited Jan 31 at 10:39
answered Jan 31 at 10:31
Hunter.S.Thompson
4,50631334
4,50631334
If you want to do this in insert mode, doC-o G
. Not that you would want to do that if you were using vim right...
â NieDzejkob
Jan 31 at 16:21
add a comment |Â
If you want to do this in insert mode, doC-o G
. Not that you would want to do that if you were using vim right...
â NieDzejkob
Jan 31 at 16:21
If you want to do this in insert mode, do
C-o G
. Not that you would want to do that if you were using vim right...â NieDzejkob
Jan 31 at 16:21
If you want to do this in insert mode, do
C-o G
. Not that you would want to do that if you were using vim right...â NieDzejkob
Jan 31 at 16:21
add a comment |Â
up vote
1
down vote
Ctrl+End is working, if you have a recent compiled version of nano
editor
If you don't know, how to do it, you may read Compiling Nano editor with options
add a comment |Â
up vote
1
down vote
Ctrl+End is working, if you have a recent compiled version of nano
editor
If you don't know, how to do it, you may read Compiling Nano editor with options
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Ctrl+End is working, if you have a recent compiled version of nano
editor
If you don't know, how to do it, you may read Compiling Nano editor with options
Ctrl+End is working, if you have a recent compiled version of nano
editor
If you don't know, how to do it, you may read Compiling Nano editor with options
edited Feb 1 at 11:21
answered Feb 1 at 10:47
Vlastimil
6,4011146119
6,4011146119
add a comment |Â
add a comment |Â
up vote
-2
down vote
You can see the manual page of nano to find out the answer yourself. Just type
man nano
And hit Enter.
I hope you'll find another exciting things too.
Note: Just press ^V to reach the end ...
what would I do without you...
â Marko Pacak
Feb 1 at 9:09
add a comment |Â
up vote
-2
down vote
You can see the manual page of nano to find out the answer yourself. Just type
man nano
And hit Enter.
I hope you'll find another exciting things too.
Note: Just press ^V to reach the end ...
what would I do without you...
â Marko Pacak
Feb 1 at 9:09
add a comment |Â
up vote
-2
down vote
up vote
-2
down vote
You can see the manual page of nano to find out the answer yourself. Just type
man nano
And hit Enter.
I hope you'll find another exciting things too.
Note: Just press ^V to reach the end ...
You can see the manual page of nano to find out the answer yourself. Just type
man nano
And hit Enter.
I hope you'll find another exciting things too.
Note: Just press ^V to reach the end ...
edited Feb 1 at 10:41
Pierre.Vriens
94041015
94041015
answered Feb 1 at 9:07
Priya Bharti
11
11
what would I do without you...
â Marko Pacak
Feb 1 at 9:09
add a comment |Â
what would I do without you...
â Marko Pacak
Feb 1 at 9:09
what would I do without you...
â Marko Pacak
Feb 1 at 9:09
what would I do without you...
â Marko Pacak
Feb 1 at 9:09
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f420891%2fnano-jump-to-end-of-file%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
4
Try out
vim
:-Pâ Hunter.S.Thompson
Jan 31 at 9:55
3
@Hunter.S.Thompson This was intended for non-hardcore users (lol)
â Marko Pacak
Jan 31 at 9:57
@Hunter.S.Thompson That does not work! You are using a user defined command! But now try out
vim
in a portable way Gâ Volker Siegel
Jan 31 at 10:17
1
@VolkerSiegel I can't tell whether you're being sarcastic, but it's not a user-defined command. It's an emoticon. We used to use these things before someone let Unicode smoke weed.
â NieDzejkob
Jan 31 at 16:19
Sarcastic, of course! I tried your command:
:
to open command line, than-
,P
and enter. That's what I got: "E464: Ambiguous use of user-defined command". All the best!â Volker Siegel
Jan 31 at 16:26