I am running only Linux on a Mac computer. I am working on the TTY terminal only as I have not installed GUI yet. Right now, history gives me this:
$ history
1 2016-10-05 00:25:36 grape instance status
2 2016-10-05 00:26:00 history
3 2016-10-05 00:27:10 history | more
4 2016-10-05 00:44:56 history | sed 's/.[ ]*.[0-9]*.[ ]*//' | uniq | grep -i "heroku"
5 2016-10-05 00:45:36 history | sed 's/.[ ]*.[0-9]*.[ ]*//' | uniq
6 2016-10-05 00:49:29 history | sed 's/.[ ]*.[0-9]*.[ ]*//'
7 2016-10-05 00:51:32 history | cut -d " " -f7-1000 |
8 2016-10-05 00:51:36 history | cut -d " " -f7-1000
9 2016-10-05 00:56:54 history
I want to get rid of the timestamps and index number. I want just the commands. As you can see from the history, I tried solution of this question: history | sed 's/.[ ]*.[0-9]*.[ ]*//' | uniq | grep -i "heroku", but it does not seem to work on TTY terminal. It removes the index numbers, but the timestamp is still there. Output is as below (I omitted the uniq and grep command as i don't need them):
$ history | sed 's/.[ ]*.[0-9]*.[ ]*//'
2016-10-05 00:25:36 grape instance status
2016-10-05 00:26:00 history
2016-10-05 00:27:10 history | more
2016-10-05 00:44:56 history | sed 's/.[ ]*.[0-9]*.[ ]*//' | uniq | grep -i "heroku"
2016-10-05 00:45:36 history | sed 's/.[ ]*.[0-9]*.[ ]*//' | uniq
2016-10-05 00:49:29 history | sed 's/.[ ]*.[0-9]*.[ ]*//'
2016-10-05 00:51:32 history | cut -d " " -f7-1000 |
2016-10-05 00:51:36 history | cut -d " " -f7-1000
2016-10-05 00:56:54 history
2016-10-05 00:59:04 history | sed 's/.[ ]*.[0-9]*.[ ]*//'
I even tried running history | cut -d " " -f7-1000 | sort (from the comments in the linked question) but it does not remove the timestamps either.
I also tried running first solution from the link: HISTTIMEFORMAT ="";, but I get an error saying
HISTTIMEFORMAT: command not found
Is it possible to get history without timestamps in TTY?
EDIT:
The solution from this question did not work for me initially because of a single space. (Given solution was HISTTIMEFORMAT =""; but the space had to be removed to make it work. Otherwise I wouldn't have asked this duplicate question.
HISTTIMEFORMAT=orHISTTIMEFORMAT=""(note: no space allowed between theHISTTIMEFORMATand the=sign) – steeldriver Oct 05 '16 at 01:12sedto match one set of numbers... For what you have there you could probably do something likesed 's/^.*:[0-9]*:[0-9]*\s//'but obviously unsettingHISTTIMEFORMATis better... – Zanna Oct 05 '16 at 06:48