14

I am using a default installation of FreeBSD, with the C shell (csh).

Suppose I have a command I can run by executing this: /sbin/abc, but cannot run by executing abc. How can I set certain path or something that make abc runnable everywhere?

Eric Leschinski
  • 7,393
  • 7
  • 51
  • 51
Andy Leman
  • 325
  • 1
  • 2
  • 11

2 Answers2

16

Aha, FreeBSD. That's tcsh, I believe.

So:

set path=(/sbin $path)
DigitalRoss
  • 3,208
8

bash & zsh syntax:

export PATH=${PATH}:/sbin

sh syntax (two separate commands):

PATH=${PATH}:/sbin
export PATH

csh and tcsh:

setenv PATH "${PATH}:/sbin"
set path=($path /sbin)

This will append /sbin to your path, so when you type abc, the shell will also look in /sbin for it. You can also add the command to your ~/.bashrc file (or ~/.cshrc, ~/.tcshrc, ~/.profile, ~/.login—depending on which shell you use).

Basil Bourque
  • 1,057
  • 4
  • 15
  • 27
Tim
  • 432