Skip to content

Instantly share code, notes, and snippets.

@runlevel5
Last active September 12, 2025 09:36
Show Gist options
  • Save runlevel5/e6d46fede965cf40838d1cb2a5efec15 to your computer and use it in GitHub Desktop.
Save runlevel5/e6d46fede965cf40838d1cb2a5efec15 to your computer and use it in GitHub Desktop.
How to replace GNU coreutils with Rust uutils/coreutils locally in your user account in Fedora?

Run following bash script:

#!/bin/bash

# For binaries
SRC_BIN_DIR="/usr/bin"
DEST_BIN_DIR="$HOME/.local/uubin"

# Ensure destination directory exists
mkdir -p "$DEST_BIN_DIR"

# Find files starting with 'uu_' in $SRC_BIN_DIR
find "$SRC_BIN_DIR" -type f -name 'uu_*' | while read -r src_file; do
    # Get the base filename
    filename=$(basename "$src_file")

    # Strip the 'uu_' prefix
    stripped_name="${filename#uu_}"

    # Copy to destination with new name, preserving attributes
    cp -u --preserve=mode,timestamps "$src_file" "$DEST_BIN_DIR/$stripped_name"

    # Make sure it's executable
    chmod +x "$DEST_BIN_DIR/$stripped_name"
done

echo "All uu_ files copied to $DEST_BIN_DIR with prefix stripped."

# For manual pages
SRC_MAN_DIR="/usr/share/man/man1"
DEST_MAN_DIR="$HOME/.local/share/man/man1"

# Ensure destination directory exists
mkdir -p "$DEST_MAN_DIR"

find "$SRC_MAN_DIR" -type f -name 'uu_*.gz' | while read -r src_file; do
    # Get the base filename
    filename=$(basename "$src_file")

    # Strip the 'uu_' prefix
    stripped_name="${filename#uu_}"

    # Copy to destination with new name, preserving attributes
    ln -sf "$SRC_MAN_DIR/$filename" "$DEST_MAN_DIR/$stripped_name"
done

echo "All uu_ man files linked to $DEST_MAN_DIR with prefix stripped."

then appending the PATH in your rc profile, if you are using bash, it would be ~/.bashrc or ~/.bash_profile:

export PATH="$HOME/.local/uubin:$PATH"

and also override manpages path too:

export MANPATH="$HOME/.local/share/man:"

then reload your shell

for fish shell (which is also written in Rust), it is a bit different but pretty much the same, simply modify ~/.config/fish/config.fish file:

if status is-interactive
  # Commands to run in interactive sessions can go here
  set -gx PATH $HOME/.local/uubin $PATH
  set -gx MANPATH $HOME/.local/share/man:
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment