HIstory command only showing last 15 commands

15,679

The history n command, where n is a number shows all history since line n. So in your case, history 904 will show the last 100 commands.

Share:
15,679
Sam
Author by

Sam

B.Sc. Computer Science B.Sc. Bioinformatics View my portfolio on samgermain.netlify.com

Updated on June 18, 2022

Comments

  • Sam
    Sam almost 2 years

    I enter the command history It shows the last 15 commands, where are the previous 988 commands.

      989  yarn android
      990  /Dir/firebase_dummy_app/chatroom/node_modules/react-native/scripts/launchPackager.command ; exit;
      991  yarn android
      992  source ~/.bashrc
      993  cd Documents
      994  ls
      995  rm -rf firebase_dummy_app
      996  expo init
      997  cd firesbaseDummy
      998  yarn android
      999  cd ..
     1000  rm -rf firesbaseDummy
     1001  /Dir/firesbaseDummy/node_modules/react-native/scripts/launchPackager.command ; exit;
     1002  /Dir/firebaseChat/node_modules/react-native/scripts/launchPackager.command ; exit;
     1003  history
     1004  history
    

    Even if I grep them history | grep 'rm' for something I know I did, none of the previous commands show up

    If I continue to enter terminal commands the numbers go up but I'm still limited to only 15. (command 995-1010 will be shown for example

    It continues happening when I close the end the terminal app and reopen it

    The terminal is zsh on MacOS Catalina

    • Sam
      Sam about 4 years
      I've found out a work around is opening .zsh_history but I would still like to know why the command isn't working
  • Sam
    Sam about 4 years
    So why is regular history only the last 15? Do I have a default set to 15 or something? Where could I change this default?
  • Meredith
    Meredith about 4 years
    Yes the default is set to 15. If it was too long you'd have to scroll through an entire list to find what you might want. I don't think you can change this as a setting, as it is a built-in command
  • Sam
    Sam about 4 years
    I think it was different in the sh shell. Catalina runs zsh instead of sh and this is the first time I've noticed it
  • Meredith
    Meredith about 4 years
    Yes, I noticed that the other day as well when I updated to zsh.
  • Sam
    Sam about 4 years
    I think it might be a MacOS Catalina thing
  • Gabriel Amorim
    Gabriel Amorim about 4 years
    Yeah, maybe it is
  • Raghu
    Raghu over 2 years
    If you want to display everything, you can just type history 1.