title: bash list postgresql databases over ssh connection
body: <p>I am doing some work on a remote Postgresql database.</p>
  
  <p>When I log into the server this command works on bash:
  <strong>$  psql -c "\l"</strong></p>
  
  <p>Remote login over ssh is possible using:</p>
  
  <pre><code>ssh user@server -C "cd /tmp &amp;&amp; su postgres -c psql"
  </code></pre>
  
  <p>But why doesn't it work from this command?</p>
  
  <pre><code>ssh user@server -C " cd /tmp &amp;&amp; su postgres -c psql -c '\l' "
  →   bash: l: command not found
  </code></pre>
  
  <p>This is working, also "psql -l" but I don't understand why I have to use backslash 3 times here?</p>
  
  <pre><code>ssh user@server -C " cd /tmp &amp;&amp; su postgres -c 'psql -c \\\l' "
  </code></pre>