This question already has answers here:
Linux wrong path exported. How to recover ~./bashrc file
(2 answers)
Closed 4 years ago.
First of all, i was installing CUDA with cuDNN, the thing is that i put some new paths on the ~/.bashrc after that all the commands like ls, sudo, etc. doesn't work, it shows this message
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
sudo: command not found
Do anyone knows what is the issue?
You need to include the /usr/bin path in your PATH environment variable because this is where the ls, cd & all others built-in commands are located.
The easiest way is to update your PATH environment variable with the export method :
export PATH="$PATH:/usr/bin"
If the export method doesn't work for you, you can edit your .bashrc file (nano ~/.bashrc) and update the PATH variable by adding the /usr/bin path in it.
Good luck
Related
This question already has answers here:
Doesn't Perl include current directory in #INC by default?
(3 answers)
Closed 3 years ago.
i have a directory with main.pl and Product.pl. in the main.pl i try to import the Product class but the execution fails when i run perl main.pl complaining that cant locate Product.pm in #INC. My directory is not in the #INC list. How can i fix this?
Create a local subdirectory, name it lib and put your module file there. On newer Perls you must tell Perl to include that local directory to #INC, either by adding it to PERL5LIB (environment variable) somehow, or by adding
use lib qw( . );
to the script that wants to load that module. If you are paranoid you can also use an absolute path.
You already got some help in complain that module's filename should end in .pm. Now you need to look for the purpose of variable PERL5LIB=???.
PERL5LIB
This question already has answers here:
How do I make a Rust program which can be executed without using `cargo run`?
(4 answers)
Closed 8 months ago.
I built a simple CLI written in Rust that executes with the command cargo run <ARGUMENTS>. I want to be able to run the CLI from any directory. I used the clap crate and want to be able to call the script with the name passed to clap: brainfast <ARGUMENTS>. I am running on macOS.
This is more like a generic question (and I think a duplicate too, but I can't find any).
You have to copy your executable that is generated by cargo build --release (you can find it in target/release/crate_name) to a folder in your $PATH.
I'm not an expert in macOS, so I can't tell you what is a folder that is included in the $PATH, but you can find that out by yourself by opening a terminal and typing echo $PATH. Use one of the paths and it should be available in your terminal without cargo or using any path.
As an alternative, you can add a folder to your $PATH variable and put it there, e.g.
export PATH /home/foobar/.bin:$PATH
cp target/release/brainfast /home/foobar/.bin
brainfast abc.txt 1 3 99 u
I am trying to run the Swift compiler under Ubuntu. I followed this tutorial: https://itsfoss.com/use-swift-linux/ and everything seemed to work fine. I was able to run swift under Ubuntu.
However, when I closed the terminal, I was not able to run Swift anymore. The program was not found until I installed it again. I could not find any answers to this question as there aren't many people running Swift under Ubuntu.
It's not uninstalled, you just don't have the environment variables set up anymore, so Bash can't find the path to Swift. You can change that by exporting the appropriate environment variables in your .bashrc file.
When you followed the tutorial, you ran the following command:
export PATH=path_to_swift_usr_bin:$PATH
This command adds the path to the swift binary to your PATH environment variable. The PATH variable holds a list of places where Ubuntu will look for programs to run from the command-line. So if the Swift executable is not in one of the places listed in the PATH, your terminal will never find it.
There is a file in your home folder (the folder ~, which is an abbreviation for /home/username, where username is your username) named .bashrc, which runs whenever you open a new terminal window. If you need an environment variable to be available whenever you open the terminal, you should add the export line for that variable to your .bashrc.
In this case, your .basrhc should contain the same line above.
The important thing to remember is that your environment variables are not preserved between command-line sessions, so if you want to have an environment variable available every time you use the command-line, it needs to be defined in your .bashrc.
everyone.
I had a basic question want to consult, about the environment variable setting.
After closed my one existed terminal which could execute compile(make) and do customed(mksdboot) command, i can't do mksdboot command anymore(I had execute a predefined setting environment variable shell script i.e. $ . ./arndale_envsetup.sh again) in the new terminal.
Cause i am a beginner in Linux, i am not very clearly about the environment variable setting rules.
i had tried to 'su' or 'sudo' to execute mksdboot, but no luck:(
ps. I had another project needs to compile in my PC(i didn't export PATH to .bashrc, only execute export PATH when i open a new terminal every time), may it efforts the original project's environment variable?
thanks.
[UPDATED]
i tried using $source ./arndale_envsetup.sh, relative commands worked finally.
but i still did't figure out the reason between work or not work. >"<
The command
history
will list what your previous commands where.
This might give you a pointer what set the path in the way you needed it.
You could also try to see where you command is via
locate mksdboot
I'm followint these instructions to install Kile+TexLive 2010 with package manager on my Ubuntu Maverick: http://ubuntuforums.org/showthread.php?t=141934
The problem I have is that when I finish downloading all the packages to my computer, I have to edit the path but Ubuntu doesn't recognize it. The lines are the following:
PATH=/usr/local/texlive/2005/bin/i386-linux:$PATH
export PATH
I run echo $PATH and as long as I don't close the terminal, the path appears with the echoing, but if I close it, the path disappears. Nevertheless (whether I close the terminal or not), I'm supposed to run texhash but I am told that the command is not found. I already tried editing the path by adding the two lines above to both .bashrc in my home directory and to bash.bashrc in /etc/ directory.
I'm just following the instructions linked above, but I'm a linux rookie. Could anyone help, please?
in order to permanently change any environment variable under Ubuntu/Linux, you must modify the files you mentioned (for example ~/.profile). If you simply issue an export via the terminal, its effect will end once the terminal is closed. Sometime it is needed to perform a logout/login for the changes to take effect.
Also, mind the syntax of what you write in the above mentioned file(s), like "'s around $PATH.
Refer to this question: https://serverfault.com/questions/44275/how-to-add-a-directory-to-my-path-in-ubuntu