hucksh is a cross between bash, screen, ssh, sql, and probably some other things. A server program runs on your computer (similar to sshd), listens for commands from clients, runs them, and sends back the output. The server writes all commands, and their output, to a sqlite3 database, which is queryable by the user.
There are two clients: a cli that lets you run commands from your regular bash/zsh/whatever command line, and a custom GUI client.
Here’s a preview of the GUI client.
Several things are immediately obvious:
- It has a tabbed interface
- For each command, it shows
- the $PWD of the command
- a command ID number (e.g. 3060)
- start, stop, and elapsed time
- the command itself
- the command output
- There’s a place to enter the next command.
I’ll go into more detail for each tab below.
The shell tab
As shown above, a shell tab displays past commands, and has a place to enter new commands. So far it’s a lot like a regular TTY-based shell.
Unlike a TTY-based shell, the hucksh GUI automatically displays the current directory when a command was run, the command ID, the start, stop, and elapsed time of a command, as well as the command itself and its output.
At the top, in the tab title, is that tab’s PWD, with an asterisk (*) to denote that this is the current tab. This becomes more useful when you have multiple shell tabs.
Something TTY-based shells also don’t have is the disclosure button on the side. If you press it, you get this:
For each command, there are ten buttons you can press.
- Nowrap: Don’t wrap long lines.
- Zoom: Open the command in its own tab.
- Popout: Open the command in its own toplevel window.
- Hide: Hide all command output.
- Remove: Remove the command from the tab. (It’s still in the database and can be recovered.)
- Copy cmd: Copy the command text to the system clipboard.
- Copy output: Copy the command output to the system clipboard.
- Copy both: Copy both the command text and output to the system clipboard.
- Paste cmd: Paste the command into the command editor.
- cd & Run: cd to the command’s PWD and run the command again.
(What’s not obvious is that, unlike a regular TTY, you cannot yet select individual characters of the command or its output. The GUI toolkit hucksh uses does not yet support that functionality. It’s on the TODO list.)
Here’s what you get if you press the “hide” button on command 3061:
The command only had one line of output, so it’s not very dramatic, but when you’ve got more output, e.g. if you’ve accidentally cat’ed a binary file, it can be handy.
Here’s what you get if you press the “Remove” button on 3061:
The command is just removed from the interface.
And here’s how to get it back:
hucksh tab --add 3061
I ran the above “hucksh tab” command to add 3061 back to the UI, and it did.
There are other arguments to the “tab” subcommand to let you remove one or more commands from the current tab, and to completely replace all the commands in the tab.
Combined with querying the aforementioned database to get the required command IDs, this allows for some very handy contextual retrieval, like “show all the commands run in this directory”, or “show all commands run in this directory tree”, or “show all commands that rsync to or from a particular hostname”, etc. The query language is regular sql. (A friendlier query syntax is on the TODO list.)
Running commands is pretty standard stuff. Hucksh also offers easy directory navigation, and directory history.
Directory browsing and navigation
The first tab shown above is DIRS. Here it is.
This is the directory browser, with a bit of my hucksh development tree shown.
From the top down:
- You can type a regular expression to filter directory names. You can also press Ctrl- or Cmd-N to enter “navigation mode”, about which more later.
- You can go backwards (“<-“) or forwards (“<-“) in your visited directory history.
- You can go up a directory (“..”)
- You can CD to the current directory back in your current shell tab, and switch to that tab. (You can also just press enter to do the same thing.)
- Size, Time, Name: Sort by those columns.
- Selection boxes: Select individual directory entries, or all at once.
There are also hotkeys to hide or show directories, files (non-directories), and entries that start with a dot. In the above image, the UI notes that four dotfiles are hidden.
If you press Cmd-N (on a Mac; Ctrl-N on Windows or Linux), the directory panel enters “navigation mode”. This allows easy one-key navigation of the directory tree. Above, you could press “A” to display the “app” directory, or “C” to display the “cmd” directory. Once you got there, then you could press further keys to navigate deeper into the directory tree.
If you select some files, then you can do two things: Copy them, or edit them.
Here I’ve selected the Makefile and cobra.yaml files, and two buttons have popped up: Copy and Edit.
The Copy button will copy all selected filenames to the system clipboard, for pasting in the command editor or elsewhere.
mvim scp://[server-name]//[...path...]/Makefile \
(mvim is the command-line name for the MacVim executable.)
The rule of thumb is, if you can ssh to a server, you can edit files on it.
Hucksh remembers every directory you’ve visited in a shell window. By default it sorts them by last visited time, as shown, but you can also sort them by name or number of uses. Above you can see my recent directory usage as I type this tutorial, with the hucksh directory selected. If you press enter, you switch to the DIRS tab and the selected directory is displayed; or if you press Cmd-/Ctrl-enter, you go directly to the active shell tab (the one with the “*” at the end) and cd to that directory. I told you that “*” would come in handy later.
The hucksh server also notifies other clients of directories you’ve used, so if you use a directory in one client, it’ll show up in the other.
Hucksh is currently in private beta. Please email email@example.com if you are interested in joining, or if you would like to hear more once it is generally available. You can also follow hucksh on Twitter, @huckshell.