Howto – Remove strings from shell history

Have you ever polluted your Linux shell history with production passwords? Well I have..

This  nifty script will get rid of those for you:

for historyid in $(history|grep PASSWORD|awk ‘{print $1}’|sed ‘s/\*//g’|sort -nr); do history -d ${historyid}; done

The nice part is that this line will also remove it self from your history.

Oh and you really want to kick history up a notch, check out this

How-to Bulk Delete issues in Atlassian JIRA

This is something that people seem to ask a lot so I figured I would share this. It uses the version 2 REST API and curl to perform the deletions and requires full database access. I use PostgreSQL with my installation of JIRA, your milage may vary.

My script deletes all issues in the “AUDIT” project that are older than 180 days. But only 10 at a time. You can adjust that however you like.

DISCLAIMER!!! : Be careful. First off make sure your query spits out what you want. Exactly what you want. This does not “ask are you sure?”

Simply modify and run this script..

CURLCOMMAND=”curl -u $JIRA_USER:$JIRA_PASSWORD -X DELETE -H \”Content-Type: application/json\” $REST_URL”
PSQL_QUERY=”select ‘$CURLCOMMAND’||pkey from jiraissue where pkey like ‘AUDIT%’ and created < now() – INTERVAL ’180 days’ LIMIT 10;”

psql jira jira -t -A -c “$PSQL_QUERY”|sh