I love a quote. Now I want every time my computer starts, the quote to be on the screen, like a welcome note.Is there any way to do that in ubuntu 13.04?


You could pop up a simple zenity dialog on login with the content of your quote.

Put the following code into a script then add that script to your "Startup Applications"

zenity --info --text=$quote --title="A Quote"

Using fortune

Install the fortune-mod package (sudo apt-get install fortune-mod) then you can integrate the fortune command into your script like this:

zenity --info --text="$(fortune literature)" --title="A Quote" --no-wrap

You can just add that command to your Startup Applications without putting it in a script.

The literature option is used to specify that you want a quote specifically, otherwise it will give you jokes, riddles and other 'fortunes'.

Note: some of the fortunes are quite long, use --text="$(fortune -s literature)" instead of --text="$(fortune literature)" in the command above to print short quotes only.

Screenshot below: Fortunes in a dialog

Fortune also has many different options to customize the type of quotes you'll get (literature, riddles, etc.) See the fortune man page for more information. To use those options, just change fortune in the command above to fortune SOME_OPTION.

Credits to FreudianSlip for the fortune command

  • 1
    I'm not sure if this is still true, but in unix's of old, the "fortune" command would offer many different phrases/sayings. I'm not on a linux/unix box to test right now, but im sure you'll find references to it. – FreudianSlip Oct 13 '13 at 7:11
  • lost.sourceforge.net works with Fortune to improve your sysadminish skillz. – K7AAY Oct 18 '13 at 7:13
  • @kiloseven of course, you could replace the fortune command with whatever info-like command you have (can find). – kiri Oct 18 '13 at 7:15
  • The last argument that the fortune command takes is an optional file/directory name, so you can create and use your own collection of quotes. I don't remember the exact file format, but it's a very simple text file you can easily maintain using a text editor. – Joe Oct 20 '13 at 3:43
  • If you go with a pop-up, also take a look at yad. It's a zenity replacement with many more features and great support. – Joe Oct 20 '13 at 3:46

If you want to fancy things up (like show a transparent quote on your wallpaper, type in some reminders etc...):

  1. Open terminal by pressing Ctrl+Alt+T
  2. Go to "Edit > Profiles > New".
  3. Give it a name (eg, "quote_of_the_day") and click Create.
  4. Click Edit, go to the colors tab and uncheck "use colors from ...".
  5. Select a text color which will be visible on your desktop wallpaper.
  6. Go to background tab and select Transparent Background and set it to None.
  7. Under Scrolling tab choose "Scrollbar is: Disabled".
  8. You can change font and size from general tab.
  9. Here you may also change columns and rows to about 50 and 5 respectively.
  10. Go to Title and Command and choose keep initial title from the combo box.

Now you've made a terminal profile for the quotes display. enter image description here

Next we will make a compiz setting to put it in our desktop background and remove those shadows and decorations.

  • Open Compiz Config by typing in terminal ccsm (assuming you have it installed)
  • Click Window Rules and do the following: enter image description here

  • Click Place Windows and do the following: enter image description here
  • Note: the 600 x and 100 y positions should be changed according to your screen resolution. (this puts it somewhere in the top right corner)
  • Go to Window Decoration and do the following: enter image description here

Now copy and paste the below script in to gedit and save it as quote_script.py

import commands
from time import sleep
import random

quotefile = "/home/user/Documents/.../quotes.txt"
interval = 10

with open(quotefile,'rb') as data: quotes = data.readlines()
print "\x1b[?25l"+random.choice(quotes)[:-1]

Change quotefile and interval to suit your file location and quote display time.
Go to startup applications by typing in terminal : gnome-session-properties. Add a new one by clicking add and type in:

  • Name:

    Daily Quotes

  • Command:

    gnome-terminal --window-with-profile=quote_of_the_day -e "python /home/user/Documents/.../quote_script.py"
  • Comment:

    Show random quotes at login

That's it! You may try logging out and in again to see the result.

Final Result:

enter image description here
- Experiment with terminal column and row values; Position values, interval, font colors etc. Remember to put quotes in quotes.txt file line by line.

  • Nice answer, and better with python, but not the easiest or simplest answer. I would also suggest disabling 'No focus' and adding a input("Press enter...") to dismiss the dialog manually. Also, isn't 'rb' read binary mode? – kiri Oct 13 '13 at 11:25
  • yes, a good practice for reading unicode characters, control characters etc. r just reads plain text and \n,\t. Also, the quote disappears automatically in 10 secs (user set). – Python Student Oct 14 '13 at 8:20

Let say that you have all your quotes in one file called quotes.txt (each quote on one line) saved somewhere, let say in ~/Documents. Then, using terminal you can do:

  1. Create a new file/script greeting.sh in your ~/bin directory:

    mkdir -p ~/bin #this command will make a bin directory in your home folder if you don't already have it
    gedit ~/bin/greetings.sh
  2. If you want to get a desktop notification, put next 2 lines inside:

    random_line=$(shuf -i 1-$(wc -l < $quotes) -n 1)
    quote=$(sed -n -e "$random_line"p $quotes)
    notify-send "Quote of the day" "$quote"

    Alternatively, if you want a popup (message box) to show up, use zenity instead notify-send:

    zenity --info --title  "Quote of the day" --text "$quote"
  3. Save the file and close it.

  4. Make the file exacutable:

    chmod +x ~/bin/greetings.sh
  5. Search in Dash for Startup Applications, open it and click Add.

  6. Under name type "Show my name and date" or something you will recognise.
  7. Under command type: /home/$USER/bin/greetings.sh (change $USER with your user name).
  8. Under comment (if you want), type a brief description.

Related: How do I show a message with username and date at login?

  • 1
    Your script can be simplified by just using quote=$(shuf -n 1 "$quotes") -- no need for the sed or wc calls, since shuf -n 1 file will give you a random line from a file all by itself. – evilsoup Oct 13 '13 at 13:11

Multiple answers here, none was simple enough for me.

I ended up installing Variety, which can nicely write random quotes on wallpapers for different sources, in my case from a local file.

  • Welcome to AskUbuntu! This answer would be much improved if you were to actually explain how one goes about writing random quotes on wallpapers with Variety. – Elder Geek Dec 8 '19 at 3:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.