[cmd_test@btjeon-naver ~]$ type type
type is a shell builtin
[cmd_test@btjeon-naver ~]$ type ls
ls is aliased to `ls --color=auto'
[cmd_test@btjeon-naver ~]$ type cp
cp is hashed (/bin/cp)
type 명령어는 쉘에 내장된 형식으로 명령어 이름을 입력하면 쉘이 실행하게 될 명령어가 어떤 타입인지를 보여준다.
[cmd_test@btjeon-naver ~]$ which ls
alias ls='ls --color=auto'
/bin/ls
which 명령어로 실행할 프로그램의 정확한 위치를 파악할 수 있다.
<명령어 도움말 보기>
[cmd_test@btjeon-naver ~]$ help cd
cd: cd [-L|[-P [-e]]] [dir]
Change the shell working directory.
Change the current directory to DIR. The default DIR is the value of the
HOME shell variable.
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. 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,
the word is assumed to be a variable name. If that variable has a value,
its value is used for DIR.
Options:
-L force symbolic links to be followed
-P use the physical directory structure without following symbolic
links
-e if the -P option is supplied, and the current working directory
cannot be determined successfully, exit with a non-zero status
The default is to follow symbolic links, as if `-L' were specified.
Exit Status:
Returns 0 if the directory is changed, and if $PWD is set successfully when
-P is used; non-zero otherwise.
[cmd_test@btjeon-naver ~]$ mkdir --help
Usage: mkdir [OPTION]... DIRECTORY...
Create the DIRECTORY(ies), if they do not already exist.
Mandatory arguments to long options are mandatory for short options too.
-m, --mode=MODE set file mode (as in chmod), not a=rwx - umask
-p, --parents no error if existing, make parent directories as needed
-v, --verbose print a message for each created directory
-Z set SELinux security context of each created directory
to the default type
--context[=CTX] like -Z, or if CTX is specified then set the SELinux
or SMACK security context to CTX
--help display this help and exit
--version output version information and exit
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'mkdir invocation'
[cmd_test@btjeon-naver ~]$ man ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
Mandatory arguments to long options are mandatory for short options too.
-a, --all
do not ignore entries starting with .
-A, --almost-all
do not list implied . and ..
--author
with -l, print the author of each file
-b, --escape
print C-style escapes for nongraphic characters
--block-size=SIZE
scale sizes by SIZE before printing them; e.g., '--block-size=M' prints sizes in units of 1,048,576 bytes; see SIZE format below
-B, --ignore-backups
do not list implied entries ending with ~
-c with -lt: sort by, and show, ctime (time of last modification of file status information); with -l: show ctime and sort by name; otherwise: sort by ctime, newest first
-C list entries by columns
--color[=WHEN]
colorize the output; WHEN can be 'never', 'auto', or 'always' (the default); more info below
-d, --directory
list directories themselves, not their contents
-D, --dired
generate output designed for Emacs' dired mode
-f do not sort, enable -aU, disable -ls --color
-F, --classify
append indicator (one of */=>@|) to entries
--file-type
likewise, except do not append '*'
--format=WORD
across -x, commas -m, horizontal -x, long -l, single-column -1, verbose -l, vertical -C
...
[cmd_test@btjeon-naver ~]$ man 5 passwd
PASSWD(5) Linux Programmer's Manual PASSWD(5)
NAME
passwd - password file
DESCRIPTION
The /etc/passwd file is a text file that describes user login accounts for the system. It should have read permission allowed for all users (many utilities, like ls(1) use it to map user IDs to usernames), but write access
only for the superuser.
In the good old days there was no great problem with this general read permission. Everybody could read the encrypted passwords, but the hardware was too slow to crack a well-chosen password, and moreover the basic assumption
used to be that of a friendly user-community. These days many people run some version of the shadow password suite, where /etc/passwd has an 'x' character in the password field, and the encrypted passwords are in /etc/shadow,
which is readable by the superuser only.
If the encrypted password, whether in /etc/passwd or in /etc/shadow, is an empty string, login is allowed without even asking for a password. Note that this functionality may be intentionally disabled in applications, or con‐
figurable (for example using the "nullok" or "nonull" arguments to pam_unix.so).
If the encrypted password in /etc/passwd is "*NP*" (without the quotes), the shadow record should be obtained from an NIS+ server.
Regardless of whether shadow passwords are used, many system administrators use an asterisk (*) in the encrypted password field to make sure that this user can not authenticate him- or herself using a password. (But see NOTES
below.)
If you create a new login, first put an asterisk (*) in the password field, then use passwd(1) to set it.
Each line of the file describes a single user, and contains seven colon-separated fields:
name:password:UID:GID:GECOS:directory:shell
The field are as follows:
name This is the user's login name. It should not contain capital letters.
password This is either the encrypted user password, an asterisk (*), or the letter 'x'. (See pwconv(8) for an explanation of 'x'.)
UID The privileged root login account (superuser) has the user ID 0.
GID This is the numeric primary group ID for this user. (Additional groups for the user are defined in the system group file; see group(5)).
GECOS This field (sometimes called the "comment field") is optional and used only for informational purposes. Usually, it contains the full username. Some programs (for example, finger(1)) display information from this
field.
GECOS stands for "General Electric Comprehensive Operating System", which was renamed to GCOS when GE's large systems division was sold to Honeywell. Dennis Ritchie has reported: "Sometimes we sent printer output
or batch jobs to the GCOS machine. The gcos field in the password file was a place to stash the information for the $IDENTcard. Not elegant."
directory This is the user's home directory: the initial directory where the user is placed after logging in. The value in this field is used to set the HOME environment variable.
shell This is the program to run at login (if empty, use /bin/sh). If set to a nonexistent executable, the user will be unable to login through login(1). The value in this field is used to set the SHELL environment
variable.
FILES
/etc/passwd
NOTES
If you want to create user groups, there must be an entry in /etc/group, or no group will exist.
If the encrypted password is set to an asterisk (*), the user will be unable to login using login(1), but may still login using rlogin(1), run existing processes and initiate new ones through rsh(1), cron(8), at(1), or mail
filters, etc. Trying to lock an account by simply changing the shell field yields the same result and additionally allows the use of su(1).
<map 페이지 구조>
섹션 | 내용 |
1 | 사용자 명령어 |
2 | 커널 시스템 콜 API |
3 | C 라이브러리 API |
4 | 장치 노드 및 드라이버와 같은 특수 파일 |
5 | 파일 포맷 |
6 | 스크린세이버와 같은 게임이나 미디어 파일 |
7 | 그 외 여러 종류 |
8 | 시스템 관리용 명령어 |
[cmd_test@btjeon-naver ~]$ apropos floppy
fd (4) - floppy disk device
fdformat (8) - low-level format a floppy disk
apropos 명령어는 검색어에 따라 일치하는 명령어의 man 페이지 목록을 검색하는 명령어이다.
(man 명령어를 -k 옵션과 함께 사용하면 apropos 명령어와 동일한 기능을 한다.)
[cmd_test@btjeon-naver ~]$ whatis ls
ls (1) - list directory contents
ls (1p) - list directory contents
whatis 명령어는 특정 키워드에 부합하는 man 페이지에 대하여 그 이름과 한 줄의 간략한 정보를 보여준다.
<별칭으로 나만의 명령어 만들기>
[cmd_test@btjeon-naver ~]$ cd /usr; ls; cd -
bin etc games include lib lib64 libexec local sbin share src tmp
/home/cmd_test
[cmd_test@btjeon-naver ~]$ type foo
-bash: type: foo: not found
[cmd_test@btjeon-naver ~]$ alias foo='cd /usr; ls; cd -'
[cmd_test@btjeon-naver ~]$ foo
bin etc games include lib lib64 libexec local sbin share src tmp
/home/cmd_test
[cmd_test@btjeon-naver ~]$ type foo
foo is aliased to `cd /usr; ls; cd -'
[cmd_test@btjeon-naver ~]$ unalias foo
[cmd_test@btjeon-naver ~]$ type foo
-bash: type: foo: not found
[cmd_test@btjeon-naver ~]$ alias
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias vi='vim'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
출처 : 리눅스 커맨드라인 완벽 입문서
'IT일반 > Linux' 카테고리의 다른 글
Command Line - 고급 키보드 기법 (0) | 2022.05.13 |
---|---|
Command Line - 확장과 인용 (0) | 2022.05.09 |
Command Line - 리다이렉션 (0) | 2022.05.06 |
Command Line - 파일과 디렉토리 복사 (0) | 2022.05.05 |
Command Line - 시스템 살펴보기 (0) | 2022.05.05 |