The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

procedure for deleting perticular shell command from "history" command

Discussion in 'General Discussion' started by aress24x7, Nov 4, 2003.

  1. aress24x7

    aress24x7 Member

    Joined:
    Aug 2, 2003
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I need the procedure for deleting the perticular shell command from the "history" command.I want to protect other user so that they can't know which comands was run on shell.

    thank you.
     
  2. vishal

    vishal Well-Known Member

    Joined:
    Jan 28, 2003
    Messages:
    340
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    I dunno the exact way for deleting a particular command from history but if you want to CLEAR all the commands from HISTORY then use :

    clear history

    Hope this helps !
     
  3. vishal

    vishal Well-Known Member

    Joined:
    Jan 28, 2003
    Messages:
    340
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    Re: Re: procedure for deleting perticular shell command from "history" command

    Yeah here is how you can achieve that :

    history -d <line number>

    that line will get deleted from the history

    man is your friend :D
     
  4. aress24x7

    aress24x7 Member

    Joined:
    Aug 2, 2003
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    reopen

    i think history's commands are store in .bash_history in ROOT.If we delete from that then .........

    But still it doesn't work.

    Have you any answer!!!!!!!!!
     
  5. vishal

    vishal Well-Known Member

    Joined:
    Jan 28, 2003
    Messages:
    340
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    Re: reopen

    Yes they are stored in .bash_history and if you delete them from the file but obvious it 's not going to affect your current history coz those are stored in the Env Variable.

    Have tried :

    # history -d <line number>

    This should work ! :cool:
     
  6. aress24x7

    aress24x7 Member

    Joined:
    Aug 2, 2003
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    replay

    Yes,I tried it but still i get the problem.
    I think there are some procedure and then delete that perticular command from the .bash_history.

    Thank you in advance.

    Best regards,
    Your Friend.
     
  7. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    Are you looking for roots .bash_history or the users one? The users one is in /home/username/.bash_history.
     
Loading...

Share This Page