"리눅스 command"의 두 판 사이의 차이

 
(사용자 2명의 중간 판 22개는 보이지 않습니다)
6번째 줄: 6번째 줄:
* [[Bash 빌트인 명령어]] 중 하나
* [[Bash 빌트인 명령어]] 중 하나


<source lang='console'>
<syntaxhighlight lang='console'>
root@zetawiki:~# ls
root@zetawiki:~# type command
bulletphp_test.php mylog script
command is a shell builtin
root@zetawiki:~# command ls
</syntaxhighlight>
bulletphp_test.php mylog script
<syntaxhighlight lang='console'>
root@zetawiki:~# command --help
command: command [-pVv] command [arg ...]
    Execute a simple command or display information about commands.
 
    Runs COMMAND with ARGS suppressing  shell function lookup, or display
    information about the specified COMMANDs.  Can be used to invoke commands
    on disk when a function with the same name exists.
 
    Options:
      -p    use a default value for PATH that is guaranteed to find all of
            the standard utilities
      -v    print a description of COMMAND similar to the `type' builtin
      -V    print a more verbose description of each COMMAND
 
    Exit Status:
    Returns exit status of COMMAND, or failure if COMMAND is not found.
</syntaxhighlight>
<syntaxhighlight lang='console'>
root@zetawiki:~# ls /var
backups  cache  lib  local  lock  log  mail  opt  run  spool  tmp  www
root@zetawiki:~# command ls /var
backups  cache  lib  local  lock  log  mail  opt  run  spool tmp www
root@zetawiki:~# command -p ls /var
backups  cache  lib  local  lock  log  mail  opt  run  spool tmp www
</syntaxhighlight>
 
==-v==
* <code>command -v</code>는 대략 [[리눅스 which|which]], [[리눅스 alias|alias]]와 유사하다.
<syntaxhighlight lang='console'>
root@zetawiki:~# command -v sed
/bin/sed
root@zetawiki:~# which sed
/bin/sed
</syntaxhighlight>
<syntaxhighlight lang='console'>
root@zetawiki:~# command -v ls /var
alias ls='ls $LS_OPTIONS'
root@zetawiki:~# command -v ls
alias ls='ls $LS_OPTIONS'
root@zetawiki:~# alias ls
alias ls='ls $LS_OPTIONS'
</syntaxhighlight>
 
==-V==
* <code>command -V</code>는 대략 [[리눅스 type|type]]과 유사하다.
<syntaxhighlight lang='console'>
root@zetawiki:~# command -V sed
sed is hashed (/bin/sed)
root@zetawiki:~# type sed
sed is hashed (/bin/sed)
</syntaxhighlight>
<syntaxhighlight lang='console'>
root@zetawiki:~# command -V ls /var
ls is aliased to `ls $LS_OPTIONS'
-bash: command: /var: not found
root@zetawiki:~# command -V ls
ls is aliased to `ls $LS_OPTIONS'
root@zetawiki:~# alias ls
alias ls='ls $LS_OPTIONS'
root@zetawiki:~# type ls
root@zetawiki:~# type ls
ls is aliased to `ls --color=auto'
ls is aliased to `ls --color=auto'
root@zetawiki:~# which ls
</syntaxhighlight>
/bin/ls
 
</source>
==기타==
<syntaxhighlight lang='console'>
root@zetawiki:~# command l /var
-bash: l: command not found
root@zetawiki:~# command l
-bash: l: command not found
root@zetawiki:~# alias l
alias l='ls $LS_OPTIONS -alA'
root@zetawiki:~# type l
l is aliased to `ls $LS_OPTIONS -alA'
root@zetawiki:~# l /var
total 40
drwxr-xr-x  2 root root  4096 Mar 20  2021 backups
drwxr-xr-x  6 root root  4096 Oct  9 02:24 cache
drwxr-xr-x 21 root root  4096 Jan 29 18:15 lib
drwxrwsr-x  2 root staff 4096 Mar 20  2021 local
lrwxrwxrwx  1 root root    9 Apr  6  2021 lock -> /run/lock
drwxr-xr-x  5 root root  4096 Jan 29 18:15 log
drwxrwsr-x  2 root mail  4096 Apr  6  2021 mail
drwxr-xr-x  2 root root  4096 Apr  6  2021 opt
lrwxrwxrwx  1 root root    4 Apr  6  2021 run -> /run
drwxr-xr-x  4 root root  4096 Apr  6  2021 spool
drwxrwxrwt  2 root root  4096 Feb 21 02:18 tmp
drwxr-xr-x  3 root root  4096 Jan 29 18:15 www
</syntaxhighlight>


==같이 보기==
==같이 보기==
{{z컬럼3|
* [[쉘빌트인]]
* [[쉘빌트인]]
* [[크론탭]]
* [[리눅스 su]]
* [[chroot]]
* [[리눅스 exec]]
* [[exec]]
* [[리눅스 type]]
* [[nohup]]
* [[리눅스 alias]]
* [[source]]
* [[리눅스 watch]]
* [[su]]
* [[리눅스 nohup]]
* [[type]]
* [[리눅스 chroot]]
* [[watch]]
* [[리눅스 syntaxhighlight]]
}}


==참고 자료==
==참고==
* http://ss64.com/bash/command.html
* http://ss64.com/bash/command.html


[[분류: Bash 빌트인]]
[[분류: Bash 빌트인]]

2022년 3월 7일 (월) 02:53 기준 최신판

  다른 뜻에 대해서는 Command 패턴 문서를 참조하십시오.
  다른 뜻에 대해서는 명령어 문서를 참조하십시오.

1 개요[ | ]

리눅스 command
root@zetawiki:~# type command
command is a shell builtin
root@zetawiki:~# command --help
command: command [-pVv] command [arg ...]
    Execute a simple command or display information about commands.

    Runs COMMAND with ARGS suppressing  shell function lookup, or display
    information about the specified COMMANDs.  Can be used to invoke commands
    on disk when a function with the same name exists.

    Options:
      -p    use a default value for PATH that is guaranteed to find all of
            the standard utilities
      -v    print a description of COMMAND similar to the `type' builtin
      -V    print a more verbose description of each COMMAND

    Exit Status:
    Returns exit status of COMMAND, or failure if COMMAND is not found.
root@zetawiki:~# ls /var
backups  cache  lib  local  lock  log  mail  opt  run  spool  tmp  www
root@zetawiki:~# command ls /var
backups  cache  lib  local  lock  log  mail  opt  run  spool  tmp  www
root@zetawiki:~# command -p ls /var
backups  cache  lib  local  lock  log  mail  opt  run  spool  tmp  www

2 -v[ | ]

  • command -v는 대략 which, alias와 유사하다.
root@zetawiki:~# command -v sed
/bin/sed
root@zetawiki:~# which sed
/bin/sed
root@zetawiki:~# command -v ls /var
alias ls='ls $LS_OPTIONS'
root@zetawiki:~# command -v ls
alias ls='ls $LS_OPTIONS'
root@zetawiki:~# alias ls
alias ls='ls $LS_OPTIONS'

3 -V[ | ]

  • command -V는 대략 type과 유사하다.
root@zetawiki:~# command -V sed
sed is hashed (/bin/sed)
root@zetawiki:~# type sed
sed is hashed (/bin/sed)
root@zetawiki:~# command -V ls /var
ls is aliased to `ls $LS_OPTIONS'
-bash: command: /var: not found
root@zetawiki:~# command -V ls
ls is aliased to `ls $LS_OPTIONS'
root@zetawiki:~# alias ls
alias ls='ls $LS_OPTIONS'
root@zetawiki:~# type ls
ls is aliased to `ls --color=auto'

4 기타[ | ]

root@zetawiki:~# command l /var
-bash: l: command not found
root@zetawiki:~# command l
-bash: l: command not found
root@zetawiki:~# alias l
alias l='ls $LS_OPTIONS -alA'
root@zetawiki:~# type l
l is aliased to `ls $LS_OPTIONS -alA'
root@zetawiki:~# l /var
total 40
drwxr-xr-x  2 root root  4096 Mar 20  2021 backups
drwxr-xr-x  6 root root  4096 Oct  9 02:24 cache
drwxr-xr-x 21 root root  4096 Jan 29 18:15 lib
drwxrwsr-x  2 root staff 4096 Mar 20  2021 local
lrwxrwxrwx  1 root root     9 Apr  6  2021 lock -> /run/lock
drwxr-xr-x  5 root root  4096 Jan 29 18:15 log
drwxrwsr-x  2 root mail  4096 Apr  6  2021 mail
drwxr-xr-x  2 root root  4096 Apr  6  2021 opt
lrwxrwxrwx  1 root root     4 Apr  6  2021 run -> /run
drwxr-xr-x  4 root root  4096 Apr  6  2021 spool
drwxrwxrwt  2 root root  4096 Feb 21 02:18 tmp
drwxr-xr-x  3 root root  4096 Jan 29 18:15 www

5 같이 보기[ | ]

6 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}