I wanted to set Path for JAVA_HOME for systemwide (all users) in in linux EC2 machine so i tried below
vi /etc/environment
JAVA_HOME=/usr/local/java/jdk1.8.0_221
PATH=$JAVA_HOME/bin:$PATH
When i logout and logged in again i am unable to run any commands in the linux machine and now only Java command is working now.
Below are the message i am getting.How to correct this?
If you need a GUI type startx at the prompt. -bash: id: command not found
-bash: id: command not found
-bash: id: command not found
-bash: tty: command not found
-bash: ls: command not found
/usr/libexec/grepconf.sh: line 5: grep: command not found
-bash: TMOUT: readonly variable
-bash: expor: command not found
[user1#XXXXX ~]$ java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
[user1#XXXXX ~]$ echo $JAVA_HOME
/usr/local/java/jdk1.8.0_221
[user1#XXXXX ~]$ cat /etc/environment
-bash: cat: command not found
[user1#XXXXX ~]$
I am not able to run any Linux command.
It appears that you have overwriten or omitted the base system path. Try this:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
JAVA_HOME="/usr/local/java/jdk1.8.0_221"
PATH="$PATH:$JAVA_HOME/bin"
Related
I use Linux 18.04.4 LTS, and my kerner version is 4.15.0-162-generic.
My Linux server was infected by malware last night, so I run the vaccine program Clamscan and rebooted my server.
After rebooting, I can not use 'sudo' operation.
obiwan#my-server:$ sudo
-bash: /tmp/9CIBU: No such file or directory
obiwan#my-server:$ sudo ls
-bash: /tmp/9CIBU: No such file or directory
But I can run bash without 'sudo' well.
obiwan#my-server:~$ cd /tmp
obiwan#my-server:/tmp$ ls
pymp-sl3fdegr systemd-private-f5c049d24eb946789a05ab83dd7f7cbb-ntp.service-IGqIwU v3init2.log vtmpsmkDEpZ
systemd-private-f5c049d24eb946789a05ab83dd7f7cbb-apache2.service-svZsaz systemd-private-f5c049d24eb946789a05ab83dd7f7cbb-systemd-resolved.service-KiPmpQ vtmpsEsWit4
obiwan#my-server:/tmp$ cat /etc/issue
Ubuntu 18.04.4 LTS \n \l
I tried hard to find any similar cases, but I couldn't find them.
There are many cases where the bash is wrong or the password file of sudo is wrong, but the case where the bash error appears in the sudo command was not found.
I really have no idea why bash needs the /tmp/9CIBU file.
If there is a way to fix it, please let me know.
Thank you a lot.
I've found that if you're developing using a python environment in linux, os.environ["PATH"] and the terminal command echo $PATH output different things.
This originated because I've added a path to .bashrc as follows:
export PATH=/opt/ibm/ILOG/CPLEX_Enterprise_Server1210/CPLEX_Studio/cplex/bin/x86-64_linux:$PATH
Once rebooted, echo $PATH outputs:
/opt/ibm/ILOG/CPLEX_Enterprise_Server1210/CPLEX_Studio/cplex/bin/x86-64_linux:
/home/santi/.local/bin:
/usr/local/sbin:
/usr/local/bin:
/usr/sbin:
/usr/bin:
/sbin:
/bin:
/usr/games:
/usr/local/games:
/snap/bin
This is what's expected. Also, when I call python3 -c 'import os; print(os.environ[ "PATH" ])' from the command line, I get the same result.
However, when I'm on my python environment, the content of os.environ[ "PATH" ] is:
/home/santi/Documentos/Git/GitHub/GridCal/venv/bin:
/home/santi/.local/bin:
/usr/local/sbin:
/usr/local/bin:
/usr/sbin:
/usr/bin:
/sbin:
/bin:
/usr/games:
/usr/local/games:
/snap/bin
How can I access the actual system PATH variable from a python environment?
If it matters I'm on Ubuntu 20.04.
everything was working until I changed my mobo/cpu and I'm not sure what the error message means.
After running the install command
/bin/sh -c "$(curl -fsS https://install.airshipcms.io)"
my windows ubuntu bash shell returns
Starting Airship Launcher installation for ubuntu Linux64
Will install version 2.1.1
Downloading https://install.airshipcms.io/Linux64/airship-2.1.1.tar.bz2
To /tmp/AirshipLauncher.65/airship-2.1.1.tar.bz2
Added ~/.airship-bin to $PATH in ~/.profile
/bin/sh: 504: export: (x86)/Intel/iCLS: bad variable name
My guess was that because I already had it installed pre-upgrade of the mobo/cpu the variable name is already taken in the ~/.profile ? I'm not sure how to edit it, when I ran cat ~/.profile it rendered a bunch of unreadable characters.
thank you.
edit: I've tried reinstalling my linux shell, to no avail.
Okay so the fix is to replace sh with bash so the working command was
/bin/bash -c "$(curl -fsS https://install.airshipcms.io)"
credit goes to this guy https://github.com/probonopd/PowerShell/commit/2441d99a7405b488dc9289789edb636dc2cdcdfc
Using chroot: Why do I get error from running sudo chroot /bin /bash ?
I understand from documentation that chroot should execute /bin/bash and that /bin is the new root directory for this command.
Why do I get an error ?
Here is the terminal output:
nlykkei#nlykkei-ThinkPad-X200s ~ $ sudo chroot /bin /bash
[sudo] password for nlykkei:
chroot: failed to run command ‘/bash’: No such file or directory
I am running Linux Mint 17 64-bit.
You probably meant sudo chroot /bin/bash without the space. If you have the space in, linux will interpret your command as 1 program with 2 arguments, while the chroot command is only expecting 1 argument.
I have installed cygwin to run pig on windows. But it is showing following error.
$ pig -x local
/usr/bin/env: bash: No such file or directory
Have you add pig to your PATH ?
Could you try with the absolut path :
/Users.../pig-12.1/bin/pig -x local