O que exatamente são comandos? Como identificar? [duplicado]

6

Eu quero saber exatamente o que são comandos do Linux? & como identificar e localizá-los?

Em outras palavras, o que são diferentes tipo / tipo / categoria de comandos? Como identificá-los e localizá-los (fonte).

    
por Pandya 28.05.2014 / 14:40

1 resposta

13

A seguir é do livro The Linux Command Line . O tutorial completo em PDF também está disponível aqui :

A command can be one of four different things:

  1. An executable program like all those files we saw in /usr/bin. Within this category, programs can be compiled binaries such as programs written in C and C++, or programs written in scripting languages such as the shell, perl, python, ruby, etc.

  2. A command built into the shell itself. bash supports a number of commands internally called shell builtins. The cd command, for example, is a shell builtin.

  3. A shell function. These are miniature shell scripts incorporated into the environ- ment. We will cover configuring the environment and writing shell functions in later chapters, but for now, just be aware that they exist.

  4. An alias. Commands that we can define ourselves, built from other commands.

Para identificar o tipo de comando, você pode usar type :

NAME
    type - Display information about command type.

Exemplo:

$ type ls
ls is aliased to 'ls --color=auto'
$ type cd
cd is a shell builtin

Para exibir o local do comando, você pode usar which :

$ which info
/usr/bin/info
$ which init
/sbin/init

Espero que isso seja útil para novos usuários saberem sobre os comandos básicos.

    
por 28.05.2014 / 14:40

Tags