0

I'm trying to remove a single command from TCSH history on RHEL 6, but couldn't find a way. I tried out the following Bash command as in [1], it didn't work.

history -d <line_number>

How can I achieve this?

3

I don't use tcsh, but perusing the man page suggests:

  1. save current history with history -S
  2. edit the history file to remove the offending command with vi ~/.history (or vi $histfile, if you've overridden the default).
  3. clear history with history -c
  4. load revised history with history -L

Read your tcsh man page for the various details.

  • I opened a tcsh shell to test these commands; they worked as advertised. 101 14:40 history -L 102 14:39 echo command here 104 14:39 history -S -- where I manually edited out command #103 from ~/.history. – Jeff Schaller Jun 20 '18 at 18:43
  • Those commands worked for me, I'm accepting your answer. – ahmedus Jun 21 '18 at 8:16

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.