Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to change the gnuplot home directory permanently to a home/user/gnuplot directory without typing

cd home/user/gnuplot

after every gnuplot start?

share|improve this question
Can you explain better what you want. You lost me there for a minute. Where is the gnuplot initially. – Luis Alvarado Feb 16 '12 at 14:29
without doing any settings gnuplot reads data files from the home/user directory but I want a subdirectory for all my data files I want to plot with gnuplot. For plotting a file out of this directory I must change the path to /home/user/gnuplot after every gnuplot start manually. – Mac-Cherony Feb 16 '12 at 14:33
up vote 1 down vote accepted

After looking around I found this link:

Which has the following info:

18 Start-up

When gnuplot is run, it looks for an initialization file to load. This file is called .gnuplot on Unix and AmigaOS systems, and GNUPLOT.INI on other systems. If this file is not found in the current directory, the program will look for it in the HOME directory (under AmigaOS, Atari(single)TOS, MS-DOS, Windows and OS/2, the environment variable GNUPLOT should contain the name of this directory; on Windows NT, it will use USERPROFILE if GNUPLOT isn’t defined). Note: if NOCWDRC is defined during the installation, gnuplot will not read from the current directory.

If the initialization file is found, gnuplot executes the commands in it. These may be any legal gnuplot commands, but typically they are limited to setting the terminal and defining frequently-used functions or variables.

which means that it reads into your home directory if the file is not found BUT it also checks for the GNUPLOT variable which contains the name of this directory. So just jumping into a conclusion I have not tested since I do not have gnuplot but yo might like to try it you can do something like this in the terminal:

GNUPLOT = /home/user/gnuplot that way you set the GNUPLOT variable to that particular value. Before doing this I recommend to see what value GNUPLOT has before. type this: echo $GNUPLOT

the other is creating the file the program is looking for in the directory where the program is (gnuplot.ini) and if this file has some variable that tells it where to read, yo might like to try that other method.

share|improve this answer
Thank you for your answer. I have now created a .gnuplot file and inserted the gnuplot command to open path: cd "\home/user/gnuplot I did not know before, that gnuplot automatically executes this .gnuplot file – Mac-Cherony Feb 16 '12 at 16:34
If it works correctly please accept the answer. If not let us know to continue with the help. – Luis Alvarado Feb 16 '12 at 16:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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