LinuxCommandLibrary

noti

Send desktop notifications from the command line

TLDR

Display a notification when tar finishes compressing files

$ noti [tar -cjf example.tar.bz2 example/]
copy

Display a notification even when you put it after the command to watch
$ [command_to_watch]; noti
copy

Monitor a process by PID and trigger a notification when the PID disappears
$ noti [[-w|--pwatch]] [process_id]
copy

SYNOPSIS

noti [options] [message]
noti run [options] command [arguments...]
noti exec [options] command [arguments...]
noti success [options] [message]
noti fail [options] [message]
command | noti [options]

PARAMETERS

-t, --title text
    Set a custom title for the notification.

-m, --message text
    Set a custom message for the notification.

-s, --sound name
    Specify a sound to play with the notification (service dependent).

-p, --priority level
    Set the notification priority (service dependent).

-i, --info
    Include system information (e.g., hostname, user) in the notification.

-e, --env
    Include environment variables in the notification details.

-d, --desktop
    Force sending a desktop notification.

-C, --config path
    Specify an alternative configuration file path.

--no-details
    Omit execution details (e.g., duration, exit code) from the message.

--silent
    Do not print the executed command's output to standard output.

--oneshot
    Bypass the configuration file and require direct service flags (e.g., --pushover-token).

--dry-run
    Do not actually send the notification; just print what would be sent.

-V, --verbose
    Enable verbose output for debugging and information.

-D, --debug
    Enable debug output for more detailed logging.

--service name
    Specify a named service from the config file to use.

DESCRIPTION

noti is a powerful command-line utility that sends notifications to various services upon the completion or failure of a command. It is designed to keep you informed about long-running tasks without constantly monitoring your terminal.

It supports a wide array of notification channels, including popular services like Pushover, Pushbullet, Slack, and Telegram, as well as email, desktop notifications, and custom scripts. noti can be used in several ways: by piping the output of a command, by prefixing a command with noti, or by wrapping a command execution. It provides options to send success or failure messages, customize titles and messages, and even play sounds. Configuration is typically managed through a YAML file, allowing for flexible setup of multiple notification services.

CAVEATS

noti relies heavily on external notification services, requiring internet connectivity and proper API key/token configuration for most services. Its initial setup can be complex due to the YAML configuration file, especially when setting up multiple services. Features like custom sounds or specific priorities are service-dependent and may not work across all supported notification channels.
When using noti with long-running background processes, ensure that the environment variables and paths required by noti are correctly inherited, especially if it's sending system-specific information.

CONFIGURATION FILE

noti typically reads its configuration from a YAML file, usually located at ~/.noti.yaml or ~/.config/noti/config.yaml. This file allows users to define and configure multiple notification services (e.g., Pushover, Slack, Telegram, Email, Desktop) with their respective API keys, tokens, and default settings.

USAGE PATTERNS

noti integrates seamlessly with shell scripting. Common usage patterns include:
command && noti success "Command done!" (notify on success)
command || noti fail "Command failed!" (notify on failure)
long_command | noti (send command output as message)
noti run "long_command with args" (wrap execution for auto-notification).

HISTORY

noti is a relatively modern command-line tool, primarily developed by variadico, that gained traction through its open-source presence on platforms like GitHub. It was created to address the common need for command-line users to be asynchronously notified about the status of long-running processes. Its development has focused on expanding support for various notification services and improving ease of configuration, rather than undergoing major historical revisions typical of older Unix utilities.

SEE ALSO

mail(1), notify-send(1), wall(1), cron(8), at(1)

Copied to clipboard