Linux, file명령어 & strings명령어
-. file [파일명 혹은 디렉토리]
file 명령어 뒤에 파일이름을 넣으면 해당파일의 종류가 출력
[root@localhost ~]#file typescript
typescript: UTF-8 Unicode text, with CRLF, LF line terminators, with escape sequences
여러개 파일의 종류를 보고싶다면 [*] 문자를 사용해주면 됨
[root@localhost ~]#file *
Desktop: directory
anaconda-ks.cfg: ASCII English text
icmp_echo_ignore_all~: ASCII text
install.log: UTF-8 Unicode text
install.log.syslog: empty
rpm_list.txt: UTF-8 Unicode English text
scsrun.log: UTF-8 Unicode text
systest: directory
typescript: UTF-8 Unicode text, with CRLF, LF line terminators, with escape sequences
이는 현재 디렉토리에 있는 모든 파일 종류를 출력 #디렉토리는 디렉토리라는 출력함
-. 데이터파일의 내용보기
[root@localhost ~]#file /var/log/wtmp
/var/log/wtmp: data
이런 데이터파일은 binary형식으로 저장되어 있어 vi나 cat으로 읽기가 힘듬,
[root@localhost ~]#strings /var/log/wtmp
strings명령어로 해당파일을 보면 binary형식 문자는 제외하고 ASCII형식으 문자들만 출력해줌
참조 : 리눅스 서버관리 실무 바이블 3.0(박성수 저)