1

This question already has an answer here:

I'm using screen command after ssh to a public remote machine with Ubuntu 14.04 so that I could continue my sessions whenever I want. I've found that some admins are tracking my command history and they have access to my screen sessions too. I know that I can clear my bash history commands by removing .bash_history file in my home directory but couldn't find a way to clear my screen sessions' command history too.

marked as duplicate by muru, dessert, karel, Community Nov 7 '17 at 9:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • What do you mean by screen command history? Usually screen starts a shell and you run commands in that shell, so you need to clear that shell's history. – muru Nov 7 '17 at 7:01
  • Exactly, I want to delete that shell's history. But I can't find a way for it. – choosp Nov 7 '17 at 7:04
  • Try echo $0 or ls -l /proc/$$/exe to see what shell you're running then. – muru Nov 7 '17 at 7:06
  • So that shell is also bash, and you already know how to delete bash history. What's the problem? – muru Nov 7 '17 at 7:16
  • I want the history to be gone for the current session not after I start a fresh one. I don't want to lose my current screen session. – choosp Nov 7 '17 at 7:19
2

Command you are looking for is history

To delete your current session it would be

history -c

To delete your current session and previous ones you would use both commands

history -c && history -w

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