Bashhub – Opens access to terminal history from anywhere

As you already know, all commands that are run in the shell will be saved and you can view them at any time, either using the command history or using the up / down arrow keys or do a reverse search using keyboard shortcut CTRL + R from the terminal. All commands that are executed on the terminal and will be saved in a file .bash_history… But you can only view, access and re-launch them from the same machine. What if you want to access the terminal history from another system on the network? No problems! That’s where the utility is “Bashhub” offered to help. It is a simple online web service where you can save all commands and access them from anywhere in the world. Bashhub saves every command entered in all sessions, so you can access them from anywhere in the world. To put it simply, all BASH history will be available in the cloud and all Bash history is indexed for search! Bashhub is completely free and open source.

All commands will be stored in the Bashhub database, which is encrypted with storage-level encryption with LUKS… Bashhub will generate a unique identification token for each user. This token is required to perform any user action for the API command. All commands written on behalf of a user are accessible only with that user’s authentication tokens. So there is currently no way to separate these commands and they are not accessible from the outside. Also, Bashhub allows you to ignore some commands that contain sensitive information, such as the user’s password. You can safely ignore such commands written to Bashhub to turn off the recording completely at any time.

Installing Bashhub

Make sure you have installed Python 2.7 in system. Python 2.7 is available in the default repository on most Linux distributions, so you can install it using your distribution’s package manager. For example, run the following command to install Python 2.7 on Debian.

sudo apt-get install python2.7

After installing Python 2.7, run any of the commands below, depending on the shell you are using.

If your shell BASH, enter the following command:

curl -OL https://bashhub.com/setup && bash setup

For zsh :

curl -OL https://bashhub.com/setup && zsh setup

After a few minutes, you will be prompted to create a new account if you do not have one. Enter a valid email ID, username and password, and your system name.

What's your email? [email protected]
What username would you like? demo
What password?

Email: [email protected] Username: demo
Are these correct? [Y/n] y
Registered new user demo

What do you want to call this system? For example Home, File Server, ect. [ubuntuserver]: 
Registered a new system ubuntuserver
Should be good to go! Please close and restart your terminal session.

Done! Your account has been created on Bashhub. You can access the profile at https://bashhub.com/ … Bashub will create a directory named .bashhubwhich will contain multiple scripts and a python virtual environment in your $ HOME directory.

If you specify an existing user, option “n” when asked “Are you a new user?”. Then enter your registered email address and password.

Close and restart the terminal to start recording terminal history.

Access to terminal history from anywhere

Now, run any random commands to see how it actually works.

We have specified the following commands:

clear
pwd
uname -a
ls -l
touch test.txt

Now is the time to check what commands we have entered.

To do this, run the following command:

bh

This command will show last 100 commands by default… You can override the default restriction with the “-n” flag.

To display only the last 10 commands, run the following command:

bh -n 10

Screen commands using a specific term

You can also display a specific command using a specific term such as “ls”.

bh -n 10 “ls”

If you want to search for a specific command with a search term and run it, use the “-i” flag as shown below.

bh -i "ls"

If the command has been run multiple times, select the command you want to run from the list and press ENTER.

Display a list of commands executed in a directory

To display a list of the most recent commands executed in the current working directory, use the “-d” flag.

bh -d

Bashhub will show recently used commands.

Interactive search

Another notable feature of Bashhub is its interactive search. This is similar to searching backwards, you can invoke it by pressing either bh -i or ctrl + b

Let’s do a tv interactive search.

$ bh -i
(bashhub-i-search): uname

This command will look for a command that has the string “uname”. You can perform an interactive search in the current working directory using the “-d” flag as shown below.

$ bh -i -d
(bashhub-i-search): ls

View team details

From the online search, you can also view detailed information about the team.

First launch of interactive search:

bh -i

Then select a command from the list and press “I” or the space keys to display the selected command details.

Removing commands

You can also remove specific command (s) from the Bashub database. To do this, run an interactive search:

bh -i "ls"

Select the command you want to delete and press the Backspace or Delete button from your keyboard.

Ignoring specific commands from a recording

This is another useful feature of the Bashhub utility. You can prevent a specific command that contains sensitive information like username or password from being written to bashhub.

To do this, just add #ignore at the end of the command.

Example:

$ uname -r #ignore

The above command “uname -r” will be written. Please note that if you have already set up your story so that ignore space, Bash will not save commands if you run them with a space at the beginning of those commands. In this case, you do not need to use “#ignore”.

Disabling write commands

If you need to undo the writing of Bashhub commands, you can enable it by running the following command:

bashhub off

Commands will no longer be recorded until you turn it on.

Please remember that this only affects the current default Bash session. To disable recording of all sessions globally, run the following command:

bashhub off --global

To enable Bashhub, run the following command:

bashhub on

Bashhub update

Just run the install command to update Bashhub. Also, run the “bashhub update” command to update it.

Bashhub access from another system

note that you don’t need to run “bh” on the same system. Since all commands are stored in the Bashhub database, you can view all of your terminal histories from any system. Make sure you have installed the Bashhub client on the system and login with your registered email ID and password.

Are you a new user? [Y/n] n
Please enter your bashhub credentials
Username: demo
Password:

User statistics check

bashhub status

Output example:

=== Bashhub Status
https://bashhub.com/demo
Total Commands: 21
Total Sessions: 1
Total Systems: 1
===
Session PID 1154 Started 2 hours ago
Commands In Session: 21
Commands Today: 21

Removing Bashhub

If you are concerned about privacy and security implications, Bashhub is not for you. You can remove it by removing the following directory from your system.

rm -r ~/.bashhub

For more details refer to the help section:

$ bashhub 
Usage: bashhub [OPTIONS] COMMAND [ARGS]...

Bashhub command line client

Options:
 -V, --version Display version
 -h, --help Show this message and exit.

Commands:
 filter Check if a command is filtered from bashhub.
 help Show this message and exit
 off Turn off saving commands to Bashhub.
 on Turn on saving commands to Bashhub.
 save Save a command to Bashhub
 setup Run Bashhub user and system setup
 status Stats for this session and user
 update Update your Bashhub installation
 util Misc utils used by Bashhub
 version Display version

We hope you find this useful. Be in touch!

Sidebar