728x90
반응형
[Ubuntu Linux] Linux(Unix) 파일 찾기와 파일 정보 |
find
javanian@ubuntu:~/hongtv$ ll total 16 drwxrwxr-x 4 javanian javanian 4096 Feb 19 13:20 ./ drwxrwxr-- 6 javanian javanian 4096 Feb 19 13:16 ../ drwxrwxr-x 2 javanian javanian 4096 Feb 19 13:20 dir1/ drwxrwxr-x 2 javanian javanian 4096 Feb 19 13:17 dir2/ -rw-rw-r-- 1 javanian javanian 0 Feb 18 17:44 test1.txt javanian@ubuntu:~/hongtv$ ll dir1 total 8 drwxrwxr-x 2 javanian javanian 4096 Feb 19 13:20 ./ drwxrwxr-x 4 javanian javanian 4096 Feb 19 13:20 ../ -rw-rw-r-- 1 javanian javanian 0 Feb 19 13:18 c_test1.txt javanian@ubuntu:~/hongtv$ find test1.txt test1.txt javanian@ubuntu:~/hongtv$ find ./ -name *txt ./test1.txt javanian@ubuntu:~/hongtv$ find ./ -name *.txt ./test1.txt javanian@ubuntu:~/hongtv$ find . -name *.txt -size -1 ./test1.txt javanian@ubuntu:~/hongtv$ find . -name *.txt -size -1c ./test1.txt javanian@ubuntu:~/hongtv$ find . -name *.txt -size -1b ./test1.txt javanian@ubuntu:~/hongtv$ find . -name *.txt -size +1 javanian@ubuntu:~/hongtv$ find . -name *.txt -size +1c javanian@ubuntu:~/hongtv$ find . -name *.txt -size +1b javanian@ubuntu:~/hongtv$ find ../ -name test1 ../test1 javanian@ubuntu:~/hongtv$ find ../ -name test1 -size +1 javanian@ubuntu:~/hongtv$ find ../ -name test1 -size -1 javanian@ubuntu:~/hongtv$ find ../ -name test1 -size +1b javanian@ubuntu:~/hongtv$ find ../ -name test1 -size +1c ../test1 javanian@ubuntu:~/hongtv$ |
cat, head, tail
javanian@ubuntu:~/hongtv$ ll total 20 drwxrwxr-x 4 javanian javanian 4096 Feb 19 13:45 ./ drwxrwxr-- 6 javanian javanian 4096 Feb 19 13:45 ../ drwxrwxr-x 2 javanian javanian 4096 Feb 19 13:20 dir1/ drwxrwxr-x 2 javanian javanian 4096 Feb 19 13:17 dir2/ -rw-rw-r-- 1 javanian javanian 74 Feb 19 13:45 test1.txt javanian@ubuntu:~/hongtv$ cat test1.txt Linux find cat file cmp head tail which javanian@ubuntu:~/hongtv$ head -n2 test1.txt Linux javanian@ubuntu:~/hongtv$ tail -n2 test1.txt tail which javanian@ubuntu:~/hongtv$ |
grep
javanian@ubuntu:~/hongtv$ ll total 20 drwxrwxr-x 4 javanian javanian 4096 Feb 19 13:51 ./ drwxrwxr-- 6 javanian javanian 4096 Feb 19 13:51 ../ drwxrwxr-x 2 javanian javanian 4096 Feb 19 13:20 dir1/ drwxrwxr-x 2 javanian javanian 4096 Feb 19 13:17 dir2/ -rw-rw-r-- 1 javanian javanian 84 Feb 19 13:51 test1.txt javanian@ubuntu:~/hongtv$ cat test1.txt Linux find cat file cmp head tail which grep try javanian@ubuntu:~/hongtv$ grep "grep t" test1.txt grep try javanian@ubuntu:~/hongtv$ grep -i "Grep t" test1.txt grep try javanian@ubuntu:~/hongtv$ grep --help |
piping (|)
javanian@ubuntu:~/hongtv$ cat test1.txt Linux find cat file cmp head tail which grep try javanian@ubuntu:~/hongtv$ cat test1.txt | sort cat cmp file find grep try head Linux tail which javanian@ubuntu:~/hongtv$ cat test1.txt | sort -r | grep Li Linux javanian@ubuntu:~/hongtv$ |
세미콜론 (;)
javanian@ubuntu:~/hongtv$ cp test1.txt test3; echo "New file" >> test3; cat test3 Linux find cat file cmp head tail which grep try New file javanian@ubuntu:~/hongtv$ |
ls, ll
javanian@ubuntu:~/hongtv$ ls dir1 dir2 test1.txt javanian@ubuntu:~/hongtv$ cp test1.txt test2.txt javanian@ubuntu:~/hongtv$ ll total 24 drwxrwxr-x 4 javanian javanian 4096 Feb 19 13:58 ./ drwxrwxr-- 6 javanian javanian 4096 Feb 19 13:51 ../ drwxrwxr-x 2 javanian javanian 4096 Feb 19 13:20 dir1/ drwxrwxr-x 2 javanian javanian 4096 Feb 19 13:17 dir2/ -rw-rw-r-- 1 javanian javanian 84 Feb 19 13:51 test1.txt -rw-rw-r-- 1 javanian javanian 84 Feb 19 13:58 test2.txt javanian@ubuntu:~/hongtv$ ls test[12].txt test1.txt test2.txt javanian@ubuntu:~/hongtv$ javanian@ubuntu:~/hongtv$ ll test[12].txt -rw-rw-r-- 1 javanian javanian 84 Feb 19 13:51 test1.txt -rw-rw-r-- 1 javanian javanian 84 Feb 19 13:58 test2.txt javanian@ubuntu:~/hongtv$ |
diff, cmp
javanian@ubuntu:~/hongtv$ ll total 24 drwxrwxr-x 4 javanian javanian 4096 Feb 19 14:03 ./ drwxrwxr-- 6 javanian javanian 4096 Feb 19 14:03 ../ drwxrwxr-x 2 javanian javanian 4096 Feb 19 13:20 dir1/ drwxrwxr-x 2 javanian javanian 4096 Feb 19 13:17 dir2/ -rw-rw-r-- 1 javanian javanian 84 Feb 19 13:51 test1.txt -rw-rw-r-- 1 javanian javanian 93 Feb 19 14:03 test2.txt javanian@ubuntu:~/hongtv$ diff test1.txt test2.txt 11a12,13 > diff > cmp javanian@ubuntu:~/hongtv$ cmp test1.txt test2.txt cmp: EOF on test1.txt after byte 84, line 11 javanian@ubuntu:~/hongtv$ |
file
javanian@ubuntu:~/hongtv$ ll ../ total 68 drwxrwxr-- 6 javanian javanian 4096 Feb 19 14:03 ./ drwxr-xr-x 3 root root 4096 Feb 15 03:44 ../ -rw------- 1 javanian javanian 3184 Feb 18 18:02 .bash_history -rw-r--r-- 1 javanian javanian 220 Jan 6 2022 .bash_logout -rw-r--r-- 1 javanian javanian 3771 Jan 6 2022 .bashrc drwx------ 2 javanian javanian 4096 Feb 15 03:47 .cache/ drwxrwxr-x 4 javanian javanian 4096 Feb 19 14:03 hongtv/ -rw------- 1 javanian javanian 20 Feb 18 15:59 .lesshst drwxrwxr-x 3 javanian javanian 4096 Feb 18 17:52 .local/ -rw-r--r-- 1 javanian javanian 807 Jan 6 2022 .profile drwx------ 2 javanian javanian 4096 Feb 15 03:44 .ssh/ -rw-r--r-- 1 javanian javanian 0 Feb 15 05:58 .sudo_as_admin_successful -rw-rw-r-- 1 javanian javanian 111 Feb 19 13:16 test1 -rw-r--r-- 1 root root 20 Feb 15 08:13 test1_back -rw-rw-r-- 1 javanian javanian 2466 Feb 16 14:59 test_shell.sh -rw------- 1 javanian javanian 7312 Feb 19 14:03 .viminfo -rw------- 1 javanian javanian 52 Feb 19 13:14 .Xauthority javanian@ubuntu:~/hongtv$ file ../test1 ../test1: Unicode text, UTF-8 text javanian@ubuntu:~/hongtv$ |
728x90
반응형
'네트워크,서버,프로그래밍' 카테고리의 다른 글
[미완료 Ubuntu Linux] 리눅스 서버 구축 #1 - Oracle 설치 (0) | 2023.02.20 |
---|---|
[Ubuntu Linux] Linux(Unix) 디렉토리 / 파일 권한 관리 (chmod, chown, chgrp, umask) (0) | 2023.02.20 |
[Ubuntu Linux] 나노(nano)를 이용한 파일편집 (0) | 2023.02.19 |
[Ubuntu Linux] 파일 경로 및 파일관리 명령어 (0) | 2023.02.19 |
[Ubuntu Linux] Linux 쉘(shell) 기본 문법 (0) | 2023.02.17 |