A Fish shell plugin that executes commands or displays files while simultaneously copying output to your Wayland clipboard.
cliprun bridges the gap between terminal output and clipboard operations. Execute any command, view its output in your terminal, and have it automatically copied to your clipboard—all in one seamless operation.
Perfect for developers who frequently copy command output, configuration snippets, or file contents for documentation, sharing, or pasting into other applications.
- Dual Output: Displays command output in the terminal while copying to clipboard
- Smart File Handling: Automatically cats non-executable files
- Clean Output: Stderr is filtered out by default for cleaner clipboard content
- Safety First: Prevents accidental directory operations with graceful error messages
- Zero Configuration: Works immediately after installation with sensible defaults
- Fish shell 3.0+
- One of the following clipboard tools:
- wl-clipboard (for Wayland) - provides
wl-copy - xclip (for X11)
- xsel (for X11)
- wl-clipboard (for Wayland) - provides
Arch Linux:
# For Wayland
sudo pacman -S wl-clipboard
# For X11
sudo pacman -S xclip
# or
sudo pacman -S xselDebian/Ubuntu:
# For Wayland
sudo apt install wl-clipboard
# For X11
sudo apt install xclip
# or
sudo apt install xselFedora:
# For Wayland
sudo dnf install wl-clipboard
# For X11
sudo dnf install xclip
# or
sudo dnf install xselfisher install avih7531/fish-cliprunFisher will automatically install the function and shell completions.
Clone this repository and copy files to your Fish config directory:
git clone https://github.com/avih7531/fish-cliprun.git
cd fish-cliprun
cp functions/cliprun.fish ~/.config/fish/functions/
cp completions/cliprun.fish ~/.config/fish/completions/cliprun --help
# or
cliprun -h
# Displays usage information and examplesInclude stderr (-e or --stderr):
By default, stderr is filtered out for cleaner clipboard content. Use this flag to include error output:
cliprun -e gcc program.c
# Includes compilation errors in the output
cliprun --stderr make test
# Shows test errors and warningsQuiet mode (-q or --quiet):
Copy to clipboard without displaying output in the terminal:
cliprun -q date
# Copies date to clipboard silently
cliprun --quiet curl https://example.com
# Fetches and copies without showing outputcliprun ls -la
# Lists directory contents, displays output, and copies to clipboard
cliprun ip addr
# Shows network interfaces and copies output
cliprun date
# Displays and copies current date/timecliprun config.yaml
# Displays file contents and copies to clipboard
cliprun ~/.bashrc
# Cats your bashrc and copies itecho "hello world" | cliprun
# Pipes stdin to clipboard
curl https://api.github.com/zen | cliprun
# Fetches GitHub zen quote and copies it
cat file.txt | grep error | cliprun
# Filter and copy results# Copy your public SSH key
cliprun cat ~/.ssh/id_rsa.pub
# Copy git log for sharing
cliprun git log --oneline -10
# Copy system information
cliprun uname -a
# Copy the contents of a script
cliprun setup.sh| Input | Action | Clipboard |
|---|---|---|
cliprun --help |
Shows help | Nothing |
cliprun (no args) |
Error message | Nothing |
echo "x" | cliprun |
Pipes stdin | Stdin content |
cliprun ls -la |
Executes command | Command stdout |
cliprun file.txt |
Cats the file | File contents |
cliprun ./script.sh |
Executes script | Script output |
cliprun directory/ |
Error (graceful) | Nothing |
- Flag Parsing: Processes options like
--stderrbefore execution - Stdin Detection: If input is piped, processes it directly
- Directory Check: If given a single directory argument, returns an error
- File Detection: If given a single non-executable file, cats it
- Command Execution: Otherwise, treats arguments as a command to execute
- Output Pipeline: All stdout (and optionally stderr) is piped through
teeto display locally and to the clipboard tool
- Clipboard Tool Required: Needs wl-clipboard (Wayland) or xclip/xsel (X11) installed
- Stderr Filtered: Error output is suppressed by default (by design)
- Single Shot: Commands execute once; no interactive mode
Contributions are welcome! Feel free to open issues or submit pull requests on GitHub.
MIT License - see LICENSE file for details.
Created by avih7531