Setting linux display variable

SET DISPLAY variable

Privet vsem.
Linux from scratch s X11. Sistema imeet 2 video karti. Ne mogu poniat’, kto ustanavlivaet peremennuiu DISPLAY dlia kagdogo monitora. Gde rit?
Zaranee blgodaren.
Tolik.

Re: SET DISPLAY variable

и эта. xorg.conf в студию

SET DISPLAY variable

Da v kurse ia proetu komandu, avtomatom kak mne eto delo vistavit’?

Section «ServerLayout»
Identifier «X.org Configured»
Screen 0 «Screen0» 0 0
InputDevice «Mouse0» «CorePointer»
InputDevice «Keyboard0» «CoreKeyboard»
EndSection

Section «Files»
RgbPath «/usr/X11R6/lib/X11/rgb»
ModulePath «/usr/X11R6/lib/modules»
FontPath «/usr/X11R6/lib/X11/fonts/misc/»
FontPath «/usr/X11R6/lib/X11/fonts/TTF/»
FontPath «/usr/X11R6/lib/X11/fonts/Type1/»
FontPath «/usr/X11R6/lib/X11/fonts/CID/»
FontPath «/usr/X11R6/lib/X11/fonts/75dpi/»
FontPath «/usr/X11R6/lib/X11/fonts/100dpi/»
EndSection

Section «Module»
Load «extmod»
Load «glx»
Load «dri»
Load «dbe»
Load «record»
Load «xtrap»
Load «type1»
Load «freetype»
EndSection

Section «InputDevice»
Identifier «Keyboard0»
Driver «kbd»
EndSection

Section «InputDevice»
Identifier «Mouse0»
Driver «mouse»
Option «Protocol» «auto»
Option «Device» «/dev/mouse0»
EndSection

Section «Monitor»
#DisplaySize 340 270 # mm
Identifier «Monitor0»
VendorName «SAM»
ModelName «SyncMaster»
### Uncomment if you don’t want to default to DDC:
# HorizSync 30.0 — 70.0
# VertRefresh 56.0 — 75.0
Option «DPMS»
EndSection

Section «Device»
### Available Driver options are:-
### Values: : integer, : float, : «True»/»False»,
### : «String», : » Hz/kHz/MHz»
### [arg]: arg optional
#Option «NoAccel» # [ ]
#Option «SWcursor» # [ ]
#Option «Dac6Bit» # [ ]
#Option «Dac8Bit» # [ ]
#Option «BusType» # [ ]
#Option «CPPIOMode» # [ ]
#Option «CPusecTimeout» #
#Option «AGPMode» #
#Option «AGPFastWrite» # [ ]
#Option «AGPSize» #
#Option «GARTSize» #
#Option «RingSize» #
#Option «BufferSize» #
#Option «EnableDepthMoves» # [ ]
#Option «EnablePageFlip» # [ ]
#Option «NoBackBuffer» # [ ]
#Option «PanelOff» # [ ]
#Option «DDCMode» # [ ]
#Option «MonitorLayout» # [ ]
#Option «IgnoreEDID» # [ ]
#Option «UseFBDev» # [ ]
#Option «VideoKey» #
#Option «MergedFB» # [ ]
#Option «CRT2HSync» # [ ]
#Option «CRT2VRefresh» # [ ]
#Option «CRT2Position» # [ ]
#Option «MetaModes» # [ ]
#Option «MergedDPI» # [ ]
#Option «NoMergedXinerama» # [ ]
#Option «MergedXineramaCRT2IsScreen0» # [ ]
#Option «DisplayPriority» # [ ]
#Option «PanelSize» # [ ]
#Option «ForceMinDotClock» #
#Option «RenderAccel» # [ ]
#Option «SubPixelOrder» # [ ]
#Option «ShowCache» # [ ]
#Option «DynamicClocks» # [ ]
Identifier «Card0»
Driver «vesa»
VendorName «ATI Technologies Inc»
BoardName «Unknown Board»
# BusID «PCI:1:0:0»
EndSection

Section «Screen»
Identifier «Screen0»
Device «Card0»
Monitor «Monitor0»
DefaultDepth 24
SubSection «Display»
Viewport 0 0
Depth 24
Modes «1024×768» «800×600» «640×480»
EndSubSection

Источник

How To – Linux Set Environment Variables Command

  1. Configure look and feel of shell.
  2. Setup terminal settings depending on which terminal you’re using.
  3. Set the search path such as JAVA_HOME, and ORACLE_HOME.
  4. Create environment variables as needed by programs.
  5. Run commands that you want to run whenever you log in or log out.
  6. Set up aliases and/or shell function to automate tasks to save typing and time.
  7. Changing bash prompt.
  8. Setting shell options.
Tutorial details
Difficulty level Easy
Root privileges No
Requirements Linux
Est. reading time 11 minutes

Two types of shell variables

  • Environment variables (GLOBAL): Typically, end-users shouldn’t mess with Environment variables as they are available system-wide, and subshells and child processes can access them. In certain scenarios, we can modify them as per our needs. For example, we set up a system-wide path for the JAVA app or PATH for searching binaries. In almost all cases, we use the export command to define or modify environment variables.
  • Shell and user-defined variables (LOCAL) : As the name suggests, these are defined by users and currently apply to the current shell session.

You can use the following commands to view and configure the environment.

Display current environment variables on Linux

The printenv command shows all or the given environment variables. Open the terminal prompt and then type:
printenv
printenv VAR_NAME
printenv PS1
printenv ORACLE_HOME
printenv JAVA_HOME
# use the grep command/egrep command to filter out variables #
printenv | grep APP_HOME
printenv | egrep ‘APP_HOME|DOCKER_HOME|NIX_BACKUP_HOST’

env command

The env command runs a Linux command with a modified environment. The syntax is:

Please note that If no command name is specified following the environment specifications, the resulting environment is displayed on screen. This is like specifying the printenv command as discussed earlier. For example:

How to set and list environment variables in Linux using set command

The env command/printenv command displays only the Linux shell environment variables. What if you need to see a list of all variables, including shell, environment, user-defined shell functions? Try the following set command for printing environment variables:
set
set | grep BASH
Here is what we see:

The $PATH defined the search path for commands. It is a colon-separated list of directories in which the shell looks for commands. The $PS1 defines your prompt settings. See the list of all commonly used shell variables for more information. You can display the value of a variable using the printf command or echo command:

Outputs from the last command displaying my home directory location set by the $HOME environment variable on Linux:
/home/vivek

Источник

Linux List All Environment Variables Command

  1. printenv command – Print all or part of environment.
  2. env command – Display all exported environment or run a program in a modified environment.
  3. set command – List the name and value of each shell variable.
Tutorial details
Difficulty level Easy
Root privileges No
Requirements Linux or Unix
Est. reading time 4 mintues

Linux list all environment variables command

I recommend that you use the printenv command. The syntax is:

Fig.01: Command to see a list of all currently defined environment variables in a Linux bash terminal

A list of the commonly used variables in Linux

We use the printf command/echo command to display values of the shell varible in Linux.

System Variable Meaning To view variable value type
BASH_VERSION Holds the version of this instance of bash. echo $BASH_VERSION
HOSTNAME The name of the your computer. echo $HOSTNAME
CDPATH The search path for the cd command. echo $CDPATH
HISTFILE The name of the file in which command history is saved. echo $HISTFILE
HISTFILESIZE The maximum number of lines contained in the history file. echo $HISTFILESIZE
HISTSIZE The number of commands to remember in the command history. The default value is 500. echo $HISTSIZE
HOME The home directory of the current user. echo $HOME
IFS The Internal Field Separator that is used for word splitting after expansion and to split lines into words with the read builtin command. The default value is . echo $IFS
LANG Used to determine the locale category for any category not specifically selected with a variable starting with LC_. echo $LANG
PATH The search path for commands. It is a colon-separated list of directories in which the shell looks for commands. echo $PATH
PS1 Your prompt settings. echo $PS1
TMOUT The default timeout for the read builtin command. Also in an interactive shell, the value is interpreted as the number of seconds to wait for input after issuing the command. If not input provided it will logou user. echo $TMOUT
TERM Your login terminal type. echo $TERM
export TERM=vt100
SHELL Set path to login shell. echo $SHELL
DISPLAY Set X display name echo $DISPLAY
export DISPLAY=:0.1
EDITOR Set name of default text editor. export EDITOR=/usr/bin/vim

set and env command

You can use the env / set command too:

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

A note about env/set command

The env will only display a list of environment variables that have been exported and it will not show all bash variables. The set command allows you to change the values of shell options and set the positional parameters, or to display the names and values of shell variables. If no options or arguments are supplied, set displays the names and values of all shell variables and functions, sorted according to the current locale, in a format that may be reused as input for setting or resetting the currently-set variables. Hence, I recommend that you use printenv command to dump the list of all shell variables on screen. To save the list of all shell environment variables to a file, enter:

Use the grep command to search for particular variable:

Conclusion

You learned about listing all Linux shell environment variables. See the following resources for more information:

  • Bash shell variables from the Linux shell scripting wiki.
  • See the following man pages using the man command or help command:
    man ‘printenv(1)’
    man 1 bash
    man 1 env

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Category List of Unix and Linux commands
Documentation help • mandb • man • pinfo
Disk space analyzers df • duf • ncdu • pydf
File Management cat • cp • less • mkdir • more • tree
Firewall Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04
Linux Desktop Apps Skype • Spotify • VLC 3
Modern utilities bat • exa
Network Utilities NetHogs • dig • host • ip • nmap
OpenVPN CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04
Package Manager apk • apt
Processes Management bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop
Searching ag • grep • whereis • which
Shell builtins compgen • echo • printf
Text processing cut • rev
User Information groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w
WireGuard VPN Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04

Comments on this entry are closed.

Thank you aref ghobadi Aug 18, 2015 @ 8:33

Thank you for this useful information.

Thank you.It’s really helpful.

Thank you. This is a very informative.

Note that set will show all unexported shell variables (e.g. like PS1 , TMOUT ) whereas env or printenv will not.

Thanks for the input 🙂

With environment variables, what’s the maximum amount of characters a environment variable can have?
and is it possible to set this higher?

The theoretical max length of an environment variable is around 32,760 characters. The maximum size of an environment variable value depends upon execve(). Try:
false | xargs —show-limits
Which gives out:

On my box it went up to 512MiB and failed with the following message (see image here)[1]:

Источник

Читайте также:  Лайв сиди линукс что это
Оцените статью