Linux

[Linux] file / type 명령어 사용법

IT-PAPA 2023. 2. 17. 06:30
반응형

개발 및 운영을 하는 IT인이라면, file 명령어 또는 ultra edit, acroedit 등을 이용하여 인코딩을 알 수도 있고, 인코딩 변환을 할 수 있다.

필자는 리눅스 기반 OS를 많이 들어가서 운영하고 있기 때문에, file이라는 명령어를 간혹 사용하곤 한다.

file 명령어를 잘 숙지하고, 간단한 것만 알아두어도 많은 도움이 될 것 이다.

file 명령어

file [옵션] [파일명]
Option Description
-C 매직파일의 포맷을 검사
-f 많은 파일을 한번에 확인하기 위한 파일리스트를 만들어서 여러개의 파일을 한번에 할때
-m 매직파일을 지정
-z 압축된 파일에 사용
-L 심볼릭 링크의 사용
master@master:~$ file
Usage: file [-bcCdEhikLlNnprsSvzZ0] [--apple] [--extension] [--mime-encoding]
            [--mime-type] [-e <testname>] [-F <separator>]  [-f <namefile>]
            [-m <magicfiles>] [-P <parameter=value>] <file> ...
       file -C [-m <magicfiles>]
       file [--help]
master@master:/etc/nginx$ file ./*
./conf.d:            directory
./fastcgi.conf:      ASCII text
./fastcgi_params:    ASCII text
./koi-utf:           ASCII text
./koi-win:           ASCII text
./mime.types:        ASCII text
./modules-available: directory
./modules-enabled:   directory
./nginx.conf:        ASCII text
./nginx.conf.org:    ASCII text
./proxy_params:      ASCII text
./scgi_params:       ASCII text
./sites-available:   directory
./sites-enabled:     directory
./snippets:          directory
./uwsgi_params:      ASCII text
./win-utf:           ASCII text

file ./* 명령어
file ./* 명령어
file ./* 명령어
file ./* 명령어

반응형

type 명령어

type은 지정된 명령어가 shell에 내장된 명령어인지, 외부명령어인지, alias 명령어인지 등을 확인하는 명령어이다

master@master:/etc/nginx$ type test
test 는 쉘 내장임
master@master:/etc/nginx$ type apt
apt 는 /usr/bin/apt 임
master@master:/etc/nginx$ type java
java 는 /usr/lib/jvm/java-8-openjdk-amd64/bin/java 임
master@master:/etc/nginx$ type nginx
nginx 는 /usr/sbin/nginx 임
master@master:/etc/nginx$ type sudo
sudo 는 /usr/bin/sudo 임
master@master:/etc/nginx$ type ps
ps 는 /usr/bin/ps 임

 

728x90
반응형
LIST