March 2022

Making my bash history more informative

I’m a long time bash user and have found that I really want more information in my bash history file … more than just the typical command number and command line. So, to my .bashrc I’ve added a time stamp, process id, and tty to the history output by setting HISTTIMEFORMAT like so

export HISTTIMEFORMAT="%F %T %Z %z $$ $TTY "

which produces something like

957 2022-03-02 10:37:05 PST -0800 684 /dev/pts/0 history | tail

As you can see, this adds, after the command number, the date as YYYY-MM-DD, the time with timezone and GMT offset, the process id and the tty on which it was entered. I also like to keep track of the commands that are entered when I’m in a certain directory (useful for git and, well, all sorts of things) so I add

export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo $TTY $$ $USER \
$PWD "$(history 1)" >> ~/.history/$(basename $PWD)'

This appends a history line to a directory in ~/.history which corresponds to the last component of the directory in which the command was entered. So, if my current working directory is ~/dev/git, commands are also appended to ~/.history/git along with the tty on which they were entered, the current process id, the current user and the full working directory which gives me something like

/dev/pts/1 1806 user /home/user/git 951 2022-03-02 10:47:00 PST -0800 1806 /dev/pts/1 ls -l ~/.history

Note, I don’t change HISTFILE so everything is still in one history file. And I use an alias to show history for the current directory

alias cathist='cat ~/.history/$(basename $PWD)'

And, while I’m at it, I enable host name completion with shopt -s hostcomplete and also ask bash to try to save a multiline command in one history entry with shopt -s cmdhist. And if I have lots of space, I allow my history file to grow as large as needed by setting (or unsetting) HISTFILESIZE and HISTSIZE. So I end up with the following lines added to my .bashrc

export HISTSIZE=
export HISTFILESIZE=
shopt -s histappend
shopt -s cmdhist
shopt -s hostcomplete

export HISTTIMEFORMAT="%F %T %Z %z $$ $TTY "
TTY=$(tty)

export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo $TTY $$ $USER \
$PWD "$(history 1)" >> ~/.history/$(basename $PWD)'

alias cathist='cat ~/.history/$(basename $PWD)

I picked this up from various sources and modified it to fit my needs. Feel free to use or hack as you see fit.

Making my bash history more informative Read More »

What is Web 3.0 and how does it differ from current?

The article at https://www.makeuseof.com/web-2-vs-web-3-whats-the-difference gives a good high level overview of web3 and its differences from our current web/internet (web2 or web 2.0). What it misses is that all those machines that participate in the chain still need to be paid for along with any hosting and network charges, not to mention the additional resource required to validate and add blocks to the chain.

How are they paid for now, in web2? Generally 2 methods: 1 direct subscription fees (New York Times, Wall Street Journal, etc), 2 your personal information (Google, Facebook, LinkedIn, etc). Could this same model be used? Sure but what I’ve seen put forth in many instances is, in order to protect privacy, users directly pay for the resource using some cryptocurrency. In a privacy-focused web, that’s certainly the most private but how much will you be charged for a “transaction” (i.e. a visit to a site, a page refresh, etc.).

I’m not sure any of this has been sorted out yet. Depending on the level of anonymity desired (and expected) by web3 users, it may not be possible to “pay” with your personal information. Some companies are working on directories whereby a user can control what information is made available to all sites, certain sites, etc but, again, this all is still in a major state of flux. I anxiously await the sorting out.

What is Web 3.0 and how does it differ from current? Read More »

Government cybersecurity bill passes!

Last night, a few hours before the State of the Union address, congress passed a cybersecurity bill…finally! Some of the details, summarized from the article
* Businesses in certain sectors (e.g. financial, transportation, energy to name a few) MUST alert the government when hacked or when they pay ransomware
* Updates to rules how government agencies manage information security
* Changes to how the government assesses and manages the security the the cloud systems in use
CISA should get much more information and insight into the number and type of attacks U.S. companies are being subjected to on a daily basis and be able to share it with concerned entities in a more timely fashion.

Details at https://www.washingtonpost.com/politics/2022/03/02/senate-is-finally-passing-big-cyber-bills/ if you’re interested in more details.

Government cybersecurity bill passes! Read More »

Search engines

Everyone knows about Google search…so much so that it’s become a verb. Many know about some of the other search engines like DuckDuckGo.com and DogPile.com. But the search engine market is apparently not saturated because there are new ones entering all the time. One of my favorites is Neeva.com which promises not to track you, is free (including spaces which is kind of a persistent search) but offers additional features for a fee ($50/yr right now) but is perfectly serviceable on the free tier (and is my preferred search engine right now).

Another that I like to use occasionally is You.com. No ads like Neeva but You says they summarize the web based on your searches, providing answers from a limited list of sites they call your preferred sources, in different categories (e.g. web, news, shopping, etc). You can “thumbs up” or “thumbs down” sources but that’s about it. Still, its format and output can be useful.

A new one (to me) is AndiSearch.com – another that promises privacy It’s still in “alpha” status (which means they’re actively working on it and haven’t really finished the product) so it may break on occasion, They say they fight spam, won’t track you and won’t present you with ads. Its approach is a little different in that it’s conversational meaning that you interact with their “bot” and can type in queries as sentences. Sure, it has a command language so you can do things like “go facebook” and it’ll take you right to Facebook (although it’s beyond me why you would want to do that). The results are also presented differently from what I’m used to seeing – the bot takes up the left side of the window so the results are restricted to the right side of the window. You have some control over how the results are presented (mostly cosmetic) but overall I think it’s an interesting approach and one to keep an eye on. Do I use it much? Not right now but maybe, depending on how the product progresses…

Search engines Read More »