finding most of the commonly used system utils in UNIX - Unix

This is a discussion on finding most of the commonly used system utils in UNIX - Unix ; Hello all. I am a newbie to UNIX and I'd like to know which directory to look in Unix to find most of the commonly used operating system utility programs?...

+ Reply to Thread
Results 1 to 10 of 10

Thread: finding most of the commonly used system utils in UNIX

  1. finding most of the commonly used system utils in UNIX

    Hello all. I am a newbie to UNIX and I'd like to know which directory
    to look in Unix to find most of the commonly used operating system
    utility programs?


  2. Re: finding most of the commonly used system utils in UNIX

    On Feb 4, 6:51 pm, uraniumore...@hotmail.com wrote:
    > Hello all. I am a newbie to UNIX and I'd like to know which directory
    > to look in Unix to find most of the commonly used operating system
    > utility programs?


    /bin
    /sbin
    /usr/bin
    /usr/sbin
    /usr/local/bin
    /usr/local/sbin




  3. Re: finding most of the commonly used system utils in UNIX

    uraniumore235@hotmail.com wrote:
    > Hello all. I am a newbie to UNIX and I'd like to know which directory
    > to look in Unix to find most of the commonly used operating system
    > utility programs?


    Run the command:
    env | grep '^PATH='
    That will get you a colon ( separated list of directories. Those
    are the directories searched, and the order searched, for commands
    that are "external" (not built-in) to the shell. A null element on
    the PATH list implies the current directory (e.g. if PATH starts or
    ends with : or contains :.


  4. Re: finding most of the commonly used system utils in UNIX

    Michael Paoli wrote:
    > uraniumore235@hotmail.com wrote:
    > > Hello all. I am a newbie to UNIX and I'd like to know which directory
    > > to look in Unix to find most of the commonly used operating system
    > > utility programs?


    > Run the command:
    > env | grep '^PATH='


    Wouldn't

    echo $PATH

    also do the job?

    > That will get you a colon ( separated list of directories. Those
    > are the directories searched, and the order searched, for commands
    > that are "external" (not built-in) to the shell. A null element on
    > the PATH list implies the current directory (e.g. if PATH starts or
    > ends with : or contains :.


    The OP should do that as the root user - normal users usually don't
    have the directories for important system tasks (like /sbin, /usr/sbin
    etc.) in their PATH. And the sheer number of directories in PATH on
    some modern systems can make it a bit difficult to recognize the really
    important ones...
    Regards, Jens
    --
    \ Jens Thoms Toerring ___ jt@toerring.de
    \__________________________ http://toerring.de

  5. Re: finding most of the commonly used system utils in UNIX

    "Michael Paoli" wrote:
    >uraniumore235@hotmail.com wrote:
    >> Hello all. I am a newbie to UNIX and I'd like to know which directory
    >> to look in Unix to find most of the commonly used operating system
    >> utility programs?

    >
    >Run the command:
    >env | grep '^PATH='


    Wha????

    echo $PATH

    Likewise, one can find where any given command actually is with the
    /whereis/ command.

    --
    Floyd L. Davidson
    Ukpeagvik (Barrow, Alaska) floyd@apaflo.com

  6. Re: finding most of the commonly used system utils in UNIX

    2007-02-4, 15:51(-08), uraniumore235@hotmail.com:
    > Hello all. I am a newbie to UNIX and I'd like to know which directory
    > to look in Unix to find most of the commonly used operating system
    > utility programs?


    IFS=:
    set -f
    printf '%s\n' $PATH

    with zsh, shorter:

    print -rl "$path[@]"

    But if you want to know the path of a command, use the "type"
    command or "command -v"

    $ type ls
    ls is /bin/ls
    $ command -v ls
    /bin/ls

    --
    Stéphane

  7. Re: finding most of the commonly used system utils in UNIX

    Jens Thoms Toerring wrote:
    > Michael Paoli wrote:
    > > Run the command:
    > > env | grep '^PATH='

    > Wouldn't
    > echo $PATH
    > also do the job?


    Typically, but not always. Depending upon one's echo, echo may by
    default interpret certain character sequences, and show a less than
    literal representation of PATH. The grep example I showed, however,
    still has an issue if PATH contains newline.

    perl -e '{print "$ENV{PATH}\n"}'


  8. Re: finding most of the commonly used system utils in UNIX

    2007-02-7, 23:10(-08), Michael Paoli:
    > Jens Thoms Toerring wrote:
    >> Michael Paoli wrote:
    >> > Run the command:
    >> > env | grep '^PATH='

    >> Wouldn't
    >> echo $PATH
    >> also do the job?

    >
    > Typically, but not always. Depending upon one's echo, echo may by
    > default interpret certain character sequences, and show a less than
    > literal representation of PATH.


    And leaving $PATH unquoted will make the shell treat it as some
    kind of very special list. So the result is unpredictable.



    *LEAVING A VARIABLE UNQUOTED == VERY SPECIAL LIST => DO NOT!*



    > The grep example I showed, however,
    > still has an issue if PATH contains newline.
    >
    > perl -e '{print "$ENV{PATH}\n"}'


    printf '%s\n' "$PATH"

    expr "x$PATH" : 'x\(.*\)'

    cat < $PATH
    EOF


    --
    Stéphane

  9. Re: finding most of the commonly used system utils in UNIX

    On 2007-02-08, Stephane CHAZELAS wrote:
    >
    > And leaving $PATH unquoted will make the shell treat it as some
    > kind of very special list. So the result is unpredictable.
    >
    >
    >
    > *LEAVING A VARIABLE UNQUOTED == VERY SPECIAL LIST => DO NOT!*
    >
    >


    I'd say PATH is one of the exceptions. A few of my scripts use code of
    the form

    IFS=:
    for i in $PATH
    ...

    In any case IMHO having strange characters in PATH is asking for
    trouble. One of my major critisms of Microsofts "Windows Services
    for UNIX" (somewhat of a misnomer, it's more Unix Services for
    Windows) is that users home directories are in a strange place and
    that path includes spaces. It's reasonable for users to want to
    add ~/bin to their PATHs.

    As a side note, if anyone knows a way to remap the home directories
    to something more sane in the above product I'd be interested to
    hear it. I'll admit I haven't looked at it too much since I try
    and avoid Windows where possible.

    --
    Andrew Smallshaw
    andrews@sdf.lonestar.org

  10. Re: finding most of the commonly used system utils in UNIX

    2007-02-8, 20:30(+00), Andrew Smallshaw:
    > On 2007-02-08, Stephane CHAZELAS wrote:
    >>
    >> And leaving $PATH unquoted will make the shell treat it as some
    >> kind of very special list. So the result is unpredictable.
    >>
    >>
    >>
    >> *LEAVING A VARIABLE UNQUOTED == VERY SPECIAL LIST => DO NOT!*
    >>
    >>

    >
    > I'd say PATH is one of the exceptions. A few of my scripts use code of
    > the form
    >
    > IFS=:
    > for i in $PATH

    [...]

    You need "set -f" as well.

    And it won't work correctly in half the shell (including bash,
    some ksh and some ash), that is shells that consider IFS as a
    field /terminator/ rather than field separator, and in the
    Bourne shell for which a sequence of separators is the same as
    one separator and for which leading and trailing separators are
    ignored.



    IFS=:
    set -f
    var=$PATH:x
    set -- $var
    IFS=:
    set -f
    var=$PATH:x
    set -- $var

    >
    > In any case IMHO having strange characters in PATH is asking for
    > trouble. One of my major critisms of Microsofts "Windows Services
    > for UNIX" (somewhat of a misnomer, it's more Unix Services for
    > Windows) is that users home directories are in a strange place and
    > that path includes spaces. It's reasonable for users to want to
    > add ~/bin to their PATHs.


    What's the problem with spaces in there? The only special
    character in $PATH is ":", so that's the only one that *can't* be
    in a directory component in there.

    --
    Stéphane

+ Reply to Thread