So, some time ago, I copied csv data from a webpage into terminal to save it to a csv file, like echo "field1,field2,field3,...,fieldn, with about 20 lines of text. I did this because I couldn't figure out how to save the csv from the webpage, as the "csv" was just in plain text on the page in comma-separated format. I was able to create a functional cvs file, but it seems each 'row' of the file somehow is stored as a command to run each time I open terminal. There is an ID for each row, so I will see twenty different commands in my history dated to when I opened terminal like so: 1,field2,field3,...,fieldn.

I look thru my history often so this is quite annoying and I want to get rid of these seemingly latent, recurring commands. What causes this and how do I fix it?

  • If it's recurring each time you open a terminal, then it's probably not just a matter of shell history: you probably managed to save the lines into one of your shell initialization files (such as ~/.bashrc). Check there. – steeldriver Jan 12 '16 at 0:13
  • it's not explicity in my .bashrc so not sure if there is another way? – cfye14 Jan 12 '16 at 0:18
  • Sorry I think I misread your question: reading it again, it sounds like the commands are appearing in your (most recent) history but are not visibly being executed in the newly-started terminal? – steeldriver Jan 12 '16 at 0:22
  • when i look at my .bash_history, I notice that all the other commands are one line, as return runs the command instead of going to a new line. The first line is not re-run as a new command when I look thru my history, just lines 2-20. – cfye14 Jan 12 '16 at 0:23
  • @steeldriver, right, they show up in history but are not visibly executed – cfye14 Jan 12 '16 at 0:24

You can either remove the culprit lines from .bash_history, or just rename or delete .bash_history.

  • That works. Any idea what causes the timestamps to update on the 'spare' lines of a multiple-line command? – cfye14 Jan 12 '16 at 0:56
  • No idea, sorry. – QwertyChouskie Jan 12 '16 at 0:58

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.