user102764: Sorry, noob question I am new to anything linux related. I managed to set up bitcoin core just fine on my raspberry pi 4 and I have an external HDD that I want to use as my data directory for the 250 GB or so of blocks (this is not my main storage that I boot from). 
Problem is, I have absolutely no idea how the bitcoind program decides on its data directory. I have run 3 or 4 times and I have 3 or 4 different data directories, none of which are on the HDD. How do I tell it where to store the data? Also, where do I put the bitcoin.conf file because it can never seem to find it. I have most of the blockchain pre-installed on my HDD from my windows pc and so I would ideally use that same directory but if thats not possible thats fine, I at least want it on my HDD though. I have followed several guides and nothing has worked for me so far. I appreciate your time for any respones!

user102793: here i have some example script for UTX token ( bitcoind and the friend ) 
example script and manage blockchain
also in that script include block monitoring using bash and qt compare with public blockchain explore node 

user63872: When you start bitcoind, you can specify a non-default data directory:
$ bitcoind datadir=/your/custom/filepath 
This will override the option set in the bitcoin.conf file, if there is one set there. 

user100690: One of the ways of pointing to your data directory is making a change to your bitcoin.conf file (it's usually located in  ~/.bitcoin/bitcoin.conf path)
Add the line:

datadir = /path_to_your_data_directory

If you're on raspberry Pi I highly suggest reading through the Raspibolt documentation, it's step by step installation guide, linking specific chapter related to your question below:
https://stadicus.github.io/RaspiBolt/raspibolt_30_bitcoin.html#prepare-data-directory

user24925: Unless explicitly told otherwise, the datadir is always placed in /home/$USER/.bitcoin, there is no logic for automatically using any location other than this. The configuration file is always in the data directory as bitcoin.conf. 

102764: <p>Sorry, noob question I am new to anything linux related. I managed to set up bitcoin core just fine on my raspberry pi 4 and I have an external HDD that I want to use as my data directory for the 250 GB or so of blocks (this is not my main storage that I boot from). </p>

<p>Problem is, I have absolutely no idea how the bitcoind program decides on its data directory. I have run 3 or 4 times and I have 3 or 4 different data directories, none of which are on the HDD. How do I tell it where to store the data? Also, where do I put the bitcoin.conf file because it can never seem to find it. I have most of the blockchain pre-installed on my HDD from my windows pc and so I would ideally use that same directory but if thats not possible thats fine, I at least want it on my HDD though. I have followed several guides and nothing has worked for me so far. I appreciate your time for any respones!</p>
 102793: <p>here i have some example script for UTX token ( bitcoind and the friend ) </p>

<p><a href="https://github.com/sicute/blockchain" rel="nofollow noreferrer">example script and manage blockchain</a></p>

<p>also in that script include block monitoring using bash and qt compare with public blockchain explore node </p>
 63872: <p>When you start bitcoind, you can specify a non-default data directory:</p>

<p><code>$ bitcoind datadir=/your/custom/filepath</code> </p>

<p>This will override the option set in the <code>bitcoin.conf</code> file, if there is one set there. </p>
 100690: <p>One of the ways of pointing to your data directory is making a change to your bitcoin.conf file (it's usually located in  <code>~/.bitcoin/bitcoin.conf</code> path)
Add the line:</p>

<blockquote>
  <p>datadir = /path_to_your_data_directory</p>
</blockquote>

<p>If you're on raspberry Pi I highly suggest reading through the <code>Raspibolt</code> documentation, it's step by step installation guide, linking specific chapter related to your question below:
<a href="https://stadicus.github.io/RaspiBolt/raspibolt_30_bitcoin.html#prepare-data-directory" rel="nofollow noreferrer">https://stadicus.github.io/RaspiBolt/raspibolt_30_bitcoin.html#prepare-data-directory</a></p>
 24925: <p>Unless explicitly told otherwise, the <code>datadir</code> is always placed in <code>/home/$USER/.bitcoin</code>, there is no logic for automatically using any location other than this. The configuration file is always in the data directory as <code>bitcoin.conf</code>. </p>
