Useful Linux ideas and tips. Print graphical notifications from a shell script.

To print a graphical notification from a shell script, insert this code.

notify-send "Match Found!"

This will pop up a notification on your desktop, this will alert you to the fact that your shell script has done something.

Make your computer talk. This will speak whatever you type as text.

[email protected]:~$ espeak "I am sorry Dave, I am afraid I cannot do that."

Play Youtube videos the slimline way. The mpv media player can play Youtube links directly. Just give mpv the Youtube URL and it will open.

mpv https://www.youtube.com/watch?v=hctYB7Lpppo

Find all non-free Linux packages that are installed on your Linux system.

vrms() {
    dpkg-query -W -f '${Section}/${Package}\n' \
        | grep -E '^(contrib|multiverse|non-free|partner|restricted)/' \
        | sort
}

This works very well indeed.

[email protected]:~$ vrms 
contrib/fonts/ttf-mscorefonts-installer
contrib/games/chocolate-heretic
contrib/games/chocolate-hexen
contrib/games/chocolate-strife
contrib/games/game-data-packager
contrib/otherosfs/winetricks
non-free/games/doom-wad-shareware
non-free/utils/unrar

This script will play a Youtube video URL that is in the clipboard.

#!/bin/bash
 
notify-send -u low -t 1 'Loading...'
mpv $(xclip -selection clipboard -o)
 
[ "$?" ] || notify-send 'Error Found...'

No comments have been made. Use this form to start the conversation :)

Leave a Reply