Skip to main content

All Questions

Tagged with
0 votes
2 answers
3k views

Editing bash $PATH

I want to edit my bash $PATH globally for all shells. I was told that I could add/remove stuff from my .bash_profile or .bashrc to do this, but when I look in these files, they are missing folders ...
Cody Rutscher's user avatar
1 vote
0 answers
858 views

Get the normal $PATH when calling it in a subshell

How could I call the $PATH variable in a subshell, such that I get the result I would in the normal shell? [ec2-user@ip-172-31-45-160 ~]$ echo $PATH /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/...
iamAguest's user avatar
  • 503
1 vote
1 answer
175 views

Which is not searching full $PATH

If I run sudo which abc I would expect it to search the superusers $PATH for the program 'abc', but it looks like it only searches a subset. I can see this by running sudo echo $PATH and comparing ...
Jethro's user avatar
  • 113
1 vote
1 answer
5k views

How do I print the path of a file in a different directory

I know that if you have a file one.txt in ~/Documents and you cd ~/Documents then realpath one.txt will print: ~/Documents/one.txt. However what if you want to print the path of a file in a ...
bit's user avatar
  • 1,116
0 votes
2 answers
712 views

Using aria2 instead of curl breaks string concatenation

I am trying to mirror a site to archive.org but using curl is very slow so I wanted to try aria2 instead. I first make a link map of the site using this command wget -c -m --restrict-file-names=...
d-b's user avatar
  • 1,937
1 vote
2 answers
1k views

Storing all environment variables in one file

What are the caveats of having one single file with environment variables? What I would like to do is to create a file (e.g. ~/.env) which contains all necessary PATH declarations and possibly other ...
mikeonly's user avatar
  • 113
-1 votes
2 answers
9k views

Why does sourcing a script in .profile not work?

I have an executable script which I want to run every time I log in or open a new interactive shell. I added the path to this executable in .profile and sourced it by adding this line to .profile ...
bit's user avatar
  • 1,116
0 votes
1 answer
6k views

After starting terminal always getting bash: export: "path" not a valid identifier [closed]

I was trying to install Angularjs through the Ubuntu terminal and to have proper install, I'd to change the path. Maybe during these time I've messed up with the path. After this, when I'm starting ...
Mamun's user avatar
  • 111
3 votes
1 answer
3k views

call bash script in script not found, directory is in $PATH

I have added a directory to my PATH variable to access all my bash scripts. I add the PATH globally on the system under /etc/profile.d/custom.sh as follow: export PATH=$PATH:/usr/local/bin/helper ...
HerrHase's user avatar
0 votes
0 answers
515 views

How to set environment variables to path so it can be read from GUI and command line from the same program?

I installed texlive and I want to add it as an environment variable to my Path so that Emacs AucTeX can read it when I start emacs from the GUI or from the command line. So far I've read that emacs ...
bit's user avatar
  • 1,116
0 votes
2 answers
5k views

Refresh .profile and .bashrc

I've split up my .profile and .bashrc files like so based on various advice I've read. I have an alias bin which I use to refresh my environment after changing .profile and .bashrc to avoid exiting ...
forthrin's user avatar
  • 2,339
3 votes
1 answer
889 views

Why is the "wrong" executable being run? [duplicate]

I am trying to run ipython from the bash (version 4.4.19) command line. As a Python developer, I have various installations of ipython at various versions in various virtualenvs' paths, and so it is ...
jalanb's user avatar
  • 588
4 votes
1 answer
2k views

delete bash hash for particular executable path

I have a command called gmx at these two paths: /usr/local/bin/gmx and /Users/alexamil/.nvm/versions/node/v9.2.0/bin/gmx how can I delete the bash hash for just one of them? if I run: hash -d ...
Alexander Mills's user avatar
1 vote
2 answers
1k views

Adding anaconda path to .bashrc running on Redhat 7 breaks x2go login

I am using x2go to connect to a remote Redhat 7 server running the MATE desktop. The problem I am having is when I add export PATH="/opt/apps/anaconda2/5.0.1/bin:$PATH" to my .bashrc it completely ...
Scott Sisco's user avatar
-2 votes
1 answer
1k views

Which path is a relative pathname in a shell script relative to? [duplicate]

If a bash script contains a relative path ( to specify a file, a directory, ...), which path is the relative path relative to, the pathname to the parent directory of the bash script, or the ...
Tim's user avatar
  • 103k
3 votes
1 answer
369 views

How can I tell if a command is available on the $PATH for sudo?

I installed a utility on a server recently and discovered that it wasn't available when running from sudo. That is, foo executed as expected buy sudo foo resulted in sudo: foo: command not found. I ...
Patrick M's user avatar
  • 245
1 vote
2 answers
2k views

What is the difference between adding to PATH on the CLI vs in bashrc [duplicate]

In an online video lecture the teacher has explained how to add to PATH both on the command line and via .bashrc, and has indicated that the proper way of doing this is through .bashrc but has not ...
shuberman's user avatar
  • 235
1 vote
3 answers
2k views

concise bash script to replace filename in absolute path

I need concise and readable function to be used in bash script which will take as input: absolute path (e.g. /home/user/tmp/data/sample1.txt ) new filename name (e.g. extended_sample.dat ) and ...
NoMoreMrNiceGaius's user avatar
1 vote
0 answers
224 views

Bash Completion ignores changes made to sudo's secure_path

I'd like to add a new path (/usr/lib/cyrus/bin in this example) to root's $PATH (and to sudo's secure_path). I'm in Debian, by the way First, I add it to root's $PATH, using /etc/bash.bashrc. So far ...
ChennyStar's user avatar
  • 1,795
1 vote
3 answers
1k views

Why did this trivial rm -rf command destroy my operating system?

I use Bash 4.3.48(1) and I ran the following command pattern on a testing VPS machine: rm -rf ${drt}/${pma}* This command deleted the entire operating system (Ubuntu). That was evident by executing ...
Arcticooling's user avatar
5 votes
2 answers
10k views

Broken my Debian install: 'sh' not found in PATH

I'm running a custom build of Debian buster/sid. I have broken a lot of things seemingly by mistakenly running apt-get dist-upgrade (I think that's what did it). So the desktop manager\desktop ...
Fearg's user avatar
  • 71
2 votes
2 answers
1k views

urxvt -e doesn't source .zshrc

I want to create a key binding for the common task: open a new terminal window and open the program ranger in it. The obvious command would be something like that: urxvt -e ranger The important ...
Jakube's user avatar
  • 123
2 votes
1 answer
3k views

Flip between openmpi and mpich as default using linux terminal

I need to run a code using mpicc(parallel gcc). A server has two packages of mpicc installed namely OPENMPI and MPICH at /usr/local/OPENMPI and /usr/local/MPICH respectively. By default mpicc of ...
Jithu's user avatar
  • 23
2 votes
1 answer
247 views

Why is a directory added to my PATH?

I am having a very weird issue with my PATH variable. In particular, at some point /usr/lib/hardening-wrapper/bin is added and I would like it not to be. The first thing I did was to check ~/.bashrc, ...
LambdaBeta's user avatar
2 votes
0 answers
2k views

MacOS: Commands working on terminal but not on iTerm [closed]

I installed some packages like brew via terminal which altered $PATH. Now iTerm's $PATH is not same as terminal, causing CLI commands like brew not working on iTerm. echo $PATH on terminal gives: /...
Sagi_Avinash_Varma's user avatar
0 votes
1 answer
2k views

Problems with node path from bash scripts

I'm writing a script which at one point starts a simple node.js based website: cd ../ap-site/ && npm start When I run the above command from terminal there is no problem, but when run from ...
Philip Kirkbride's user avatar
2 votes
2 answers
1k views

Setting paths for interactive C-shell

My default shell (on Ubuntu) is bash. However, for a particular programme I need to change to the C-shell. For this I have a .cshrc file set up, however, if I change interactively to the C-shell (I'm ...
218's user avatar
  • 121
2 votes
1 answer
357 views

How do I change my path when executing a command following a terminal ssh to another machine

For the following please consider that I'm new to the Linux file system and have little understanding here. When I log onto my cluster I do so on a default machine. The admin have setup several ...
Jibbity jobby's user avatar
1 vote
2 answers
5k views

echo $PATH does not reflect the "export PATH" I made in shell script

I have created a shell script that will check if a certain value is existing in PATH. If not, then it will add that value to the PATH environment variable. It was successfully added, based on the ...
john1717's user avatar
  • 113
3 votes
1 answer
2k views

Problem with passing path containing spaces and brackets

I use Thunar file explorer and pass pathname and filename to a script audioplay. audioplay runs play command on my android via ssh which plays a song. audioplay script :: cat audioplay if [ $# -eq ...
jonny789's user avatar
  • 499
1 vote
1 answer
2k views

After editing both /.bashrc and /etc/bash.bashrc the path is not in the environment. Why? [duplicate]

I have installed Eclipse Oxygen;when I type export PATH=$PATH:/home/ivan/java-oxygen/eclipse in the bash, I can launch eclipse from bash from any location, however, no matter whether I add PATH=$...
NiHao92's user avatar
  • 141
0 votes
0 answers
91 views

How to check if a subfolder exists and if so add it to the path automatically on cd? [duplicate]

On my Ubuntu machine, I have a lot of javascript / typescript projects. Each of npm's binary might have a global installation, like tsc at ~/.nvm/versions/node/v7.10.0/bin/tsc $ tsc -v Version 2.4.2 ...
k0pernikus's user avatar
  • 15.7k
2 votes
1 answer
12k views

Why am I unable to successfully export a path within a bash script?

In order to get some C code to compile correctly, I need to export a folder so that are certain file is found. On the command line, if I first run export LD_LIBRARY_PATH=/bin/path../version/:$...
ShanZhengYang's user avatar
14 votes
3 answers
23k views

$HOME/bin dir is not on the $PATH

In my ~/.profile I have a last block which should load my personal bin/ directory like this: # set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:...
user avatar
-1 votes
2 answers
89 views

environment variables set in bash

Team, I have Veritas product installed. When I try to run the veritas commands, I have to use the original path (i.e. /opt/VRTS/bin). Instead of that, can we add the path into our bash profile. I ...
Athiri's user avatar
  • 679
0 votes
1 answer
439 views

Clarification on updating path in bashrc

I am following a tutorial on installing git on a shared host and need some clarification if possible. I have access to the GCC jpols@MrComputer ~ $ ssh nookdig1@***.***.**.*'gcc --version gcc (GCC) ...
JPB's user avatar
  • 105
1 vote
3 answers
132 views

why doesn't PATH work when I add the env in it and want to run a program under the env?

I put a program cow under /opt and then I edited .bashrc by adding export PATH=“$PATH:/opt” so now $PATH has /opt but when I want to run cow directly, I get $ cow The program 'cow' is currently ...
Lily's user avatar
  • 141
4 votes
1 answer
314 views

Linux/bash does not execute the executable that "which" tells me [duplicate]

Observation: I have an executable named foo, located in /b/foo. It is compiled against an old header of a dynamic library, causing it to segfault when executed: $ foo Segmentation fault. // Expected ...
Kevin van As's user avatar
0 votes
1 answer
42 views

Adding #!something doesnt look at PATH

In Linux adding #!/bin/bash is telling the the executable to execute with bash. I was wondering, why is this specified in full path? I would expect that since bin is in a path specified in PATH it ...
Return-1's user avatar
  • 141
3 votes
2 answers
3k views

How to make a self-made bash_profile recognized by the terminal?

My intention is to customize the prompt color and font style of the terminal. There are a couple of tutorials online on this subject but all of them involves a modification of the file bash_profile ...
nougako's user avatar
  • 131
4 votes
1 answer
3k views

mv : not found when executed from script that modifies PATH variable

I have this in my script. But is returning an error. If I execute the command in the console works fine ./script.sh[16]: mv: not found [No such file or directory] I want move some files what starts ...
userGuest's user avatar
1 vote
0 answers
65 views

Who sets $PATH environment variable? [duplicate]

After installation of linux distribution, I see PATH environment variable set with some standard folders holding some binaries only PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/...
overexchange's user avatar
  • 1,546
0 votes
1 answer
4k views

How do I pass a file path to a function instead of the contents of the file?

I'm using bash shell on Ubuntu Linux. I have this in my script output_file=create_test_results_file "$TFILE1" Through echo statements, I have verified that the value of $TFILE1 is a file path, e.g. ...
Dave's user avatar
  • 2,598
2 votes
5 answers
9k views

Script to go through $PATH folders and see what executable files are available on your system

Here is what I have so far: #!/bin/bash for file in $PATH ; do # Scanning files in $PATH if [ -x ] ; then #Check if executable echo "Executable File" else ...
Tyler's user avatar
  • 21
2 votes
1 answer
2k views

Exclude single executable from PATH, without chmod -x it

I'm trying to remove a single executable from $PATH, without modifying it e.g I have /Users/USER/Library/Python/2.7/bin/ in $PATH, and I'd like to exclude services.py from that directory. I know ...
daisy's user avatar
  • 54.8k
-1 votes
1 answer
2k views

Alternative to typing the path for /sbin/ifconfig [duplicate]

Everytime I need to access ifconfig , I find using using /sbin/ifconfig. If I need to directly type ifconfig in bash and get the required output without calling the directory every time, what should I ...
gadsater's user avatar
6 votes
2 answers
41k views

How to find and run a bash script?

I have a script named script.sh. I don't know where it is in the file system, but I do know it exists. How do I find the script, make it executable, and run it all in one line through the command ...
Pythoncoder's user avatar
3 votes
2 answers
204 views

add subdirectories to $PATH in bash using find

I tried this PATH=$PATH$( find $HOME/scripts/ -type d -printf ":%p" ) but it works only on Linux, on OSX (or Freebsd), it's not working because -printf is not POSIX. How can I write a compatible ...
del bao's user avatar
  • 303
4 votes
1 answer
51 views

$PATH referring to network fs: generally useful, occasionally horrible

Some of the scripts I run are located on a CIFS filesystem hosted on another machine. I mount that filesystem over the network and add the remote location of the scripts to my $PATH. This works great ...
Aaron Brick's user avatar
1 vote
1 answer
3k views

PATH variable for anaconda in Fedora [closed]

After installing Anaconda in /opt/anaconda3 i modified ~/.bashrc for my user by adding PATH variable # .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # ...
kswr's user avatar
  • 19

15 30 50 per page