3

I got access to a cluster running CentOS 7, and I installed Miniconda in it. When I run conda, I get conda: command not found.

Then I realized that the export command does not work, and I cannot add the miniconda3/bin directory to PATH.

$ export PATH="/home/archisman/miniconda3/bin:$PATH"
export: Command not found.

I don't have sudo access.

When I run echo $0 it says: csh.

Is there any way to fix this issue? I want to add the directory containing conda to PATH so that I can use conda without going to that directory.

0

1 Answer 1

4

AFAIK, in shells that use the export command to set environment variables, it is a shell builtin. So if export is not found, you are in a different type of shell.

In your case, echo $0 indicates that your shell is csh, where the equivalent syntax would be

setenv PATH "/home/archisman/miniconda3/bin:$PATH"

However if you are unfamiliar with csh, you will almost certainly find it easier to switch to a more familiar shell such as bash or zsh.

If csh has been set as your login shell by a system administrator, then you can likely change that in CentOS without sudo privileges using the chsh command:

chsh -s /bin/bash

If changing your own login shell in this way is not permitted (because chsh is not setuid root on your system, or /bin/bash is not listed in /etc/shells for example), then the "old school" workaround is to create (or edit, if it already exists) a ~/.login file and exec bash (or exec zsh) from there to immediately replace the login shell each time you start one.

3
  • 1
    chsh -s /bin/bash does not allow me to change shell. The other option works. An alternative is to execute bash in .cshrc. Commented Dec 6, 2021 at 16:12
  • @ArchismanPanigrahi doing it from ~/.cshrc may have unintended consequences if you need to use a non-login csh at any point Commented Dec 6, 2021 at 17:28
  • It’ll break graphical logins, for sure. I saw that a lot at a job where the default shell was csh and was generated from LDAP. There are ways to make it work, you just need to pass the parameters to the new shell. Commented Dec 9, 2021 at 2:05

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.