bash-preexec VS alacritty

Compare bash-preexec vs alacritty and see what are their differences.

bash-preexec

⚡ preexec and precmd functions for Bash just like Zsh. (by rcaloras)
Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
bash-preexec alacritty
8 352
827 52,767
- 2.4%
5.0 9.2
2 months ago 5 days ago
Shell Rust
MIT License Apache License 2.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

bash-preexec

Posts with mentions or reviews of bash-preexec. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-05-06.
  • Atuin replaces your existing shell history with a SQLite database
    11 projects | news.ycombinator.com | 6 May 2023
    Or use the excellent bash-preexec plugin that atuin itself relies on to achieve this in a cleaner way: https://github.com/rcaloras/bash-preexec
  • How to log bash commands in some simple way?
    3 projects | /r/bash | 27 Nov 2022
    Use this: https://github.com/rcaloras/bash-preexec/
  • Is it possible to handle a command before it's passed to the bash command parser?
    1 project | /r/bash | 16 Oct 2022
  • Opppppsss you did it again
    4 projects | news.ycombinator.com | 30 Jul 2022
    Funny you say that when the sketchiest part of this submission is the shell script it uses to intercept every command you run: https://github.com/rcaloras/bash-preexec/blob/master/bash-pr...

    I don’t know rust, but the rust files in this repo look very straightforward. (Why wouldn’t it? It’s just matching a few hardcoded commands. It’d be easy in any language)

  • Terminal starting on previous PWD position?
    1 project | /r/linux4noobs | 23 May 2022
    # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples # We use preexec and precmd hook functions for Bash # If you have anything that's using the Debug Trap or PROMPT_COMMAND # change it to use preexec or precmd # See also https://github.com/rcaloras/bash-preexec # If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth # append to the history file, don't overwrite it shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=1000 HISTFILESIZE=2000 # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # If set, the pattern "**" used in a pathname expansion context will # match all files and zero or more directories and subdirectories. #shopt -s globstar # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" # set variable identifying the chroot you work in (used in the prompt below) if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi # set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in xterm-color|*-256color) color_prompt=yes;; esac # uncomment for a colored prompt, if the terminal has the capability; turned # off by default to not distract the user: the focus in a terminal window # should be on the output of commands, not on the prompt #force_color_prompt=yes if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # We have color support; assume it's compliant with Ecma-48 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such # a case would tend to support setf rather than setaf.) color_prompt=yes else color_prompt= fi fi if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' #alias dir='dir --color=auto' #alias vdir='vdir --color=auto' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi # colored GCC warnings and errors #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' # some more ls aliases alias ll='ls -alF' alias la='ls -A' alias l='ls -CF' # Add an "alert" alias for long running commands. Use like so: # sleep 10; alert alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi # If this is an xterm set more declarative titles # "dir: last_cmd" and "actual_cmd" during execution # If you want to exclude a cmd from being printed see line 156 case "$TERM" in xterm*|rxvt*) PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\$(print_title)\a\]$PS1" __el_LAST_EXECUTED_COMMAND="" print_title () { __el_FIRSTPART="" __el_SECONDPART="" if [ "$PWD" == "$HOME" ]; then __el_FIRSTPART=$(gettext --domain="pantheon-files" "Home") else if [ "$PWD" == "/" ]; then __el_FIRSTPART="/" else __el_FIRSTPART="${PWD##*/}" fi fi if [[ "$__el_LAST_EXECUTED_COMMAND" == "" ]]; then echo "$__el_FIRSTPART" return fi #trim the command to the first segment and strip sudo if [[ "$__el_LAST_EXECUTED_COMMAND" == sudo* ]]; then __el_SECONDPART="${__el_LAST_EXECUTED_COMMAND:5}" __el_SECONDPART="${__el_SECONDPART%% *}" else __el_SECONDPART="${__el_LAST_EXECUTED_COMMAND%% *}" fi printf "%s: %s" "$__el_FIRSTPART" "$__el_SECONDPART" } put_title() { __el_LAST_EXECUTED_COMMAND="${BASH_COMMAND}" printf "\033]0;%s\007" "$1" } # Show the currently running command in the terminal title: # http://www.davidpashley.com/articles/xterm-titles-with-bash.html update_tab_command() { # catch blacklisted commands and nested escapes case "$BASH_COMMAND" in *\033]0*|update_*|echo*|printf*|clear*|cd*) __el_LAST_EXECUTED_COMMAND="" ;; *) put_title "${BASH_COMMAND}" ;; esac } preexec_functions+=(update_tab_command) ;; *) ;; esac
  • How Warp Works
    10 projects | dev.to | 16 Mar 2022
    Thankfully, most shells provide hooks for before the prompt is rendered (zsh calls this precmd) and before a command is executed (preexec). Zsh and Fish have built in support for these hooks. Though bash does not have built in support for these hooks, scripts like bash-preexec exist to mimic the behavior of other shells. Using these hooks, we send a custom DCS (Device Control String) from the running session to Warp. This DCS contains an encoded JSON string that includes metadata about the session that we want to render. Within Warp we can parse the DCS, deserialize the JSON, and create a new block within our data model.
  • What am I running inside my bash? (2014)
    2 projects | news.ycombinator.com | 28 Jan 2021
    It's attached to the preexec hook of https://github.com/rcaloras/bash-preexec, so is run before every command. This means that everything goes into one easily-greppable file, but is still separable by PID/host machine - since my work has me walking around a large facility, often I'll remember where I was when I did something but not exactly when, so can narrow down by machine.
  • post command hooks
    1 project | /r/commandline | 20 Jan 2021
    This github repo claims to do the same for bash.

alacritty

Posts with mentions or reviews of alacritty. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-03-16.
  • Terminal Latency
    1 project | news.ycombinator.com | 19 Mar 2024
    It's opinionated, which comes with upsides and downsides. I won't blame the maintainer to keep things focused, feature creep (even for worthy features) can kill a FOSS project.

    Another example is sixel support, there's a fork where it all works but is not sufficiently "proven" (code quality just as well as sixel being the best fit for the problem)

    https://github.com/alacritty/alacritty/pull/4763#issuecommen...

    It may be annoying but I get the reasoning, and there are other terminals.

  • Level Up Your Dev Workflow: Conquer Web Development with a Blazing Fast Neovim Setup (Part 1)
    12 projects | dev.to | 16 Mar 2024
    alacritty (Linux, Macos & Windows)
  • Alacritty: A cross-platform, OpenGL terminal emulator
    1 project | news.ycombinator.com | 16 Feb 2024
  • Neovide – a simple, no-nonsense, cross-platform GUI for Neovim
    17 projects | news.ycombinator.com | 31 Jan 2024
    > Ligatures: ok, nice, possible in terms too (hopefully Alacritty one day)

    I wouldn't hold my breath. Seems like its getting the iPad calculator treatment[0]. Which is to say rather than ship something working that can be improved, they're leaving a UX void.

    [0] https://github.com/alacritty/alacritty/issues/50

  • I Just Wanted Emacs to Look Nice – Using 24-Bit Color in Terminals
    7 projects | news.ycombinator.com | 30 Jan 2024
    IME, this is like the golden age of terminal apps in general and macOS-compatible ones in particular. There are several really good terminals for macOS:

    [iTerm2 app](https://iterm2.com/)

    [Kitty terminal](https://sw.kovidgoyal.net/kitty/)

    [WezTerm terminal](https://wezfurlong.org/wezterm/index.html)

    [Alacritty](https://github.com/alacritty/alacritty)

    My daily driver is WezTerm…

    - Runs on Linux, macOS, Windows 10 and FreeBSD

    - [Multiplex terminal panes, tabs and windows on local and remote hosts, with native mouse and scrollback](https://wezfurlong.org/wezterm/multiplexing.html)

    - [Ligatures](https://github.com/tonsky/FiraCode#fira-code-monospaced-font...), Color Emoji and font fallback, with true color and [dynamic color schemes](https://wezfurlong.org/wezterm/config/appearance.html#colors).

    - [Hyperlinks](https://wezfurlong.org/wezterm/hyperlinks.html)

    - [Searchable Scrollback](https://wezfurlong.org/wezterm/scrollback.html) (use mouse wheel and `Shift-PageUp` and `Shift PageDown` to navigate, Ctrl-Shift-F to activate search mode)

    - xterm style selection of text with mouse; paste selection via `Shift-Insert` (bracketed paste is supported!)

    - SGR style mouse reporting (works in vim and tmux)

    - Render underline, double-underline, italic, bold, strikethrough (most other terminal emulators do not support as many render attributes)

    - Configuration via a [configuration file](https://wezfurlong.org/wezterm/config/files.html) with hot reloading

    - Multiple Windows (Hotkey: `Super-N`)

    - Splits/Panes (Split horizontally/vertically: `Ctrl-Shift-Alt-%` and `Ctrl-Shift-Alt-"`, move between panes: `Ctrl-Shift-ArrowKey`)

    - Tabs (Hotkey: `Super-T`, next/prev: `Super-Shift-[` and `Super-Shift-]`, go-to: `Super-[1-9]`)

    - [SSH client with native tabs](https://wezfurlong.org/wezterm/ssh.html)

    - [Connect to serial ports for embedded/Arduino work](https://wezfurlong.org/wezterm/serial.html)

    - Connect to a local multiplexer server over unix domain sockets

    - Connect to a remote multiplexer using SSH or TLS over TCP/IP

    - iTerm2 compatible image protocol support, and built-in [imgcat command](https://wezfurlong.org/wezterm/imgcat.html)

    - Kitty graphics support

    - Sixel graphics support (experimental: starting in `20200620-160318-e00b076c`)

  • alacritty-themes not working any more!!!
    6 projects | dev.to | 7 Jan 2024
    # We use Alacritty's default Linux config directory as our storage location here. mkdir -p ~/.config/alacritty/themes git clone https://github.com/alacritty/alacritty-theme ~/.config/alacritty/themes
  • The Linux graphics stack in a nutshell, part 2
    1 project | news.ycombinator.com | 29 Dec 2023
    if by 'in the terminal' you mean 'in a program emulating an ascii terminal' then no, because ascii terminals don't support anything that looks better than ascii art. they don't support sixel either. there are a variety of proposals for how to add graphics to ascii terminal emulators in a backwards-compatible way, such as mgr and notty https://github.com/alacritty/alacritty/issues/51

    but the 'terminal' that a terminal emulator is emulating is a device which provides a user access to a remote computer. normally nowadays this is a laptop or cellphone. in that case, yes, you can use x-windows, xpra, vnc, or a web browser

  • Pimp your CLI
    13 projects | dev.to | 19 Dec 2023
    A decent terminal application (i.e: iterm2, alacritty, etc.)
  • What GPU Accelerated terminal do you recommend for Linux
    1 project | /r/neovim | 11 Dec 2023
    I have been having random input lags with Alacritty. Initially I thought it was my custom neovim config. After some investigation, I have found an Alacritty github issue where users are reporting the same issue: https://github.com/alacritty/alacritty/issues/6844
  • Keypress delay
    1 project | /r/neovim | 11 Dec 2023
    Thank you for your suggestions. I have now narrow it down to my terminal emulator. Alacritty. More precisely this issue: https://github.com/alacritty/alacritty/issues/6844

What are some alternatives?

When comparing bash-preexec and alacritty you can also consider the following projects:

trash-d - A near drop-in replacement for rm that uses the trash bin. Written in D

kitty - Cross-platform, fast, feature-rich, GPU based terminal

shellfirm - Intercept any risky patterns (default or defined by you) and prompt you a small challenge for double verification

wezterm - A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust

tlog - Terminal I/O logger

Warp - Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.

LLMShellAutoComplete - Use GPT to complete shell command line using atuin shell history database and terminal screen content as prompt

starship - ☄🌌️ The minimal, blazing-fast, and infinitely customizable prompt for any shell!

snoopy - Snoopy Command Logger is a small library that logs all program executions on your Linux/BSD system.

FiraCode - Free monospaced font with programming ligatures

zsh-merge-hist

neofetch - 🖼️ A command-line system information tool written in bash 3.2+