Shell built inside and outside part of the command

Built-in command

  • type cd
cd  is  a  shell  builtin

cd command is a built-in command, the command can be viewed by type

  • type -a echo
echo   is  a   shell  builtin
echo  is  /bin/echo

There are also built-in command echo both external commands can be viewed by type -a way

  • history
    a useful built-in command is a command history, command execution can be displayed before, you can bring back these commands to reuse
  • history -a
    command forcibly executed from memory to write the file .bash_history
  • history -n
    for multiple terminals want to update history, history -n command can be executed, it will be forced to re-read .bash_history file.
  • ! 20
    for the command you want to execute, you can enter an exclamation point and the command number in the history list

External command

External commands can be found by which and type the command

  • type -a ps or which ps
/bin/ps

ps is an external command
to command a variety of implementations, both have built-in commands external commands commands such as pwd
To use an external command pwd, you can enter / bin / pwd

Command aliases

  • alias, or alias -p
    alias command is another shell built using the alias command to view currently available
Published 75 original articles · won praise 7 · views 10000 +

Guess you like

Origin blog.csdn.net/zhengdong12345/article/details/100639113