I use history -c clear the history, why the first command id is not begin with 1?

aircraftdeMacBook-Pro:shell_dir ldl$ history -c
aircraftdeMacBook-Pro:shell_dir ldl$ history
   35  history

You can see it is begin with 35.


Because it is made that way. I wish there was a better answer but this one is obviously the only one that's valid.

It could have been justified for different reasons including possible implementation issues that made the developers decide to leave the cursor alone, and also security/logging package interactions which would have made things appear more complicated for nothing.

If you are not the system's administrator, there is no way for you to avoid leaving traces on what you do (if such security is implemented). In looser setups, you'd easily get away with editing your bash history file but that is not guaranteed to cover your tracks. Neither is clearing history, by the way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.