학습목표
- 리눅스 파일의 종류와 특징을 설명할 수 있다.
- 디렉토리 계층 구조를 보고 절대 경로명과 상대경로명을 작성할 수 있다.
- 디렉토리를 이동하고, 디렉토리의 내용을 확인할 수 있다.
- 디렉토리를 만들고 삭제할 수 있다.
- 다양한 명령으로 파일 내용을 확인할 수 있다.
- 파일을 복사/이동/삭제 할 수 있다.
- 파일 링크의 특징을 설명하고, 하드링크와 심볼릭 링크를 만들 수 있다.
- 파일의 내용과 위치를 검색할 수 있다.
1) 일반 파일 : 텍스트 파일, 실행파일, 이미지 파일 등 주로 데이터를 저장
2) 디렉토리
3) 심볼릭 링크
4) 장치 파일
filefile .profile /// .profile : ASCII text
file 다운로드 // 다운로드 : directory
file /bin/bash // ~~ executable(실행파일)
| 디렉토리 | 기능 |
|---|---|
| home | 사용자 홈 디렉토리가 생성되는 디렉토리이다 |
| root | root 계정의 홈 디렉토리다. 루트(/) 디렉토리와 다른 것이므로 혼동 x |
| usr | 기본 실행 파일과 라이브러리 파일, 헤더 파일 등 많은 파일 존재 |
| etc | 리눅스 설정을 위한 각종 파일을 가지고 있다 |
| proc | 프로세스 정보 등 커널 관련 정보가 저장되는 디렉토리 |
| tmp | 시스템 사용 중에 발생하는 임시 데이터가 저장된다. 이 디렉토리에 있는 파일은 재시작하면 모두 삭제된다. |
| 구분 | 특징 |
|---|---|
| 절대 경로명 | · 반드시 / 로 시작한다. · 루트 디렉토리부터 시작하여 특정 파일이나 디렉토리의 위치에 이르기까지 중간에 있는 모든 디렉토리의 이름을 표시한다. · 특정 위치를 가리키는 절대 경로명은 항상 동일하다 |
| 상대 경로명 | · / 이외의 문자로 시작한다. · 현재 디렉토리를 기준으로 서브 디렉토리로 내려가면 그냥 서브 디렉토리명으로 시작한다. · 현재 디렉토리를 기준으로 상위 디렉토리로 가려면 ..(마침표 두개) 로 시작한다. · 상대 경로명은 현재 디렉토리가 어디냐에 따라 달라진다. |
-, _, . 사용 가능 >, |, :, & 와 공백문자의 사용은 피하는 것이 좋다.. 로 시작하면 숨긴 파일로 간주한다.'\0' 를 사용하지 않는다.: pwd
: cd
cd ~ 또는 cd# 절대 경로명 사용
$ cd /tmp
# 상대 경로명 사용
$ cd ../usr/lib
: ls
1) 형식 : ls [옵션] [디렉토리(파일)]
2) 옵션 :
-a : 숨김 파일을 포함하여 모든 파일의 목록을 출력-i : 첫 번째 행에 inode 번호를 출력-l : 파일의 상세 정보를 출력-F : 파일의 종류를 표시한다(* : 실행파일, /: 디렉토리, @: 심볼릭 링크)-R : 하위 디렉토리의 목록까지 출력: mkdir
1) 형식 mkdir [옵션] [디렉토리]
2) 옵션 -p : 하위 디렉토리를 계층적으로 생성할 떄 중간 단계의 디렉토리가 없으면 자동으로 중간 단계의 디렉토리를 생성하고 지정한 디렉토리를 생성한다.
# 중간 디렉토리 자동 만들기 : mkdir -p
cd tmp
mkdir -p a/b/c/d/e
mkdir -p a/c/d/e
mkdir -p a/d/e
mkdir -p a/e
tree a
: rmdir
1) 형식 rmdir [옵션] [디렉토리]
2) 옵션 -p : 지정한 디렉토리를 삭제하고, 그 디렉토리의 부모 디렉토리가 빈 디렉토리일 경우 부모 디렉토리도 자동으로 삭제한다.
# 빈 디렉토리가 아니면 삭제 불가
rmdir tmp3
: cat
1) 형식 : cat [옵션] [파일]
2) 옵션 -n : 행 번호를 붙여서 출력한다.
cat file1
: more
1) 형식 more [옵션] [파일]
2) 옵션 + 행 번호 : 출력을 시작할 행 번호를 지정한다.
: less
1) 형식 : less [파일]
more /etc/services
less /etc/services
: tail
1) 형식 tail [옵션] [파일]
2) 옵션
+ 행 번호 : 지정한 행부터 끝까지 출력한다.-숫자 : 화면에 출력할 행의 수를 지정한다.(기본값은 10)-f : 파일 출력을 종료하지 않고 주기적으로 계속 출력한다.tail -f # 파일 내용을 주기적으로 반복 출력
tail -7 /etc/services
: cp
1) 형식 : cp [옵션] [파일1(디렉토리1)] [파일2(디렉토리2)]
2) 옵션 :
-i : 파일2가 이미 존재한다면 덮어쓸 것인지를 물어본다-r : 디렉토리를 복사할 떄 지정한다.# 두 인자가 모두 파일인 경우
# 파일 a를 파일 b로 복사, b가 있으면 덮어쓸지 확인한다.
cp -i file.a file.b
# 두 번째 인지가 디렉토리인 경우
# file.a 을 dir.b 디렉토리 아래로 복사
cp file.a dir.b
# 인자를 여러갸 지정할 경우 : 파일 a,b 를 dir.b 밑으로 모두 복사
cp file.a file.b dir.a
# 파일 a 를 dir.b 아래의 file.b 로 복사
cp file.a dir.b/file.b
# 쓰기 권한이 없는 디렉토리로 복사할 경우 -> 허가 거부
cp text1 /etc
# 디렉토리 복사하기 : dir.a 의 내용을 dir.b 로 모두 복사
cp -r dir.a dir.b
: mv
1) 형식 mv [옵션] [파일1(디렉토리1)] [파일2(디렉토라2)]
2) 옵션 : -i : 파일2(디렉토리2) 가 존재하면 덮어쓸 것인지 물어본다.
# 파일을 파일로 이동하기(파일명 수정) : file.a를 file.b로 이름을 바꾸고 확인
mv -i file.a file.b
# 여러 파일을 다른 디렉토리로 이동하기 : file.a와 file.b를 dir.b로 이동
mv file.a file.b dir.b
# 파일을 다른 디렉토리로 이동하고 이름 바꾸기 : file.a 를 dir.b 로 이동하고 file.b 로 이름 바꾸기
mv file.a dir.b/file.b
# dir.b 가 새로운 이름이라면 dir.a 를 dir.b 로 이름을 바꿈.
# dir.b 가 이미 존재하는 이름이면, dir.a 를 dir.b 로 아래로 이동.
mv dir.a dir.b
: rm
1) 형식 : rm [옵션] [파일 또는 디렉토리]
2) 옵션 :
-i : 파일을 정말 삭제할 것인지를 확인-r : 디렉토리를 삭제할 떄 지정한다.# 파일 삭제 : file.a 를 삭제하기 전에 다시 한번 확인
rm -i file.a
# 파일 삭제 : file.a 를 무조건 삭제
rm -f file.a
# 디렉토리 삭제 : dir.a 를 삭제, 파일이 있어도 삭제함
rm -r dir.a
ls -i: 기존 파일에 새로운 이름을 붙이는 것
ln (한 파일에 여러개의 이름 붙이기)
1) 형식 ln [옵션] [원본 파일] [링크 파일]
2) 옵션-s : 심볼릭 링크 파일을 생성한다.
# file.a 를 file.b 로 하드 링크 생성
ln file.a file.b
# file.a 를 file.b 로 심볼릭 링크 생성
ln -s file.a file.b
# dir.a 를 dir.b 로 심볼릭 링크 생성
ln -s dir.a dir.b

심볼릭 링크는
하드링크는
원본 파일이 삭제된다면 하드 링크는 그대로 존재하나, 심볼릭 링크는 파일이 존재하지 않게 됨.
: touch
1) 형식 touch [-acm] [-r ref_file | -t time] [파일]
2) 옵션 :
-a : 접근 시간만 변경한다.-m : 수정 시간만 변경한다.-t [[CC]YY]MMDDhhmm[.ss] : 시간을 직접 입력한다.touch file.a # file.a를 생성, default로 access, modify time을 변경
touch -a file.a # file.a의 access time를 현재시간으로 바꿈
touch -m file.a # file.a의 modify time을 현재시간으로 바꿈
# file.b의 change time은 현재 시간으로 정해짐
touch -t 200101010000 file.a # file.a의 time을 2001.01.01 00:00 으로 수정
#- access time: file에 마지막으로 read한 시간
# cat/more/tail로 읽으면 access time만 바뀜
#- modify time: file을 마지막으로 write 한 시간
#- change time: file의 내용 or inode가 마지막으로 바뀐 시간
# chmod/chown/chgrp/touch로 바꾸면 변경
# Modify time 과도 함께 변함.
지정한 파일의 내용 중 특정 문자열(패턴)이 포함된 행을 검색
패턴 : 문자, 문자열, 문장, 정규표현식
1) 형식 grep [옵션] [패턴] [파일]
2) 옵션 :
-i : 대소문자 무시하고 검색한다.-l : 지정한 패턴이 포함된 파일 이름을 출력한다.-n : 각 행 번호도 함꼐 출력한다.-v : 명시된 패턴과 일치하지 않는 줄을 출력-c : 패턴과 일치하는 라인 수 출력-w : 패턴이 하나의 단어로 된 것만 검색정규표현식
특정한 규칙을 가진 문자열의 집합을 표현하는데 사용하는 형식 언어
1) 구성요소
- 앵커(Anchor) : 검색시 한 줄에서 패턴의 위치를 표현 (
^,$)- 문자 집합(Char Set) : 하나 이상의 문자들을 표현(
알파벳,숫자,.,[],..)- 변환자(Modifier) : 이전 문자 집합의 반복 횟수 지정(
*)2) 특수문자
3) 사용예 -> grep.dat
UNIX 12345 unix+ 123 Linux root linux rott system admin Network 5 root other sh sjyoun root ksh jongwon prof ksh ROOT other csh ck07555 Student ksh CK08777 student bash
##### 1. 문자, 문자열 패턴 #####
grep unix grep.dat #grep.dat 에서 unix 라는 패턴이 포함된 행 검색
# unix+ 123
grep -i unix grep.dat #대소문자 무시하고 검색
# UNIX 12345
# unix+ 123
grep -l unix grep.dat #unix 라는 패턴이 포함된 파일 이름 출력
# grep.dat
grep -n unix grep.dat #unix 라는 패턴이 포함된 행을 행 번호와 함께 출력
# 2: unix+ 123
grep -v unix grep.dat #unix 라는 패턴과 일치하지 않는 줄 출력
# UNIX 12345
# Linux root
# ...
grep -c 123 grep.dat #123 라는 패턴과 일치하는 라인 수 출력
# 2
grep -w unix grep.dat #unix 라는 하나의 단어로 검색되는 것만 출력
# unix+ 123
##### 2. 정규표현식 패턴 #####
grep '^root' grep.dat # 'root' 라는 문자열로 시작하는 모든 행 출력
# root other sh
grep 'sh$' grep.dat # 'sh' 라는 문자열로 끝나는 모든 행 출력
# root other sh
# sjyoun root ksh
# jongwon prof ksh
# ROOT other csh
# ck07555 Student ksh
# CK08777 student bash
grep 'r..t' grep.dat # r 로 시작하고 t 로 끝나는 4글자 단어가 포함된 행 출력
# Linux root
# linux rott
# root other sh
# sijyoun root ksh
grep 'oo*' grep.dat # 'ab' 뒤에 0개 이상의 'b' 문자가 오는 문자열이 포함된 행 검색 -> 'a' 'ab' 'abb' 등 검색
# Linux root
# linux rott
# Network 5
# root other sh
# sjyoun root ksh
# jongwon prof ksh
# ROOT other csh
grep '[5-9].*' grep.dat # '5' 에서 '9'까지의 숫자 중 하나로 시작하는 문자열(패턴) 이 포함된 행 출력
# UNIX 12345
# Network 5
# ck07555 Student ksh
# CK08777 student bash
grep ‘^u[a-z]x’ f.a # u로 시작하고 가운데글자가 a~z이고 x로 끝나는
grep ‘^u[^a-z]x’ f.a # u로 시작하고 가운데글자가 a~z가 아니고 x로 끝나는
- ls-l 결과를 파이프로 뒤의 명령어로 전달하여 'rw-' 라는 패턴이 포함된 행 출력
- 현재 실행중인 모든 프로세스 정보에서 tmskim 이라는 패턴이 포함된 행 출력
: 지정한 경로에서 검색 조건에 맞는 파일 찾기
1) 형식 find [경로] [검색 조건] [동작]
2) 검색 조건 :
-a (and), -o (or), ! (not)| 검색조건 표현 | 의미 | 기능 |
|---|---|---|
| ★-name filename | 파일 이름 | 특정 파일명에 일치하는 파일 검색 메타문자( *, ?) 사용도 가능, 예) host*, 'host*', "host*" 모두 가능 |
| ★-type | 파일 종류 | 특정 파일 종류에 일치하는 파일 검색 f - 일반 파일,d - 디렉토리,i- 타입이 inode인 파일,l - ,s - |
| -mtime (+,-)n -atime (+,-)n -mmin (+,-)n -amin (+,-)n | 수정(접근)시간 | 수정(접근) 시간이 +n 일 보다 오래되거나, -n 일보다 짧거나, 정확히 n일에 일치하는 파일 검색 |
| ★-usr loginID | 사용자ID | loginID 가 소유한 파일 모든 파일 검색 |
| -size (+,-)n | 파일 크기 | + n 보다 크거나, - n 보다 작거나, 정확히 크기가 n 인 파일 검색 |
| -newer | 기준 시간 | 기준 시간보다 이후에 생성된 파일 검색 |
| ★-perm | 사용 권한 | 사용 권한과 일치하는 파일 검색(8진수) |
3) 동작 :
| 동작 | 정의 |
|---|---|
| -exec 명령 {} \; | 검색된 파일에 명령을 실행한다. exec 옵션은 \; 으로 끝나고, 검색된 파일은 {} 위치에 적용됨 |
| -ok 명령 {} \; | exec 의 확인 모드 형태 사용자의 확인을 받아서 명령을 실행한다. |
| 검색된 파일의 절대 경로명을 화면에 출력한다(기본동작) | |
| -ls | 검색 결과를 긴 목록 형식으로 출력한다. |

4) 사용 예
find -type d 2> /dev/null # 현재 디렉토리 아래에서 타입이 디렉토리인 파일 찾기
find /etc/ -name hostname 2> /dev/null # /etc 디렉토리에서 이름이 hostname 인 파일 찾기
# 결과 : /etc/hostname - 2> /dev/null : 오류메세지 출력 방지
find /home -amin n -print # home 디렉토리에서 n분전에 접근된 파일 출력
find /home -inum n -print #inode 값이 n인 파일 출력
find /home -links n -print #하드링크수가 n 이상인 모든 파일 출력
find /home -type d -print # directory file을 찾아서 출력
find /home -type l -print # symbolic file을 찾아서 출력
find /home -type f -print # normal file 을 찾아서 출력
find /home -type s -print # socket file을 찾아서 출력
find ~ -type d –o –name Unix # 홈 디렉토리(~)를 기준으로, 타입이 디렉토리인(-type d) 모든 파일이거나 디렉토리 중에서 파일 이름이 Unix인(-name Unix) 모든 파일을 찾는 것을 의미
find /home -mtime +3 -print # 현재 디렉토리(home)를 포함하여 하위 디렉토리에서 수정된 시간(mtime)이 3일 이전에 만들어진 file 모두 찾기
find /home -mtime 3 -print # 이전 3일 전에 만들어진 파일
find /home -mtime -3 -print # 현재부터 3일 이전에 만들어진 파일
find /home -user tmskim -print # 홈디렉토리 포함 하위 디렉토리에서 user가 tmskim 인 파일 및 디렉토리 찾고 프린트
find /home -group tmskim -print # 홈디렉토리 포함 하위 디렉토리에서 group이 tmskim 인 파일 찾고 프린트
find /home -size +10 -print # size가 10 block (10 x 512B)보다 큰 파일
find /home -size +10c -print # size가 10B보다 큰 파일
find /home -size +10k -print # size가 10KB보다 큰 파일
find /home -size +10M -print # size가 10MB보다 큰 파일
find /home -size +10G -print # size가 10GB보다 큰 파일
find /home -newer f.a -print #f.a보다 나중에 만들어진 파일
find . ! -newer g.txt # 현재 디렉토리(.)를 기준으로, "g.txt" 파일보다 이전에 수정된(-newer) 파일을 찾지 않는(!) 것을 의미
find /home -perm 644 -print # permission 이 644인 파일
find /home -perm 644 -quit # permission 이 644인 파일이 하나라도 나오면 검색 종료
find /home -perm 777 -a -name "*sh" # /home 디렉토리를 기준으로, 권한(permission)이 777인 파일(-perm 0777) 중에서 파일 이름이 sh로 끝나는 파일을 찾는 것을 의미.
find /home -perm 644 -a -size +1024 # and
find /home -perm 644 -o -size +1024 # or
find /home ! -perm 644 # not
find /home -mtime +3 -print # print
find /home -mtime +3 -exec rm {} \; # rm 실행
find /home -mtime +3 -exec mv {} /tmp \;
find /home -mtime +3 -exec cp {} /tmp \;
find /home -mtime +3 -ok rm {} \; # rm 하기 전에 확인을 받음
find /home -mtime +3 -ls # ls -l 실행
find /home -mtime +3 -delete # "/home" 디렉토리와 그 하위 디렉토리에서 최종 수정 시간(mtime)이 3일 이전인 파일(-mtime +3)을 모두 찾아내고, 해당 파일을 삭제
find /home -newermt “2017-01-01 00:00:00” #2017년 1월 1일 00시 00분00초 에 modify된 파일 검색
find /home - depth #가장 하위디렉토리에서부터 home으로 올라오면서 검색
find /home -maxdepth 1 #home dir과 depth가 1인 바로 아래의 하위 dir만 검색
find /home -mindepth 1 #depth가 0인 home dir을 제외한 그 하위 dir 모두 검색
touch a aa aaa ab ac xa ya za zza
find /home -name a -print # 이름이 a 인 파일 찾고 출력
find /home -name "a*" -print # 이름이 a 로 시작하는 모든 파일 찾고 출력
find /home -name "a?" -print # 이름이 a 다음에 한글자가 포함된 파일
find /home -name "*a" -print # 이름이 a 로 끝나는 파일
find /home -name "?a" -print # 이름이 a 앞에 한글자 포함된 파일
a
├── b
│ └── c
│ └── d
│ └── e
├── c
│ └── d
│ └── e
├── d
│ └── e
└── e
cd tmp
mkdir -p a/b/c/d/e
mkdir -p a/c/d/e
mkdir -p a/d/e
mkdir -p a/e
tree a
a
├── b
│ ├── c
│ │ └── d
│ │ └── e
│ └── fa
├── c
│ ├── d
│ │ └── e
│ └── fa
├── d
│ ├── e
│ └── fa
└── e
touch a/b/fa
touch a/c/fa
touch a/d/fa
a
├── b
│ ├── c
│ │ └── d
│ │ └── e
│ └── fa
├── c
│ ├── d
│ │ └── e
│ └── fb
├── d
│ ├── e
│ └── fc
└── e
cd a/c
mv fa fb
cd ../d
mv fa fc
cd ../..
tree a
a
├── b
│ └── c
│ └── d
│ └── e
├── c
│ └── d
│ └── e
├── d
│ └── e
└── e
├── fa
├── fb
└── fc
cd a/b
mv fa ../e
cd ../c
mv fb ../e
cd ../d
mv fa ../e
cd ../..
tree a
rm -r a
] $ stat fa
Access: 2023-03-21 16:43:44.554414728 +0900
Modify: 2023-03-21 16:43:44.554414728 +0900
Change: 2023-03-21 16:43:44.554414728 +0900
Birth: 2023-03-21 16:43:44.554414728 +0900
cd tmp
touch fa
stat fa
] $ stat fa
Access: 2023-03-21 16:43:44.554414728 +0900
Modify: 2023-01-01 12:00:24.000000000 +0900 <--
Change: 2023-03-21 16:43:44.554414728 +0900
Birth: 2023-03-21 16:43:44.554414728 +0900
touch -mt 01011200.24 fa
8:lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
10:news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
11:uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
grep -n spool /etc/passwd
find /etc -name "*ubuntu*" 2> /dev/null
/etc/logrotate.d/ubuntu-advantage-tools
/etc/ubuntu-advantage
/etc/newt/palette.ubuntu
/etc/cloud/templates/chrony.conf.ubuntu.tmpl
/etc/cloud/templates/ntp.conf.ubuntu.tmpl
/etc/cloud/templates/sources.list.ubuntu.tmpl
/etc/xdg/autostart/ubuntu-advantage-notification.desktop
/etc/dpkg/origins/ubuntu
/etc/depmod.d/ubuntu.conf
/etc/dbus-1/system.d/com.ubuntu.SoftwareProperties.conf
/etc/dbus-1/system.d/com.ubuntu.LanguageSelector.conf
/etc/dbus-1/system.d/com.ubuntu.WhoopsiePreferences.conf
/etc/apparmor.d/abstractions/ubuntu-bittorrent-clients
/etc/apparmor.d/abstractions/ubuntu-email
/etc/apparmor.d/abstractions/ubuntu-console-browsers
/etc/apparmor.d/abstractions/ubuntu-console-email
/etc/apparmor.d/abstractions/ubuntu-xterm
/etc/apparmor.d/abstractions/ubuntu-unity7-base
/etc/apparmor.d/abstractions/ubuntu-gnome-terminal
/etc/apparmor.d/abstractions/ubuntu-browsers
/etc/apparmor.d/abstractions/ubuntu-helpers
/etc/apparmor.d/abstractions/ubuntu-unity7-launcher
/etc/apparmor.d/abstractions/ubuntu-browsers.d
/etc/apparmor.d/abstractions/ubuntu-browsers.d/ubuntu-integration-xul
/etc/apparmor.d/abstractions/ubuntu-browsers.d/ubuntu-integration
/etc/apparmor.d/abstractions/ubuntu-konsole
/etc/apparmor.d/abstractions/ubuntu-media-players
/etc/apparmor.d/abstractions/ubuntu-unity7-messaging
/etc/apparmor.d/abstractions/ubuntu-feed-readers
/etc/apparmor.d/tunables/home.d/ubuntu
/etc/pollinate/entropy.ubuntu.com.pem
/etc/apt/apt.conf.d/01-vendor-ubuntu
/etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg
/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg
/etc/polkit-1/localauthority.conf.d/51-ubuntu-admin.conf
/etc/udev/rules.d/ubuntu--vg-ubuntu--lv.rules
/etc/update-manager/release-upgrades.d/ubuntu-advantage-upgrades.cfg
/etc/systemd/system/multi-user.target.wants/ubuntu-advantage.service
find /etc -maxdepth 1 -name "m*"
/etc/mke2fs.conf
/etc/multipath.conf
/etc/magic.mime
/etc/magic
/etc/machine-id
/etc/mdadm
/etc/multipath
/etc/modules-load.d
/etc/modules
/etc/mime.types
/etc/manpath.config
/etc/mtab
/etc/modprobe.d
find /etc/ -name "host*" 2> /dev/null
결과
/etc/host.conf
/etc/cloud/templates/hosts.debian.tmpl
/etc/cloud/templates/hosts.photon.tmpl
/etc/cloud/templates/hosts.suse.tmpl
/etc/cloud/templates/host.mariner.tmpl
/etc/cloud/templates/hosts.redhat.tmpl
/etc/cloud/templates/hosts.gentoo.tmpl
/etc/cloud/templates/hosts.freebsd.tmpl
/etc/cloud/templates/hosts.arch.tmpl
/etc/cloud/templates/hosts.alpine.tmpl
/etc/hostname
/etc/hosts
/etc/apparmor.d/abstractions/hosts_access
/etc/hosts.deny
/etc/hosts.allow
//tmp 폴더에서 진행
cd tmp
find /etc/ -name 'host*' -exec cp {} . \;
host.conf
host.mariner.tmpl
hostname
hosts
hosts_access
hosts.allow
hosts.alpine.tmpl
hosts.arch.tmpl
hosts.debian.tmpl
hosts.deny
hosts.freebsd.tmpl
hosts.gentoo.tmpl
hosts.photon.tmpl
hosts.redhat.tmpl
hosts.suse.tmpl
//tmp 폴더에서 진행
find . -name 'host*' -exec rm {} -r \;
-rw-r--r-- 3 root root 0 Mar 23 07:08 fa
-rw-r--r-- 3 root root 0 Mar 23 07:08 faa
-rw-r--r-- 3 root root 0 Mar 23 07:08 fab
lrwxrwxrwx 1 root root 2 Mar 23 07:08 fac -> fa
-rw-r--r-- 2 root root 0 Mar 23 07:08 fb
-rw-r--r-- 2 root root 0 Mar 23 07:08 fba
lrwxrwxrwx 1 root root 2 Mar 23 07:08 fbb -> fb
touch fa
ln fa faa
ln fa fab
ln -s fa fac
touch fb
ln fb fba
ln -s fb fbb
ls -l
-rw-rw-r-- 3 user user 0 Mar 23 06:56 fa
-rw-rw-r-- 3 user user 0 Mar 23 06:56 faa
-rw-rw-r-- 3 user user 0 Mar 23 06:56 fab
lrwxrwxrwx 1 user user 2 Mar 23 06:56 fac -> fa
-rw-rw-r-- 2 user user 0 Mar 23 06:56 fb
-rw-rw-r-- 2 user user 0 Mar 23 06:56 fba
lrwxrwxrwx 1 user user 2 Mar 23 06:56 fbb -> fb