In eshell: ~ $ history 1 history ~ $ eshell/clear [...] ~ $ [...] ~ $ history 1 history 2 eshell/clear 3 [...] 4 history An easy (dirty?) way to fix it could be override eshell-input-filter (from em-hist.el): (defcustom eshell-input-filter (function (lambda (str) (not (string-match "\\`\\s-*\\'" str)))) "Predicate for filtering additions to input history. Takes one argument, the input. If non-nil, the input may be saved on the input history list. Default is to save anything that isn't all whitespace." :type 'function :group 'eshell-hist) to: (defcustom eshell-input-filter (function (lambda (str) (not (string-match "\\`\\s-*\\'" (string-trim-left str))))) "Predicate for filtering additions to input history. Takes one argument, the input. If non-nil, the input may be saved on the input history list. Default is to save anything that isn't all whitespace." :type 'function :group 'eshell-hist)