Linux/Shell

5. ๋ช…๋ น์–ด์™€ ์นœํ•ด์ง€๊ธฐ

  • ๋ช…๋ น์–ด

- /usr/bin์— ์„ค์น˜๋˜์–ด์žˆ๋Š” ์‹คํ–‰ ํ”„๋กœ๊ทธ๋žจ

- shell์— ๋‚ด์žฅ๋œ ๋ช…๋ น์–ด

- shell ํ•จ์ˆ˜

- ๋ณ„์นญ

 

  • ๋ช…๋ น์–ด ํ™•์ธ
[eunhye@computer ~]$ type cd
cd is a shell builtin
[eunhye@computer ~]$ type ls
ls is /bin/ls
[eunhye@computer ~]$ which cd
/usr/bin/cd
[eunhye@computer ~]$ which ls
/bin/ls

 

 

  • ๋ช…๋ น์–ด ๋„์›€๋ง ๋ณด๊ธฐ
[eunhye@computer ~]$ help cd #help | ์ฐพ๊ณ  ์‹ถ์€ ๋ช…๋ น์–ด(๊ฐ„๋‹จํžˆ)
cd: cd [-L|-P] [dir]
    Change the current directory to DIR.  The variable $HOME is the
    default DIR.  The variable CDPATH defines the search path for
    the directory containing DIR.  Alternative directory names in CDPATH
    are separated by a colon (:).  A null directory name is the same as
    the current directory, i.e. `.'.  If DIR begins with a slash (/),
    then CDPATH is not used.  If the directory is not found, and the
    shell option `cdable_vars' is set, then try the word as a variable
    name.  If that variable has a value, then cd to the value of that
    variable.  The -P option says to use the physical directory structure
    instead of following symbolic links; the -L option forces symbolic links
    to be followed.
์„น์…˜ ๋‚ด์šฉ
1 ์‚ฌ์šฉ์ž ๋ช…๋ น์–ด
2 ์ปค๋„ ์‹œ์Šคํ…œ ์ฝœ API
3 C ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ API
4 ์žฅ์น˜ ๋…ธ๋“œ ๋ฐ ๋“œ๋ผ์ด๋ฒ„์™€ ๊ฐ™์€ ํŠน์ˆ˜ ํŒŒ์ผ
5 ํŒŒ์ผ ํฌ๋งท
6 ์Šคํฌ๋ฆฐ์„ธ์ด๋ฒ„์™€ ๊ฐ™์€ ๊ฒŒ์ž„์ด๋‚˜ ๋ฏธ๋””์–ด ํŒŒ์ผ
7 ๊ทธ ์™ธ ์—ฌ๋Ÿฌ ์ข…๋ฅ˜
8 ์‹œ์Šคํ…œ ๊ด€๋ฆฌ์šฉ ๋ช…๋ น์–ด
[eunhye@computer ~]$ man cd #man | ์ฐพ๊ณ  ์‹ถ์€ ๋ช…๋ น์–ด


BUILTIN(1)                BSD General Commands Manual               BUILTIN(1)

NAME
     builtin, !, %, ., :, @, {, }, alias, alloc, bg, bind, bindkey, break,
     breaksw, builtins, case, cd, chdir, command, complete, continue, default,
     dirs, do, done, echo, echotc, elif, else, end, endif, endsw, esac, eval,
     exec, exit, export, false, fc, fg, filetest, fi, for, foreach, getopts,
     glob, goto, hash, hashstat, history, hup, if, jobid, jobs, kill, limit,
     local, log, login, logout, ls-F, nice, nohup, notify, onintr, popd,
     printenv, pushd, pwd, read, readonly, rehash, repeat, return, sched, set,
     setenv, settc, setty, setvar, shift, source, stop, suspend, switch,
     telltc, test, then, time, times, trap, true, type, ulimit, umask,
     unalias, uncomplete, unhash, unlimit, unset, unsetenv, until, wait,
     where, which, while -- shell built-in commands

SYNOPSIS
     builtin [-options] [args ...]

DESCRIPTION
     Shell builtin commands are commands that can be executed within the run-
     ning shell's process.  Note that, in the case of csh(1) builtin commands,
     the command is executed in a subshell if it occurs as any component of a
:
[eunhye@computer ~]$ man 5 passwd #man | ์„น์…˜ ๋ฒˆํ˜ธ | ์ฐพ๊ณ  ์‹ถ์€ ๋ช…๋ น์–ด


PASSWD(5)                   BSD File Formats Manual                  PASSWD(5)

NAME
     passwd, master.passwd -- format of the password file

DESCRIPTION
     The /etc/passwd file is a legacy BSD 4.3 format file.  It is mostly
     unused, but is updated by some utility programs.  Its format is similar
     to the /etc/master.passwd file, except that it does not contain the
     class, change, and expire fields described below.

     The /etc/master.passwd file comprises newline separated records, one per
     user.  Each line contains ten colon (``:'') separated fields.  These
     fields are as follows:

           name      User's login name.

           password  User's encrypted password.

           uid       User's id.

           gid       User's login group id.
:
[eunhye@computer ~]$ apropos passwd
chkpasswd(8)             - verifies user password against various systems
firmwarepasswd(8)        - tool for setting and removing firmware passwords on a system
htpasswd(1)              - Manage user files for basic authentication
kpasswd(1)               - Kerberos 5 password changing program
kpasswdd(8)              - Kerberos 5 password changing server
ldappasswd(1)            - change the password of an LDAP entry
passwd(1)                - modify a user's password
passwd(5), master.passwd(5) - format of the password file
slapd-passwd(5)          - /etc/passwd backend to slapd
slappasswd(8)            - OpenLDAP password utility
[eunhye@computer ~]$ whatis ls
ls(1)                    - list directory contents
๋ช…๋ น์–ด ์‹คํ–‰
? ๋ช…๋ น์–ด ๋„์›€๋ง ๋ณด๊ธฐ
ํŽ˜์ด์ง€์—… or ๋ฐฑ์ŠคํŽ˜์ด์Šค ์ด์ „ ํŽ˜์ด์ง€ ๋ณด๊ธฐ
ํŽ˜์ด์ง€๋‹ค์šด or ์ŠคํŽ˜์ด์Šค๋ฐ” ๋‹ค์Œ ํŽ˜์ด์ง€ ๋ณด๊ธฐ
n ๋‹ค์Œ - ๋‹ค์Œ ๋…ธ๋“œ ๋ณด๊ธฐ
p ์ด์ „ - ์ด์ „ ๋…ธ๋“œ ๋ณด๊ธฐ
u ์œ„๋กœ - ํ˜„์žฌ ํ‘œ์‹œ๋œ ๋…ธ๋“œ์˜ ์ƒ์œ„ ๋…ธ๋“œ(์ฃผ๋กœ ๋ฉ”๋‰ด) ๋ณด๊ธฐ
์—”ํ„ฐ ํ˜„์žฌ ์ปค์„œ ์œ„์น˜์— ์žˆ๋Š” ํ•˜์ดํผ๋งํฌ๋กœ ์ด๋™ํ•˜๊ธฐ
q ์ข…๋ฃŒํ•˜๊ธฐ
[eunhye@computer ~]$ info coreutils

File: dir       Node: Top       This is the top of the INFO tree
  This (the Directory node) gives a menu of major topics. 
  Typing "d" returns here, "q" exits, "?" lists all INFO commands, "h" 
  gives a primer for first-timers, "mEmacs<Return>" visits the Emacs topic,
  etc.
  In Emacs, you can click mouse button 2 on a menu item or cross reference
  to select it.
  --- PLEASE ADD DOCUMENTATION TO THIS TREE. (See INFO topic first.) ---

* Menu: The list of major topics begins on the next line.

Emacs
* Ada mode: (ada-mode). The GNU Emacs mode for editing Ada.
* Autotype: (autotype). Convenient features for text that you enter frequently
                          in Emacs.
* CC Mode: (ccmode).   Emacs mode for editing C, C++, Objective-C,
                          Java, Pike, and IDL code.
* CL: (cl).             Partial Common Lisp support for Emacs Lisp.
* Dired-X: (dired-x).   Dired Extra Features.
* EUDC: (eudc).   A client for directory servers (LDAP, PH)
* Ebrowse: (ebrowse).   A C++ class browser for Emacs.
* Ediff: (ediff).       A visual interface for comparing and merging programs.
-----Info: (dir)Top, 87 lines --Top---------------------------------------------

- info : 

  • README ๋ฐ ๊ธฐํƒ€ ํ”„๋กœ๊ทธ๋žจ ๋ฌธ์„œ ํŒŒ์ผ๋“ค

 

  • ๋ณ„์นญ์œผ๋กœ ๋‚˜๋งŒ์˜ ๋ช…๋ น์–ด ๋งŒ๋“ค๊ธฐ
[eunhye@computer ~]$ type now
-bash: type: now: not found
[eunhye@computer ~]$ alias now='pwd'
[eunhye@computer ~]$ now
/Users/eunhye

[eunhye@computer ~]$ alias
alias now='pwd'

[eunhye@computer ~]$ unalias now
[eunhye@computer ~]$ type now
-bash: type: now: not found