How add "Scripts" path without GUI (Ubuntu Server)

I installed Blender 2.79 on Ubuntu 16.04
I need to add path to my scripts in USER PREFERENCES->FILE->SCRIPTS
With gui it’s simple, but how to do it without?
2 variants

  1. Find Blender text config (where it located?)
  2. Do it via commandline (what command?)

how to do it?

Moved from “General Forums > Blender and CG Discussions” to “Coding > Python Support”

Run ‘blender -h’ and look at the end for the global environment variables that are supported. You should be able to get what you want from that.

Specifically, I’m talking about these environment variables:

Environment Variables:
  $BLENDER_USER_CONFIG      Directory for user configuration files.
  $BLENDER_USER_SCRIPTS     Directory for user scripts.
  $BLENDER_SYSTEM_SCRIPTS   Directory for system wide scripts.
  $BLENDER_USER_DATAFILES   Directory for user data files (icons, translations, ..).
  $BLENDER_SYSTEM_DATAFILES Directory for system wide data files.
  $BLENDER_SYSTEM_PYTHON    Directory for system python libraries.
  $TMP or $TMPDIR           Store temporary files here.
  $SDL_AUDIODRIVER          LibSDL audio driver - alsa, esd, dma.
  $PYTHONHOME               Path to the python directory, eg. /usr/lib/python.

Thanks, but i want to SET, not get.

Before you run Blender (assuming bash):

export BLENDER_USER_SCRIPTS=/path/to/scripts

Alternatively, you could always run Blender using the --python-expr flag and use the Python API to set the path.

I tried to set Env Var via console, and it’s ok.
But i want to set it via parameters for blender or inside python script
I’ve tried following

import bpy
from bpy import context
path = "/somepath"

Printed output is correct, but addon (in script directory) not appears, as if Blender not see this path.

Also i have tried following

bpy.utils.user_resource('SCRIPTS', path='/home/username/myscriptspath', create=False)

no luck.

How to run it via --python-expror something?