[Swlug] Mint difficulties
Daniel Morris
danielmorris.cengmiet at gmail.com
Thu Mar 19 14:40:33 UTC 2020
On Thu, Mar 19, 2020 at 12:09:53PM +0000, DrBillBass via Swlug wrote:
>
> Thank you Dave, I clearly need to learn a great deal more about the
> deeper intricacies of Linux. But I was simply following instructions
> given me in good faith.
You can use the 'history' command (shell builtin, in recent years) to
take a peep back at what you did type. Depending on
configuration/defaults you'll typically have a few hundred-thousand
command lines stored there.
Under bash, the raw data is usually stored in ~/.bash_history, which
you can also 'less ~/.bash_history' to read in the raw.
Also note that most modern distributions/shells will timestamp the
entries, and 'weird things' happen sometimes with multiple shells
writing to the history, so its quite common to lose commands if
one shell/terminal has overwritten another's history buffer.
Here's an example of looking for something specific:
$ history 2000|grep cash01
889 2020-03-09 13:11:24 display cash01.png
891 2020-03-09 13:13:40 rm cash01.png
1027 2020-03-19 14:13:34 history 2000|grep cash01
So I've asked for (upto) 2000 lines from the history and matched on
the substring 'cash01'. Entries 889, 891 & 1027 matched. You can see the
ISO8601 date & time in columns 2 & 3, and the commands that I executed
from the fourth on (namely looked at the image with 'display', deleted
the file, and made that silly example.
Looking at the raw history file with 'less' I find:
display cash01.png
#1583759584
rm cash01.png
#1583759686
Those # lines are the timestamps (seconds since the epoch/1970-01-01
00:00:00), and a final "curiosity" is that 'history 2000|grep cash01'
line is not in the file, 'cos it is still in memory and hasn't been
written back to disk yet.
(an old-fashioned/not converted/not using that option history file won't
have the timestamps)
Sometimes knowing what one (or someone-else) has done can be really
helpful in either fixing it, or not doing it again ;-)
Hope that helps,
Daniel
More information about the Swlug
mailing list