1

I've seen that running a command with space before it doesn't log it in history(command at least) But that doesn't seem to be the Case for PopOS

It worked in Ubuntu but it wasn't working in PopOS. Is there any workaround or other trick I could try

$ls
$history
 1 ls
 2 history
$ pwd #there's a space preceding this command
$history
 1 ls
 2 history
 3 pwd
 4 history

Works in Ubuntu but doesn't work in POPOS

jww
  • 97,681
  • 90
  • 411
  • 885
Yeshwanth
  • 11
  • 2
  • 1
    Oh dear, yet another distro likely to have a user base in the single digits :-) In any case, not really a programming question, suggest you ask on SuperUser. – paxdiablo Oct 27 '19 at 04:34
  • 1
    Also see [Execute command without keeping it in history](https://stackoverflow.com/q/8473121/608639), [How do I prevent commands from showing up in Bash history?](https://stackoverflow.com/q/6475524/608639), [Don't save current bash session to history](https://stackoverflow.com/q/9039107/608639), [Avoid to keep command in history](https://serverfault.com/q/48769) and friends. – jww Oct 27 '19 at 05:07
  • `HISTCONTROL` from the dupe is the right answer for ignoring commands starting with a space. Thanks, @jww – that other guy Oct 27 '19 at 05:19

1 Answers1

4

Use set for this:

 set +o history
    do your command you want to be ignored
 set -o history
    now your commands will be stored to history again
wuseman
  • 1,259
  • 12
  • 20