I use Sabayon 14.01 Xfce now, and I find a strange problem with the locale.
When open a new xfce-terminal, echo $LANG will output zh_CN.utf8, and command locale will output similar content.
zh_CN.utf8 is a strange locale variable, this leads gVim's menu content empty(in Chinese).
The normal LANG variable should be zh_CN.UTF-8, and gVim work fine with it.
When execute command source /etc/profile, the strange LANG variable return to normal(zh_CN.utf8 -> zh_CN.UTF-8).
But strange LANG variable still survives when login or in a new xfce-terminal.
So, how to set default LANG variable to be the normal one?
-- UPDATE # 2014-01-18 ---
I re-installed Sabayon xfce and found that the UPDATE lead to this problem.
After re-installed, the locale was the right one, zh_CN.utf-8.
After UPDATE, the locale changed to zh_CN.utf8, in Xfce GUI login.
In tty (alt+ctrl + f1), login and locale , the result is the right one.
-- REPLY TO ZermeX --
I have checked that /etc.locale.gen , /etc/env.d/02locale , /etc/profile, ~/.bashrc, ~/.xprofile and so on for times. These are quite fine.
I am certain of this problem caused by the update. lightdm MAYBE the suspect.
verion update of lightdm:
lightdm gtk greeter: 1.3.1-r1 => 1.6.1~0
lightdm base: 1.4.0 => 1.8.5-r1~0
I also found a quite similar bug been reported to debian: Debian Bug report logs - #735251 lightdm: user locale tweaks are clobbered by non-default locale .But the version of lightdm is higher.
Please run eselect locale list and verify that the correct locale is set.
Also check your ~/.bashrc (or whatever shell you use) if you accidentally overwrite the LANG from /etc/profile in your settings.
-- Reply to UPDATE # 2014-01-18 --
For further help i would like to see the output of the following commands
eselect locale list
cat /etc/locale.gen
cat /etc/env.d/02locale
cat /etc/profile
cat ~/.bashrc
Also it would be helpful to know how you start X. Do you use a graphical display manager or do you run the startx command? Depending on what you use it would also be helpful to see the output of cat ~/.xinitrc or cat ~/.xsession and the display managers configuration files.
Related
I became very interested in Linux and wanted to customize my terminal with ZSH and powerlevel10k, but after changing and logging out, the programming tools disappears. I tried very hard to understand the reason but it did not work. I am not very familiar with the $PATH command and I do not know if it works or not. Thanks for your help.
image link => https://i.stack.imgur.com/BLeLe.jpg
Changing default shell to ZSH can help
first find the path of your ZSh shell.
type -a zsh
then change it
chsh -s /bin/zsh
now log out and log in again. One can close the Terminal app and reopen it.
After digging, I finally realized that the files that were installed with SNAP are not displayed. When I installed the file in Deb format, it became known.
While installing a new RHEL on KVM host I am displaying a text file using more command. Problem is more is behaving like cat in virt-manager i.e. not displaying page-by-page and directly scrolling to the end of the page. I tried using less instead of more but it is displaying the same behavior.
Can anyone suggest what could be the reason for this?
Edit Based on comments I tried changing TERM to xterm during first boot. But that didn't have any effect. I tried this command export TERM=xterm
I got the env variables printed. I am pasting it hoping this might be a clue.
Edit I couldn't get it working. I noticed that before the script is executed, some other script is running and this might be setting some environment variable because of which more isn't working. I am now calling more command before this script start executing. And now it is working.
I suspect your environment is not correct. Specifically your $TERM environment variable may not be set. See here for the more manual entry.
The more command respects the following environment variables, if
they exist:
MORE This variable may be set with favored options to more.
SHELL Current shell in use (normally set by the shell at login
time).
TERM The terminal type used by more to get the terminal
characteristics necessary to manipulate the screen.
VISUAL The editor the user prefers. Invoked when command key v is
pressed.
EDITOR The editor of choice when VISUAL is not specified.
After help from a senior dev, I found out what was happening behind the scenes.
Suppose A.sh is executing more command like below:
more pathtofile
A.sh is being called by some other script like below:
pathtoA.sh | tee
Because of this tee command, more command in child script was not behaving as it should have been.
My gnome-terminal is broken, so is zim and many other programs, the xfce-terminal does not show characters like ö ä or ü. All of them show problems with the locale. I think the problems stems from ill-configured locale settings. For typing "locale" the xfce4-terminal prompts
LANG=C
LC_CTYPE="C"
LC_NUMERIC=aa_DJ.UTF-8
LC_TIME=aa_DJ.UTF-8
LC_COLLATE="C"
LC_MONETARY=aa_DJ.UTF-8
LC_MESSAGES="C"
LC_PAPER=aa_DJ.UTF-8
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT=aa_DJ.UTF-8
LC_IDENTIFICATION="C"
LC_ALL=
This is not what I want. My /etc/locale.conf is set to
LANG=de_DE.UTF-8
My /etc/locale.gen is uncommented such executing "locale-gen" prompts
de_DE.UTF-8... done
de_DE.ISO-8859-1... done
en_US.UTF-8... done
en_US.ISO-8859-1... done
When looking at the environment variables my "locale" produces, it doesn't wonder me too much, that nothing is working as supposed. I don't know why there is "aa_DJ" in these variables, I don't know the language (to be precise, I am not sure which language that is, maybe I speak it ...). However, I really don't know where to change the environment variable permanently (Without putting it in .bashrc) . I tried grepping it in my home folder and after that in root (Recursive on --> grep looked everywhere), but I couldn't find anything.
So my question is: Where or how are these variables defined and how can I change them? I can't find anything that explains it to me. I am aware that there are several people asking similar questions, I tried those solutions but they seem to have different problems (or they solve it with hacking something into .bashrc, which doesn't do the trick here and is not a very meaningful way).
So, the locale you have there seems to be:
Afar - DJIBOUTI (DJ) (aa_DJ)
So, after running locale-gen you need to run localectl list-locales and identify the locale you need.
Finally run:
localectl set-locale LANG=de_DE.UTF-8
NOTE: The German page for locale in Arch linux seems to be outdated
As I found out now, I missed to give an information that might have been useful and which helped me to solve the question. I use the gnome3 desktop env. Gnome3 has its own setting for the locales that overwrites the system standard (and is not saved in plain text I assume, otherwise I should have found it with grep). The solution was to correct the gnome setting via
gsettings get org.gnome.system.locale region 'de_DE.UTF-8'
I want to bind a command to a key-combination in zsh, which is different on OSX and Linux. My current state is
if [[ "$(uname)" == "Darwin" ]]; then
bindkey "^e" some-command # Ctrl+E for OSX
else
bindkey "^[e" some-command # Alt+E for Linux
fi
However, this does not work for ssh connections between those two systems. So actually, I don't want to check in which OS my shell runs in, but rather in which OS my terminal runs in. Is there a way to get that information?
Please don't focus on the details of the keys used in the binding. That's not relevant at this point :)
Edit:
To make things clearer:
The terminal is the thingy, you type your commands in, like Iterm2, Guake or Xterm
The shell is the thingy, that receives and executes the commands like Bash, Zsh or Fish
ssh can send environment variables to the server and does this by default for handful of variables. Although any information on the clients operating system is not part of that default list, it can be extended.
You need to set and export a variable that has the needed information. You can go with the output of uname or you could just copy OSTYPE (You should not use OSTYPE directly, as changing it may not be a good idea). So you need something like this in your ~/.zshrc on both systems (somewhere on top before you need it, of course):
export CLIENT_OSTYPE=${CLIENT_OSTYPE:-$OSTYPE}
This sets CLIENT_OSTYPE to the value of OSTYPE if it was previously unset. So if you log in locally, it will be the set to OSTYPE. But if you log in with ssh it will be set to the CLIENT_OSTYPE that was passed along.
Now you have to set your SSH Clients to actually pass CLIENT_OSTYPE to the server. For that you need to edit the SendEnv entry ssh client configuration - either user specific (~/.ssh/config) or globally (Most likely /etc/ssh/ssh_config on Linux, /etc/ssh_config on Mac):
SendEnv CLIENT_OSTYPE
It may already be set to some value in the global configuration (LANG LC_* in my case), in that case just add to the list:
SendEnv LANG LC_* CLIENT_OSTYPE
Finally, you have to configure the SSH servers to actually accept this environment variable. This can be done in /etc/ssh/sshd_config on Linux and /etc/sshd_config on Mac by modifying AcceptEnv:
AcceptEnv CLIENT_OSTYPE
Similar to SendEnv this may also already be set to something:
AcceptEnv LANG LC_* CLIENT_OSTYPE
You then can use the value of CLIENT_OSTYPE to decide which configuration you want to use.
I'm thinking that the shell command arch might help you out here.
It will also tell you whether you are on a 32-bit or a 64-bit MacOS machine.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
In Ubuntu, I'd like to switch my JAVA_HOME environment variable back and forth between Java 5 and 6.
I open a terminal and type in the following to set the JAVA_HOME environment variable:
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
And in that same terminal window, I type the following to check that the environment variable has been updated:
echo $JAVA_HOME
And I see /usr/lib/jvm/java-1.5.0-sun which is what I'm expecting to see. In addition, I modify ~/.profile and set the JAVA_HOME environment variable to /usr/lib/jvm/java-1.5.0-sun.
And now for the problem--when I open a new terminal window and I check my JAVA_HOME environment variable by typing in echo $JAVA_HOME I see that my JAVA_HOME environment variable has been reverted back to Java 6. When I reboot my machine (or log out and back in, I suppose) the JAVA_HOME environment variable is set to Java 5 (presumably because of the modification I made in my ~/.profile).
Is there a way around this so that I can change my JAVA_HOME environment without having to log out and back in (AND make that environment variable change stick in all new terminal windows)?
Put the environment variables into the global /etc/environment file:
...
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
...
Execute "source /etc/environment" in every shell where you want the variables to be updated:
$ source /etc/environment
Check that it works:
$ echo $JAVA_HOME
$ /usr/lib/jvm/java-1.5.0-sun
Great, no logout needed.
If you want to set JAVA_HOME environment variable in only the terminal, set it in ~/.bashrc file.
This will probably solve your problem:
https://help.ubuntu.com/community/EnvironmentVariables
Session-wide environment variables
In order to set environment variables in a way that affects a particular user's environment, one should not place commands to set their values in particular shell script files in the user's home directory, but use:
~/.pam_environment - This file is specifically meant for setting a user's environment. It is not a script file, but rather consists of assignment expressions, one per line.
Not recommended:
~/.profile - This is probably the best file for placing environment variable assignments in, since it gets executed automatically by the DisplayManager during the startup process desktop session as well as by the login shell when one logs-in from the textual console.
Try these steps.
--We are going to edit "etc\profile".
The environment variables are to be input at the bottom of the file. Since Ubuntu does not
give access to root folder, we will have to use a few commands in the terminal
Step1: Start Terminal. Type in command: gksudo gedit /etc/profile
Step2: The profile text file will open. Enter the environment variables at the bottom of the page........... Eg: export JAVA_HOME=/home/alex/jdk1.6.0_22/bin/java
export PATH=/home/alex/jdk1.6.0_22/bin:$PATH
step3: save and close the file. Check if the environment variables are set by using echo command........ Eg echo $PATH
You need to put variable definition in the ~/.bashrc file.
From bash man page:
When an interactive shell that is
not a login shell is started, bash
reads and executes commands from
/etc/bash.bashrc and ~/.bashrc, if
these files exist.
Traditionally, if you only want to change the variable in your terminal windows, set it in .bashrc file, which is sourced each time a new terminal is opened. .profile file is not sourced each time you open a new terminal.
See the difference between .profile and .bashrc in question:
What's the difference between .bashrc, .bash_profile, and .environment?
.bashrc should solve your problem. However, it is not the proper solution since you are using Ubuntu. See the relevant Ubuntu help page "Session-wide environment variables". Thus, no wonder that .profile does not work for you. I use Ubuntu 12.04 and xfce. I set up my .profile and it is simply not taking effect even if I log out and in. Similar experience here. So you may have to use .pam_environment file and totally forget about .profile, and .bashrc. And NOTE that .pam_environment is not a script file.
Take a look at bash(1), you need a login shell to pickup the ~/.profile, i.e. the -l option.
I know this is a long cold question, but it comes up every time there is a new or recent major Java release. Now this would easily apply to 6 and 7 swapping.
I have done this in the past with update-java-alternatives:
http://manpages.ubuntu.com/manpages/hardy/man8/update-java-alternatives.8.html
After making changes to .profile, you need to execute the file, in order for the changes to take effect.
root#masternode# . ~/.profile
Once this is done, the echo command will work.