In the next article we are going to take a look at bashhub. All Gnu / Linux users know that the commands we execute in the shell will be saved and we can see them at any time using the history command, using the UP / DOWN arrows or doing a reverse search (CTRL + R) in the Terminal. All the commands that we execute in the terminal will be saved in the .bash_history file. But we can see them, access and rerun them only from the same machine. In case we need access the history of our terminal from a different system on the networkThis is where the "Bashhub" utility comes to our aid.
This is a simple online web service where we can save all the commands and access them from anywhere. Bashhub saves all the commands that we write in all sessions and systems, so that we can access them from anywhere. To put it simply, all BASH's story will be available in the cloud. Bashhub is completely free and open source.
All commands will be stored in the Bashhub database, which is encoded using storage-level encryption through LUKS. Bashhub will generate a unique identification token for each user. All commands recorded on behalf of a user are only accessible using the authentication token of this user. Actually there is no way to share these commands and they are not publicly accessible. Bashhub will allow us to ignore some commands that contain confidential information such as the user's password.
Installing Bashhub
In order to use this tool we will have to make sure that have installed Python (2.7 at least) in our system. Python 2.7 is available in the default repositories of most Gnu / Linux distributions.
Once Python is installed, we can now execute the following command in the terminal (Ctrl + Alt + T) as indicated below:
curl -OL https://bashhub.com/setup && bash setup
After a few seconds, we will be asked to create a new account if we don't already have one. We will have to write a valid email, username and password, and the name of our system.
The system will inform us that the registration has been completed. Your account will have been created on Bashhub. We can access our profile in «https://bashhub.com/nombre-de-usuario«. Bashub will create a directory called .bashhub that contains a Python virtual environment and scripts in our $ HOME directory.
Once the registration is finished we will have to restart the terminal to start recording our history of terminals.
Testing Bashhub
Now, we will run any random command to check if it really works. I ran the following commands:
clear pwd uname -a ls -l touch prueba.txt
Verify written commands
Now we can check what commands we have written. To do this, we will execute in the terminal (Ctrl + Alt + T):
bh
This command will show the last 100 commands default. We can override or change the default limit using the "-n" flag. To show only the last 10 commands we can execute:
bh -n 10
You can also us display a specific command using a specific term. For example "ls".
bh -n 10 "ls"
If we want search for a specific command with a search term and run it at the same time, we can use the "-i" flag as shown below.
bh -i "ls"
When we execute a command more than once, we can choose the command we want to execute from the list and press Enter.
Show the list of commands executed in a directory
For display the list of the last commands you ran in the current working directory, we just have to add the "-d" flag.
bh -d
Interactive search
The other notable feature of Bashhub is interactive search. Is similar to reverse lookup (Ctrl + R). We can use it by writing:
bh -i
View the details of a command
From the interactive search, we can also view detailed information for a command. First, we will have to start the interactive search:
bh -i
Then we will have to choose the command from the list and press the «i» or «space bar» keys to view the details of the selected command.
Delete commands
We will also be able to remove a particular command from the bashub database. To do so, we will start the interactive search:
bh -i "ls"
In the list that will be shown, we will have to choose the command we want to delete and press the «Backspace» key keyboard.
Uninstall Bashhub
In case you don't finish seeing the utility, you can uninstall it by deleting the following directory from your system:
rm -r ~/.bashhub
If you are concerned about privacy and security implications, Bashhub is not for you. Who needs it will be able to consult more about the possibilities of this program in his page of GitHub.
And upload commands which can contain passwords, ip's and users to the cloud that you execute without remembering that you have a daemon behind that publishes everything? .. Nice try NSA ..
As I wrote in the article, the program avoids certain commands with sensitive information (I think I remember that you can configure which commands you want to avoid. In the documentation you can find information about the subject). But it is also true that when you install these types of tools, perhaps it is interesting not to "forget" what your system is running, if you handle such compromised information. Salu2.