Passa al contenuto principale

2. Some commands about commands

  1. The command type displays a command's type:

    type type
    type ls
    type cp

    The command cp is an executable program located on /usr/bin/cp.

  2. The command which displays the location of an executable:

    which ls
    which cd

    The command cd is not an executable but a shell builtin command.

    type cd
  3. The command help displays a help page for the shell builtin commands:

    help cd
    help mkdir

    The command mkdir is not a shell builtin.

  4. The option --help displays usage information:

    mkdir --help
  5. The command man displays the manual page of a program:

    man ls

    Manual pages are organized into different sections, where section 1 for example is about user commands, and section 5 is about file formats. So, these two commands will display different manual pages:

    man passwd
    man 5 passwd
  6. The command info is another way to display manual pages:

    info coreutils
    info passwd
  7. The command apropos displays appropriate commands:

    apropos passwd

    This is the same as:

    man -k passwd

    It makes a simple search on man pages for the term "passwd".

  8. The command whatis displays a very brief description of a command:

    whatis ls
  9. The command alias is used to create new commands.

    alias --help
    alias
    type alias
    type ls
    cd /usr; ls; cd -
    type foo
    alias foo="cd /usr; ls; cd -"
    type foo
    foo
    unalias foo
    type foo
Loading asciinema cast...