Command history seems to be missing the first 75 lines

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
5
down vote

favorite
1












A couple of years ago, I did the automatic distribution update from 14.04 to 16.04. For the first time in my life, I was able to continue to use the computer after the automatic distribution update. As usual, the software repositories are all muntered, so system updates don't work properly, but I've gotten by.



I am going to do a clean installation of 18.04, however. In order to be able to configure my system more easily after the installation, I exported my command history to a text file.



$ history > /.../20180915_Command_history.txt


Beautifully, the resulting text file contains line numbers. Somewhat mysteriously, the first line number is 76. After looking at the first few lines, it looks like there were probably some previous commands.



  1. Do the line numbers just start at 76 for some reason?

  2. If not, is there any way that I can see lines 1 to 75?









share|improve this question



















  • 1




    Mine starts from 994 and ends with 1993.
    – mikewhatever
    Sep 17 at 3:53










  • !-75 is a good command to pull requests
    – hello moto
    Sep 28 at 5:11














up vote
5
down vote

favorite
1












A couple of years ago, I did the automatic distribution update from 14.04 to 16.04. For the first time in my life, I was able to continue to use the computer after the automatic distribution update. As usual, the software repositories are all muntered, so system updates don't work properly, but I've gotten by.



I am going to do a clean installation of 18.04, however. In order to be able to configure my system more easily after the installation, I exported my command history to a text file.



$ history > /.../20180915_Command_history.txt


Beautifully, the resulting text file contains line numbers. Somewhat mysteriously, the first line number is 76. After looking at the first few lines, it looks like there were probably some previous commands.



  1. Do the line numbers just start at 76 for some reason?

  2. If not, is there any way that I can see lines 1 to 75?









share|improve this question



















  • 1




    Mine starts from 994 and ends with 1993.
    – mikewhatever
    Sep 17 at 3:53










  • !-75 is a good command to pull requests
    – hello moto
    Sep 28 at 5:11












up vote
5
down vote

favorite
1









up vote
5
down vote

favorite
1






1





A couple of years ago, I did the automatic distribution update from 14.04 to 16.04. For the first time in my life, I was able to continue to use the computer after the automatic distribution update. As usual, the software repositories are all muntered, so system updates don't work properly, but I've gotten by.



I am going to do a clean installation of 18.04, however. In order to be able to configure my system more easily after the installation, I exported my command history to a text file.



$ history > /.../20180915_Command_history.txt


Beautifully, the resulting text file contains line numbers. Somewhat mysteriously, the first line number is 76. After looking at the first few lines, it looks like there were probably some previous commands.



  1. Do the line numbers just start at 76 for some reason?

  2. If not, is there any way that I can see lines 1 to 75?









share|improve this question















A couple of years ago, I did the automatic distribution update from 14.04 to 16.04. For the first time in my life, I was able to continue to use the computer after the automatic distribution update. As usual, the software repositories are all muntered, so system updates don't work properly, but I've gotten by.



I am going to do a clean installation of 18.04, however. In order to be able to configure my system more easily after the installation, I exported my command history to a text file.



$ history > /.../20180915_Command_history.txt


Beautifully, the resulting text file contains line numbers. Somewhat mysteriously, the first line number is 76. After looking at the first few lines, it looks like there were probably some previous commands.



  1. Do the line numbers just start at 76 for some reason?

  2. If not, is there any way that I can see lines 1 to 75?






command-line bash bashrc history bash-history






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 19 at 7:25









Ravexina

28.7k147098




28.7k147098










asked Sep 17 at 2:28









el_gallo_azul

1882418




1882418







  • 1




    Mine starts from 994 and ends with 1993.
    – mikewhatever
    Sep 17 at 3:53










  • !-75 is a good command to pull requests
    – hello moto
    Sep 28 at 5:11












  • 1




    Mine starts from 994 and ends with 1993.
    – mikewhatever
    Sep 17 at 3:53










  • !-75 is a good command to pull requests
    – hello moto
    Sep 28 at 5:11







1




1




Mine starts from 994 and ends with 1993.
– mikewhatever
Sep 17 at 3:53




Mine starts from 994 and ends with 1993.
– mikewhatever
Sep 17 at 3:53












!-75 is a good command to pull requests
– hello moto
Sep 28 at 5:11




!-75 is a good command to pull requests
– hello moto
Sep 28 at 5:11










1 Answer
1






active

oldest

votes

















up vote
12
down vote



accepted










First of all, If you need to get a backup of your command line history, then just copy this file:



~/.bash_history


Remember that you have to close all your terminals or run history -a to append all commands from those history sessions to the history file.





If not, is there any way that I can see lines 1 to 75?




Every command that has been saved in your history is available at ~/.bash_history file, to see all of them open a terminal and run:



cat ~/.bash_history


To get an output similar to history command with numbering run:



cat -n ~/.bash_history




Do the line numbers just start at 76 for some reason?




Run this command:



grep "^HIST" .bashrc


You have to get an output similar to:



HISTSIZE=1000
HISTFILESIZE=2000


As I said before ~/.bash_history keeps command-line's history.



  • The HISTFILESIZE show how many command should ~/.bash_history keeps track of, for mine it's 2000.


  • And HISTSIZE is the number of commands that history command (shell built-in actually) keeps track of.


When you open a terminal and run history, it will picks the last HISTSIZE number of commands from ~/.bash_history and shows that to you.



If you run new commands it will remove the older ones from session and append the new ones at the end of its list so the number of commands will match HISTSIZE.



I guess while asking the question you had 74 command more than of HISTSIZE in your .bash_history and that's the reason why it starts at 75.




From man bash:




  • HISTSIZE




    The number of commands to remember in the command history.





  • HISTFILESIZE




    The maximum number of lines contained in the history file.








share|improve this answer






















  • I'll suggest my per-process bash history, see my answer at askubuntu.com/a/80882/25618
    – waltinator
    Sep 17 at 4:24










  • What's the rationale for keeping HISTSIZE < HISTFILESIZE? Is there some downside of having history lookup all available commands? Does it become slow? But then does 1000 vs 2000 really make a difference? I could understand if you had 100k vs 1000 maybe but I really don't see how that specific setting would achieve anything useful.
    – Giacomo Alzetta
    Sep 17 at 7:11










  • @GiacomoAlzetta I don't think that the number is related to being able to perform the task faster, in my opinion it's for more convenience, I can look into 1000 line of history easier that of 2000. it's like caching data, we keep the most recent one because there is a higher chance that we run them again.
    – Ravexina
    Sep 17 at 8:06











  • @Ravexina Yes, but using Ctrl+R will show the most recent commands first, so I don't really see any inconvenience in keeping more. You can always do history | tail -n 1000 to keep just the last 1000 lines so it seems like an unnecessary limitation.
    – Giacomo Alzetta
    Sep 17 at 8:10










  • @GiacomoAlzetta I think it's about being able to have a look into most recent commands really fast not searching about specific result (like using ctrl+r), it's really a pain in the neck to combine history with other commands, I prefer running history to get my desired output and when I need more then I can just run tail -2000 ~.bash_history. It's all about what you prefer if 1000 is not enough for you just increase it... But not to 100K as you said your self :)
    – Ravexina
    Sep 17 at 8:16











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1075890%2fcommand-history-seems-to-be-missing-the-first-75-lines%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
12
down vote



accepted










First of all, If you need to get a backup of your command line history, then just copy this file:



~/.bash_history


Remember that you have to close all your terminals or run history -a to append all commands from those history sessions to the history file.





If not, is there any way that I can see lines 1 to 75?




Every command that has been saved in your history is available at ~/.bash_history file, to see all of them open a terminal and run:



cat ~/.bash_history


To get an output similar to history command with numbering run:



cat -n ~/.bash_history




Do the line numbers just start at 76 for some reason?




Run this command:



grep "^HIST" .bashrc


You have to get an output similar to:



HISTSIZE=1000
HISTFILESIZE=2000


As I said before ~/.bash_history keeps command-line's history.



  • The HISTFILESIZE show how many command should ~/.bash_history keeps track of, for mine it's 2000.


  • And HISTSIZE is the number of commands that history command (shell built-in actually) keeps track of.


When you open a terminal and run history, it will picks the last HISTSIZE number of commands from ~/.bash_history and shows that to you.



If you run new commands it will remove the older ones from session and append the new ones at the end of its list so the number of commands will match HISTSIZE.



I guess while asking the question you had 74 command more than of HISTSIZE in your .bash_history and that's the reason why it starts at 75.




From man bash:




  • HISTSIZE




    The number of commands to remember in the command history.





  • HISTFILESIZE




    The maximum number of lines contained in the history file.








share|improve this answer






















  • I'll suggest my per-process bash history, see my answer at askubuntu.com/a/80882/25618
    – waltinator
    Sep 17 at 4:24










  • What's the rationale for keeping HISTSIZE < HISTFILESIZE? Is there some downside of having history lookup all available commands? Does it become slow? But then does 1000 vs 2000 really make a difference? I could understand if you had 100k vs 1000 maybe but I really don't see how that specific setting would achieve anything useful.
    – Giacomo Alzetta
    Sep 17 at 7:11










  • @GiacomoAlzetta I don't think that the number is related to being able to perform the task faster, in my opinion it's for more convenience, I can look into 1000 line of history easier that of 2000. it's like caching data, we keep the most recent one because there is a higher chance that we run them again.
    – Ravexina
    Sep 17 at 8:06











  • @Ravexina Yes, but using Ctrl+R will show the most recent commands first, so I don't really see any inconvenience in keeping more. You can always do history | tail -n 1000 to keep just the last 1000 lines so it seems like an unnecessary limitation.
    – Giacomo Alzetta
    Sep 17 at 8:10










  • @GiacomoAlzetta I think it's about being able to have a look into most recent commands really fast not searching about specific result (like using ctrl+r), it's really a pain in the neck to combine history with other commands, I prefer running history to get my desired output and when I need more then I can just run tail -2000 ~.bash_history. It's all about what you prefer if 1000 is not enough for you just increase it... But not to 100K as you said your self :)
    – Ravexina
    Sep 17 at 8:16















up vote
12
down vote



accepted










First of all, If you need to get a backup of your command line history, then just copy this file:



~/.bash_history


Remember that you have to close all your terminals or run history -a to append all commands from those history sessions to the history file.





If not, is there any way that I can see lines 1 to 75?




Every command that has been saved in your history is available at ~/.bash_history file, to see all of them open a terminal and run:



cat ~/.bash_history


To get an output similar to history command with numbering run:



cat -n ~/.bash_history




Do the line numbers just start at 76 for some reason?




Run this command:



grep "^HIST" .bashrc


You have to get an output similar to:



HISTSIZE=1000
HISTFILESIZE=2000


As I said before ~/.bash_history keeps command-line's history.



  • The HISTFILESIZE show how many command should ~/.bash_history keeps track of, for mine it's 2000.


  • And HISTSIZE is the number of commands that history command (shell built-in actually) keeps track of.


When you open a terminal and run history, it will picks the last HISTSIZE number of commands from ~/.bash_history and shows that to you.



If you run new commands it will remove the older ones from session and append the new ones at the end of its list so the number of commands will match HISTSIZE.



I guess while asking the question you had 74 command more than of HISTSIZE in your .bash_history and that's the reason why it starts at 75.




From man bash:




  • HISTSIZE




    The number of commands to remember in the command history.





  • HISTFILESIZE




    The maximum number of lines contained in the history file.








share|improve this answer






















  • I'll suggest my per-process bash history, see my answer at askubuntu.com/a/80882/25618
    – waltinator
    Sep 17 at 4:24










  • What's the rationale for keeping HISTSIZE < HISTFILESIZE? Is there some downside of having history lookup all available commands? Does it become slow? But then does 1000 vs 2000 really make a difference? I could understand if you had 100k vs 1000 maybe but I really don't see how that specific setting would achieve anything useful.
    – Giacomo Alzetta
    Sep 17 at 7:11










  • @GiacomoAlzetta I don't think that the number is related to being able to perform the task faster, in my opinion it's for more convenience, I can look into 1000 line of history easier that of 2000. it's like caching data, we keep the most recent one because there is a higher chance that we run them again.
    – Ravexina
    Sep 17 at 8:06











  • @Ravexina Yes, but using Ctrl+R will show the most recent commands first, so I don't really see any inconvenience in keeping more. You can always do history | tail -n 1000 to keep just the last 1000 lines so it seems like an unnecessary limitation.
    – Giacomo Alzetta
    Sep 17 at 8:10










  • @GiacomoAlzetta I think it's about being able to have a look into most recent commands really fast not searching about specific result (like using ctrl+r), it's really a pain in the neck to combine history with other commands, I prefer running history to get my desired output and when I need more then I can just run tail -2000 ~.bash_history. It's all about what you prefer if 1000 is not enough for you just increase it... But not to 100K as you said your self :)
    – Ravexina
    Sep 17 at 8:16













up vote
12
down vote



accepted







up vote
12
down vote



accepted






First of all, If you need to get a backup of your command line history, then just copy this file:



~/.bash_history


Remember that you have to close all your terminals or run history -a to append all commands from those history sessions to the history file.





If not, is there any way that I can see lines 1 to 75?




Every command that has been saved in your history is available at ~/.bash_history file, to see all of them open a terminal and run:



cat ~/.bash_history


To get an output similar to history command with numbering run:



cat -n ~/.bash_history




Do the line numbers just start at 76 for some reason?




Run this command:



grep "^HIST" .bashrc


You have to get an output similar to:



HISTSIZE=1000
HISTFILESIZE=2000


As I said before ~/.bash_history keeps command-line's history.



  • The HISTFILESIZE show how many command should ~/.bash_history keeps track of, for mine it's 2000.


  • And HISTSIZE is the number of commands that history command (shell built-in actually) keeps track of.


When you open a terminal and run history, it will picks the last HISTSIZE number of commands from ~/.bash_history and shows that to you.



If you run new commands it will remove the older ones from session and append the new ones at the end of its list so the number of commands will match HISTSIZE.



I guess while asking the question you had 74 command more than of HISTSIZE in your .bash_history and that's the reason why it starts at 75.




From man bash:




  • HISTSIZE




    The number of commands to remember in the command history.





  • HISTFILESIZE




    The maximum number of lines contained in the history file.








share|improve this answer














First of all, If you need to get a backup of your command line history, then just copy this file:



~/.bash_history


Remember that you have to close all your terminals or run history -a to append all commands from those history sessions to the history file.





If not, is there any way that I can see lines 1 to 75?




Every command that has been saved in your history is available at ~/.bash_history file, to see all of them open a terminal and run:



cat ~/.bash_history


To get an output similar to history command with numbering run:



cat -n ~/.bash_history




Do the line numbers just start at 76 for some reason?




Run this command:



grep "^HIST" .bashrc


You have to get an output similar to:



HISTSIZE=1000
HISTFILESIZE=2000


As I said before ~/.bash_history keeps command-line's history.



  • The HISTFILESIZE show how many command should ~/.bash_history keeps track of, for mine it's 2000.


  • And HISTSIZE is the number of commands that history command (shell built-in actually) keeps track of.


When you open a terminal and run history, it will picks the last HISTSIZE number of commands from ~/.bash_history and shows that to you.



If you run new commands it will remove the older ones from session and append the new ones at the end of its list so the number of commands will match HISTSIZE.



I guess while asking the question you had 74 command more than of HISTSIZE in your .bash_history and that's the reason why it starts at 75.




From man bash:




  • HISTSIZE




    The number of commands to remember in the command history.





  • HISTFILESIZE




    The maximum number of lines contained in the history file.









share|improve this answer














share|improve this answer



share|improve this answer








edited Sep 17 at 7:58

























answered Sep 17 at 2:45









Ravexina

28.7k147098




28.7k147098











  • I'll suggest my per-process bash history, see my answer at askubuntu.com/a/80882/25618
    – waltinator
    Sep 17 at 4:24










  • What's the rationale for keeping HISTSIZE < HISTFILESIZE? Is there some downside of having history lookup all available commands? Does it become slow? But then does 1000 vs 2000 really make a difference? I could understand if you had 100k vs 1000 maybe but I really don't see how that specific setting would achieve anything useful.
    – Giacomo Alzetta
    Sep 17 at 7:11










  • @GiacomoAlzetta I don't think that the number is related to being able to perform the task faster, in my opinion it's for more convenience, I can look into 1000 line of history easier that of 2000. it's like caching data, we keep the most recent one because there is a higher chance that we run them again.
    – Ravexina
    Sep 17 at 8:06











  • @Ravexina Yes, but using Ctrl+R will show the most recent commands first, so I don't really see any inconvenience in keeping more. You can always do history | tail -n 1000 to keep just the last 1000 lines so it seems like an unnecessary limitation.
    – Giacomo Alzetta
    Sep 17 at 8:10










  • @GiacomoAlzetta I think it's about being able to have a look into most recent commands really fast not searching about specific result (like using ctrl+r), it's really a pain in the neck to combine history with other commands, I prefer running history to get my desired output and when I need more then I can just run tail -2000 ~.bash_history. It's all about what you prefer if 1000 is not enough for you just increase it... But not to 100K as you said your self :)
    – Ravexina
    Sep 17 at 8:16

















  • I'll suggest my per-process bash history, see my answer at askubuntu.com/a/80882/25618
    – waltinator
    Sep 17 at 4:24










  • What's the rationale for keeping HISTSIZE < HISTFILESIZE? Is there some downside of having history lookup all available commands? Does it become slow? But then does 1000 vs 2000 really make a difference? I could understand if you had 100k vs 1000 maybe but I really don't see how that specific setting would achieve anything useful.
    – Giacomo Alzetta
    Sep 17 at 7:11










  • @GiacomoAlzetta I don't think that the number is related to being able to perform the task faster, in my opinion it's for more convenience, I can look into 1000 line of history easier that of 2000. it's like caching data, we keep the most recent one because there is a higher chance that we run them again.
    – Ravexina
    Sep 17 at 8:06











  • @Ravexina Yes, but using Ctrl+R will show the most recent commands first, so I don't really see any inconvenience in keeping more. You can always do history | tail -n 1000 to keep just the last 1000 lines so it seems like an unnecessary limitation.
    – Giacomo Alzetta
    Sep 17 at 8:10










  • @GiacomoAlzetta I think it's about being able to have a look into most recent commands really fast not searching about specific result (like using ctrl+r), it's really a pain in the neck to combine history with other commands, I prefer running history to get my desired output and when I need more then I can just run tail -2000 ~.bash_history. It's all about what you prefer if 1000 is not enough for you just increase it... But not to 100K as you said your self :)
    – Ravexina
    Sep 17 at 8:16
















I'll suggest my per-process bash history, see my answer at askubuntu.com/a/80882/25618
– waltinator
Sep 17 at 4:24




I'll suggest my per-process bash history, see my answer at askubuntu.com/a/80882/25618
– waltinator
Sep 17 at 4:24












What's the rationale for keeping HISTSIZE < HISTFILESIZE? Is there some downside of having history lookup all available commands? Does it become slow? But then does 1000 vs 2000 really make a difference? I could understand if you had 100k vs 1000 maybe but I really don't see how that specific setting would achieve anything useful.
– Giacomo Alzetta
Sep 17 at 7:11




What's the rationale for keeping HISTSIZE < HISTFILESIZE? Is there some downside of having history lookup all available commands? Does it become slow? But then does 1000 vs 2000 really make a difference? I could understand if you had 100k vs 1000 maybe but I really don't see how that specific setting would achieve anything useful.
– Giacomo Alzetta
Sep 17 at 7:11












@GiacomoAlzetta I don't think that the number is related to being able to perform the task faster, in my opinion it's for more convenience, I can look into 1000 line of history easier that of 2000. it's like caching data, we keep the most recent one because there is a higher chance that we run them again.
– Ravexina
Sep 17 at 8:06





@GiacomoAlzetta I don't think that the number is related to being able to perform the task faster, in my opinion it's for more convenience, I can look into 1000 line of history easier that of 2000. it's like caching data, we keep the most recent one because there is a higher chance that we run them again.
– Ravexina
Sep 17 at 8:06













@Ravexina Yes, but using Ctrl+R will show the most recent commands first, so I don't really see any inconvenience in keeping more. You can always do history | tail -n 1000 to keep just the last 1000 lines so it seems like an unnecessary limitation.
– Giacomo Alzetta
Sep 17 at 8:10




@Ravexina Yes, but using Ctrl+R will show the most recent commands first, so I don't really see any inconvenience in keeping more. You can always do history | tail -n 1000 to keep just the last 1000 lines so it seems like an unnecessary limitation.
– Giacomo Alzetta
Sep 17 at 8:10












@GiacomoAlzetta I think it's about being able to have a look into most recent commands really fast not searching about specific result (like using ctrl+r), it's really a pain in the neck to combine history with other commands, I prefer running history to get my desired output and when I need more then I can just run tail -2000 ~.bash_history. It's all about what you prefer if 1000 is not enough for you just increase it... But not to 100K as you said your self :)
– Ravexina
Sep 17 at 8:16





@GiacomoAlzetta I think it's about being able to have a look into most recent commands really fast not searching about specific result (like using ctrl+r), it's really a pain in the neck to combine history with other commands, I prefer running history to get my desired output and when I need more then I can just run tail -2000 ~.bash_history. It's all about what you prefer if 1000 is not enough for you just increase it... But not to 100K as you said your self :)
– Ravexina
Sep 17 at 8:16


















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1075890%2fcommand-history-seems-to-be-missing-the-first-75-lines%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?