728x90
[ 리눅스 1 ]
1일차
운영체제(OS)의 기능
- 프로세서(CPU) 관리
- 메모리 관리
- 프로세스 관리
- 입출력 관리
- 파일 시스템 관리
Shell > Kernal > Hardwre
- Shell
- 사용자의 커널 간 인터페이스 역할
- 명령어 해석기
- 프로그래밍 언어
- Kernal
- 운영체제의 핵심
- 셸과 하드웨어 간 인터페이스 역할
- 주로 디바이스 관리, 프로세스 관리, 메모리 관리, 시스템 콜 제공
- Version https://www.kernel.org/
- 6(주버전).7(부버전).4(패치 레벨)
- 주버전 : 리눅스의 기능이 월등히 향상 되었을 때 버전이 올라감
- 부버전 : 홀수(개발버전) / 짝수(안전버전)
- 6(주버전).7(부버전).4(패치 레벨)
Rocky Linux
Rocky Download 및 Setting
https://rockylinux.org/download/ Download Rocky | Rocky Linux Rocky Linux is an open enterprise Operating System designed to be 100% bug-for-bug compatible with Enterprise Linux. rockylinux.org 더보기 Typical (recommended) 일반(권장) Create a Workta
upself.tistory.com
스냅샷 찍어놓기
01
## 프롬프트 ##
# 일반 사용자 : test #
# root(사용자)@(구분자)localhost(호스트명) ~(디텍터리)
[root@localhost ~]$
# 관리자 : root #
[root@localhost ~]#
## 시스템 시작/재시작/종료 ##
# 종류 / shutdonw [옵션] [시간] #
# 종류 / shutdonw -c / shutdown cancel #
[root@localhost ~]# shutdown -h now
[root@localhost ~]# init 0
[root@localhost ~]# halt
[root@localhost ~]# poweroff
[root@localhost ~]# shutdown -h +1
[root@localhost ~]# shutdown -c
# 재시작 #
[root@localhost ~]# shutdown -r now
[root@localhost ~]# -r + 1
[root@localhost ~]# init 6
[root@localhost ~]# reboot
## 화면 지우기 ##
[root@localhost ~]# clear
## 명령어 히스토리 ##
# 히스토리 내역 삭제 #
[root@localhost ~]# history
[root@localhost ~]# history -c
## 현재 작업 디렉터리 ##
[root@localhost ~]# pwd
[런 레벨] - init
0 : 종료
1 : 단일 사용자 모드(긴급 모드)
2 : 다중 사용자 모드(Not NFS)
3 : 다중 사용자 모드(Text Mode)
4 : Not Used
5 : 다중 사용자 모드(GUI)
6 : 재시작
account : 계정 / 식별자 + 권한
identifier : 식별자
/ : 최상위 root 디렉터리
/root : 최상위 root 디렉터리 방
/home : 사용자 계정 디렉터리
/bin : 기본 명령어
/boot : 부팅
/dev : 모든 장치 파일
/etc : 시스템의 모든 환경 설정 파일
/lib : 라이브러리 파일
/mnt : 리눅스는 파일로 인식하기 때문에 mount해서 mnt랑 연결하게 됨
/sbin : 시스템 관리 명령어
/tmp : 임시 디렉터리
/usr : 일반 사용자가 사용하는 명령어(하위 파일이 또 있음)
/var : 변동되는 내용들이 저장됨(ex. log)
2일차
[명령어] 내부 명령어 우선순위가 더 높음
1. 내부 명령어
- 셸에 포함된 명령어
2. 외부 명령어
========================
1. 리눅스는 대소문자를 구분한다.
========================
파일 : 객체
디렉터리 : 파일을 저장하는 공간
## 32바이트의 패킷을 만들어서 지정해준 목적지 주소로 전송하는 프로그램 ##
[root@localhost ~]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=128 time=36.9 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=128 time=37.5 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1004ms
rtt min/avg/max/mdev = 36.919/37.208/37.497/0.289 ms
## 디렉토리 이동 / cd [디렉터리] ##
# 자신의 홈 디렉터리로 이동 #
[root@localhost ~]# cd
[root@localhost ~]# cd ~
# root 디렉터리로 이동 #
[root@localhost ~]# cd /
# 상위 디렉터리로 이동 #
[root@localhost ~]# cd ..
# 현재 디렉터리 #
[root@localhost ~]# cd .
# 바로 직전에 이동한 디렉터리로 이동 #
[root@localhost ~]# cd -
## 파일/디렉터리 목록 출력 ##
[root@localhost ~]# ls
## 숨긴 파일/디렉터리까지 모든 록록 출력 ##
[root@localhost ~]# ls -al
## 절대경로 출력 ##
[root@localhost test]# pwd
/home/test
## 같은 디렉터리에 동일한 이름의 파일을 생성할 수 없다. ##
# 고유 식별자 확인하는 법 #
[root@localhost /]# ls -li
1165605 -rw-r--r--. 1 root root 0 2월 20:55 test.txt
[root@localhost home]# ls -li
34898476 -rw-r--r--. 1 root root 0 3월 20:54 test.txt
## 파일/디렉터리 생성/수정/삭제 ##
## 한번에 여러 디렉터리 샏성 ##
[root@localhost home]# mkdir dir1 dir2 dir3 dir4
[root@localhost home]# ll
합계 4
drwxr-xr-x. 2 root root 6 3월 2 21:13 dir1
drwxr-xr-x. 2 root root 6 3월 2 21:13 dir2
drwxr-xr-x. 2 root root 6 3월 2 21:13 dir3
drwxr-xr-x. 2 root root 6 3월 2 21:13 dir4
## 한번에 여러개의 하위 디렉터리 생성 ##
[root@localhost dir2]# mkdir -p dir3/dir4/dir5
[root@localhost dir2]# cd dir3/dir4/dir5
[root@localhost dir5]# pwd
/home//dir2/dir3/dir4/dir5
## 디렉터리 삭제 ##
# 빈 디렉터리만 삭제 / rmdir [삭제할 디렉터리] #
[root@localhost dir5]# pwd
/home//dir2/dir3/dir4/dir5
[root@localhost dir5]# cd ..
[root@localhost dir4]# rmdir dir5
# 빈 디렉터리, 파일/디렉터리가 존재하는 디렉터리 | rm [옵션] [삭제할 디렉터리] #
[root@localhost dir2]# rm -rf dir3
[ rm 옵션]
-r : 파일/하위 디렉터리까지 삭제
-f : 삭제 여부 묻지 않음
-i : 삭제 여부 묻기
## 파일 생성(빈 파일), 수정 날짜 변경 ##
[root@localhost home]# touch text.txt
## 편리하게 사용하도록 지정해둔 명령어 / 로그아웃하면 다시 없어짐 ##
[root@localhost home]# alias
[root@localhost home]# alias 1='ls -l'
[root@localhost home]# 1
합계 4
drwx------. 14 test test 4096 2월 26 23:38 test
-rw-r--r--. 1 root root 0 3월 2 20:54 text.txt
## 파일/디렉터리 복사 | cp [원본 파일] [복사본 파일] ##
[root@localhost home]# cp test.txt test7.txt
[root@localhost home]# ll
-rw-r--r--. 1 root root 0 3월 3 15:02 test.txt
-rw-r--r--. 1 root root 0 3월 3 15:03 test.txt
## passwd 파일 복사 ##
[root@localhost home]# cd /etc/
[root@localhost etc]# ls -l passwd
[root@localhost etc]# cp passwd /home/
## /etc/shadow 파일을 현재 디렉터리에 복사 ##
[root@localhost home]# cp /etc/shadow .
## /home/shadow 파일 삭제 ##
[root@localhost home]# rm -rf grep shadow
## /etc 하위 디렉터리 여러개를 한번에 /home에 복사 ##
[root@localhost etc]# cp passwd shadow group /home/
## /home dir2를 dir1으로 복사 ##
[root@localhost home]# cp di2 dir1
cp : -r not specified; omitting directory 'dir2'
[root@localhost home]# cp -rf dir2 dir1
[root@localhost home]# cd dir1
[root@localhost home]# ll
합계 0
drwxr-xr-x. 2 root root 6 3월 3 15:20 dir2
[cp 옵션]
-r : 파일/디렉터리
## 파일/디레거리 옮기기 | mv [원본 파일/디렉터리] [옮김 파일/디렉터리] ##
[root@localhost home]# mv dir2 dir1
## 시간/날짜/연도 확인/설정 ##
# date [MMDDHHmmYY.ss] #
[root@localhost home]# date
# 해당월 달력 #
2024. 03. 03. (일) 15:38:24 KST
[root@localhost home]# cal
3월 2024
일 월 화 수 목 금 토
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
# 해당 년도 전체 달력 #
[root@localhost home]# cal -y
# 이번달 전후 3개월 #
[root@localhost home]# cal -3
# 특정 년월 조회 #
[root@localhost home]# cal 05 2024
## 명령어 설명 ##
# man [명령어] #
[root@localhost home]# man date
# [명령어] --help #
[root@localhost home]# date --help
Enter : 한줄
Space bar : 한 페이지
## time 자동 설정 ##
# 시간, 타임존 확인 #
[root@localhost home]# timedatectl
[root@localhost home]# vi /etc/chrony.conf
# pool 2.rocky.pool.ntp.org iburst
server time.bora.net iburst
server send.mx.cdnetworks.com iburst
# 시스템 재기동ㅎ면 자동으로 tiem 수정됨 #
[root@localhost home]# systemctl restart chronyd
## 리다이렉션 / 표준 출력/입력 ##
# ls -l 내용을 ls.txt로 저장됨 #
[root@localhost ~]# ls -l > ls.txt
[root@localhost ~]# ll
-rw-r--r--. 1 root root 533 3월 3 19:43 ls.txt
[root@localhost ~]# cat ls.txt
-rw-------. 1 root root 991 2월 26 23:36 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 3월 3 19:43 ls.txt
drwxr-xr-x. 2 root root 6 2월 26 23:39 공개
drwxr-xr-x. 2 root root 6 2월 26 23:39 다프로드
drwxr-xr-x. 2 root root 6 2월 26 23:39 문서
drwxr-xr-x. 2 root root 6 2월 26 23:39 바탕화면
drwxr-xr-x. 2 root root 6 2월 26 23:39 비디오
drwxr-xr-x. 2 root root 6 2월 26 23:39 사진
drwxr-xr-x. 2 root root 6 2월 26 23:39 음악
# linux라는 내용을 linux.txt에 저장 #
[root@localhost ~]# echo "linux" > linux.txt
[root@localhost ~]# cat linux.txt
linux
# passwd7에 덮어쓰기 #
[root@localhost ~]# cat passwd > passwd7
# 기존 내용에 추가 #
[root@localhost ~]# cat cal2.txt >> cal1.txt
# 달력을 cal.txt로 저장 #
[root@localhost ~]# cal > cal.txt
[root@localhost ~]# cat -n cal.txt
[cat 옵션]
-n : 행 번호 출력
-b : 빈 행 제외하고 출력
## 그래픽 에디터 ##
[root@localhost home]# gedit
unix
linux
windows
korea
japan
## 위에서부터 10줄 출력 ##
[root@localhost home]# head -n 10 passwd
## 위에서부터 11번째 줄부터 출력 ##
[root@localhost home]# head -n -10 passwd
## 밑에서부터 10줄 출력 ##
[root@localhost home]# tail -n 10 passwd
## 1페이지씩 출력 ##
[root@localhost home]# cat passwd | more
## 1페이지씩 출력 / 방향키로 조작가능 | 빠져나가려면 Q ##
[root@localhost home]# cat passwd | less
[head옵션]
-n : 줄 수
-c : 용량
[tail 옵션]
-n : 줄 수
-c : 용량
-f : 파일 내용 모니터링
## 파일 줄 확인 ##
[root@localhost home]# cat -n passwd
## 파일 내용 분할 ##
# passwd 파일을 10줄씩 분할 #
[root@localhost home]# split -l 10 passwd
-rw-r--r--. 1 root root 385 3월 6 00:06 xaa
-rw-r--r--. 1 root root 551 3월 6 00:06 xab
-rw-r--r--. 1 root root 761 3월 6 00:06 xac
-rw-r--r--. 1 root root 407 3월 6 00:06 xad
# 분할된 파일 확인 #
[root@localhost home]# cat -n xaa
# 분할된 파일 다시 합치기 #
[root@localhost home]# cat x* > korea.txt
# -d 옵션 : 알파벳이 아닌 숫자로 생성됨 / ex) x00 #
# -a 옵션 : 자릿수를 지정할 수 있음 #
# --additional-suffix 옵션 : 확장자를 지정할 수 있음 #
# test_ : 파일명을 text_로 시작 / ex) text_0000.bak #
# --numeric-suffixes=10 : 파일명을 10번부터 붙이고 싶음 / ex) text_0010.bak #
[root@localhost home]# split -l 10 -d -a 4 --additional-suffix=.bak --numeric-suffixes=10 passwd test_
# 파일을 3개로 나누고 싶음 / -l 10 -> -n 3 #
[root@localhost home]# split -n 3 -a -a 4 --additional-suffix=.bak --numeric-suffixes=10 passwd test_
[split 옵션]
-l : 줄 수
-C : 바이트 수
-d : 확장자를 숫자로 지정
-a : 확장자 자릿수 지정
-n : 파일 갯수 지정
## 문자열 출력 ##
# grep [찾고자 하는 문자열] [대상 파일명] #
# passwd 파일에서 root 문자 찾기 #
[root@localhost home]# grep -n 'root' passwd
[grep 옵션]
-n : 행 번호 출력
## 행 번호 붙이기 ##
# nl [파일명] #
[root@localhost home]# nl linux.txt
1 linux
2 linux2
3 linux3
4 linux4
5 linux5
6 linux61
[속성] [허가권] [ 링크수] [소유자명] [그룹명] [파일 크기] [ 수정 날짜] [파일/디렉터리명]
d rwx------. 14 root root 4096 2월 17 19:34 test
- rw-r--r--. 1 root root 0 2월 18 16:10 test.txt
d : 디렉터리
- : 일반 파일
l : 심볼릭 링크
b : 블록 장치 파일
c : 문자 장치 파일
.
.
.
세션 끊기지 않게 유지하기
메뉴 모음 보이기 설정
01
폰트 설정하기
01
3일차
## 디렉터리 만들고 바로 파일에 진입하기 ##
[root@localhost korea]# mkdir dir4 && cd dir4
[root@localhost dir4]# pwd
/home/korea/dir4
## 히스토리 삭제 ##
[root@localhost dir4]# history -c
[root@localhost dir4]# history
1 history
/home/korea/dir5/dir6/d1
디렉터리는 link 되어있기 때문에 하위 디렉터리는 삭제할 수 있음 → 중간에 껴있는건 삭제 못함
ex) dir6를 삭제하면 → dir6/d1 로 삭제됨
d1은 남겨두고 dir6만 삭제하는건 불가능
## 모든 파일과 디렉터리를 나열 ##
[root@localhost dir4]# ls -R
.:
d1 d2 d3 dir5
./d1:
./d2:
./d3:
./dir5:
## 한번에 dir1 ~ dir10까지 생성 ##
[root@localhost korea]# mkdir dir{1..10}
[root@localhost korea]# ll
합계 0
drwxr-xr-x. 2 root root 6 6월 11 00:46 dir1
drwxr-xr-x. 2 root root 6 6월 11 00:46 dir10
drwxr-xr-x. 2 root root 6 6월 11 00:46 dir2
drwxr-xr-x. 2 root root 6 6월 11 00:46 dir3
drwxr-xr-x. 2 root root 6 6월 11 00:46 dir4
drwxr-xr-x. 2 root root 6 6월 11 00:46 dir5
drwxr-xr-x. 2 root root 6 6월 11 00:46 dir6
drwxr-xr-x. 2 root root 6 6월 11 00:46 dir7
drwxr-xr-x. 2 root root 6 6월 11 00:46 dir8
drwxr-xr-x. 2 root root 6 6월 11 00:46 dir9
## 한번에 dir1 ~ dir10까지 삭제 ##
[root@localhost korea]# rm -rf dir{1..10}
[root@localhost korea]# ll
합계 0
## 한번에 file1 ~ file10까지 삭제 ##
[root@localhost korea]# touch file{1..10}
[root@localhost korea]# ll
합계 0
-rw-r--r--. 1 root root 0 6월 11 00:52 file1
-rw-r--r--. 1 root root 0 6월 11 00:52 file10
-rw-r--r--. 1 root root 0 6월 11 00:52 file2
-rw-r--r--. 1 root root 0 6월 11 00:52 file3
-rw-r--r--. 1 root root 0 6월 11 00:52 file4
-rw-r--r--. 1 root root 0 6월 11 00:52 file5
-rw-r--r--. 1 root root 0 6월 11 00:52 file6
-rw-r--r--. 1 root root 0 6월 11 00:52 file7
-rw-r--r--. 1 root root 0 6월 11 00:52 file8
-rw-r--r--. 1 root root 0 6월 11 00:52 file9
## 한번에 file1 ~ file10까지 삭제 ##
[root@localhost korea]# rm -rf file{1..10}
[root@localhost korea]# ll
합계 0
## 디렉터리명 수정 ##
[root@localhost korea]# ll
합계 0
drwxr-xr-x. 2 root root 6 6월 11 00:56 d1
drwxr-xr-x. 2 root root 6 6월 11 00:56 d2
drwxr-xr-x. 2 root root 6 6월 11 00:56 d3
[root@localhost korea]# mv d1 d100
[root@localhost korea]# mv d2 d200
[root@localhost korea]# mv d3 d300
[root@localhost korea]# ll
합계 0
drwxr-xr-x. 2 root root 6 6월 11 00:56 d100
drwxr-xr-x. 2 root root 6 6월 11 00:56 d200
drwxr-xr-x. 2 root root 6 6월 11 00:56 d300
## 파일명 수정 ##
[root@localhost korea]# touch file1
[root@localhost korea]# ll
합계 0
drwxr-xr-x. 2 root root 6 6월 11 00:56 d100
drwxr-xr-x. 2 root root 6 6월 11 00:56 d200
drwxr-xr-x. 2 root root 6 6월 11 00:56 d300
-rw-r--r--. 1 root root 0 6월 11 00:57 file1
[root@localhost korea]# mv file1 file100
[root@localhost korea]# ll
합계 0
drwxr-xr-x. 2 root root 6 6월 11 00:56 d100
drwxr-xr-x. 2 root root 6 6월 11 00:56 d200
drwxr-xr-x. 2 root root 6 6월 11 00:56 d300
-rw-r--r--. 1 root root 0 6월 11 00:57 file100
## 디렉터리가 있을 경우, 디렉터리 안으로 옮겨짐 ##
# ex. d100 안으로 d200이 옮겨짐 #
[root@localhost korea]# ll
합계 0
drwxr-xr-x. 2 root root 6 6월 11 00:56 d100
drwxr-xr-x. 2 root root 6 6월 11 00:56 d200
drwxr-xr-x. 2 root root 6 6월 11 00:56 d300
-rw-r--r--. 1 root root 0 6월 11 00:57 file100
[root@localhost korea]# mv d200 d100
[root@localhost korea]# ll
합계 0
drwxr-xr-x. 3 root root 18 6월 11 01:02 d100
drwxr-xr-x. 2 root root 6 6월 11 00:56 d300
-rw-r--r--. 1 root root 0 6월 11 00:57 file100
[root@localhost korea]# cd d100/
[root@localhost d100]# ll
합계 0
drwxr-xr-x. 2 root root 6 6월 11 00:56 d200
## 디렉터리 옮기기 ##
[root@localhost d100]# ll
합계 0
drwxr-xr-x. 2 root root 6 6월 11 00:56 d200
[root@localhost d100]# pwd
/home/korea/d100
[root@localhost d100]# mv d200/ /home/korea
[root@localhost d100]# ll
합계 0
[root@localhost d100]# cd ..
[root@localhost korea]# ll
합계 0
drwxr-xr-x. 2 root root 6 6월 11 01:05 d100
drwxr-xr-x. 2 root root 6 6월 11 00:56 d200
drwxr-xr-x. 2 root root 6 6월 11 00:56 d300
-rw-r--r--. 1 root root 0 6월 11 00:57 file100
## cp는 원본을 두고 복사 ##
[root@localhost korea]# ll
합계 0
drwxr-xr-x. 2 root root 6 6월 11 01:05 d100
drwxr-xr-x. 2 root root 6 6월 11 00:56 d200
drwxr-xr-x. 2 root root 6 6월 11 00:56 d300
-rw-r--r--. 1 root root 0 6월 11 00:57 file100
[root@localhost korea]# cp file100 file200
[root@localhost korea]# ll
합계 0
drwxr-xr-x. 2 root root 6 6월 11 01:05 d100
drwxr-xr-x. 2 root root 6 6월 11 00:56 d200
drwxr-xr-x. 2 root root 6 6월 11 00:56 d300
-rw-r--r--. 1 root root 0 6월 11 00:57 file100
-rw-r--r--. 1 root root 0 6월 11 01:14 file200
## f로 시작하는 모든 파일 d100으로 옮기기 ##
[root@localhost korea]# ll
합계 0
drwxr-xr-x. 2 root root 6 6월 11 01:05 d100
drwxr-xr-x. 2 root root 6 6월 11 00:56 d200
drwxr-xr-x. 2 root root 6 6월 11 00:56 d300
-rw-r--r--. 1 root root 0 6월 11 00:57 file100
-rw-r--r--. 1 root root 0 6월 11 01:14 file200
[root@localhost korea]# mv f* d100
[root@localhost korea]# ll
합계 0
drwxr-xr-x. 2 root root 36 6월 11 01:16 d100
drwxr-xr-x. 2 root root 6 6월 11 00:56 d200
drwxr-xr-x. 2 root root 6 6월 11 00:56 d300
[root@localhost korea]# cd d100/
[root@localhost d100]# ll
합계 0
-rw-r--r--. 1 root root 0 6월 11 00:57 file100
-rw-r--r--. 1 root root 0 6월 11 01:14 file200
## 다시 원복 ##
[root@localhost d100]# ll
합계 0
-rw-r--r--. 1 root root 0 6월 11 00:57 file100
-rw-r--r--. 1 root root 0 6월 11 01:14 file200
[root@localhost d100]# mv * /home/korea
[root@localhost d100]# ll
합계 0
[root@localhost d100]# cd ..
[root@localhost korea]# ll
합계 0
drwxr-xr-x. 2 root root 6 6월 11 01:17 d100
drwxr-xr-x. 2 root root 6 6월 11 00:56 d200
drwxr-xr-x. 2 root root 6 6월 11 00:56 d300
-rw-r--r--. 1 root root 0 6월 11 00:57 file100
-rw-r--r--. 1 root root 0 6월 11 01:14 file200
## 빈 파일 생성 ##
[root@localhost korea]# touch a{1..5}
[root@localhost korea]# touch b{1..5}
[root@localhost korea]# touch c{1..5}
[root@localhost korea]# touch d{1..5}
[root@localhost korea]# touch e{1..5}
[root@localhost korea]# ls
a1 a3 a5 b2 b4 c1 c3 c5 d2 d4 e1 e3 e5
a2 a4 b1 b3 b5 c2 c4 d1 d3 d5 e2 e4
# a부터 c가 들어가는 모든 파일 삭제 #
[root@localhost korea]# rm -rf [a-c]*
[root@localhost korea]# ls
d1 d2 d3 d4 d5 e1 e2 e3 e4 e5
# a 또는 c가 들어가는 모든 파일 삭제 #
[root@localhost korea]# rm -rf [ac]*
[root@localhost korea]# ls
b1 b2 b3 b4 b5 d1 d2 d3 d4 d5 e1 e2 e3 e4 e5
## file 1 ~ 10까지 생성 ##
[root@localhost korea]# touch file{1..10}
[root@localhost korea]# ll
합계 0
-rw-r--r--. 1 root root 0 6월 18 23:44 file1
-rw-r--r--. 1 root root 0 6월 18 23:44 file10
-rw-r--r--. 1 root root 0 6월 18 23:44 file2
-rw-r--r--. 1 root root 0 6월 18 23:44 file3
-rw-r--r--. 1 root root 0 6월 18 23:44 file4
-rw-r--r--. 1 root root 0 6월 18 23:44 file5
-rw-r--r--. 1 root root 0 6월 18 23:44 file6
-rw-r--r--. 1 root root 0 6월 18 23:44 file7
-rw-r--r--. 1 root root 0 6월 18 23:44 file8
-rw-r--r--. 1 root root 0 6월 18 23:44 file9
## file 1 ~ 10을 data- 1~ 10으로 수정 ##
[root@localhost korea]# rename file data- file*
[root@localhost korea]# ll
합계 0
-rw-r--r--. 1 root root 0 6월 18 23:44 data-1
-rw-r--r--. 1 root root 0 6월 18 23:44 data-10
-rw-r--r--. 1 root root 0 6월 18 23:44 data-2
-rw-r--r--. 1 root root 0 6월 18 23:44 data-3
-rw-r--r--. 1 root root 0 6월 18 23:44 data-4
-rw-r--r--. 1 root root 0 6월 18 23:44 data-5
-rw-r--r--. 1 root root 0 6월 18 23:44 data-6
-rw-r--r--. 1 root root 0 6월 18 23:44 data-7
-rw-r--r--. 1 root root 0 6월 18 23:44 data-8
-rw-r--r--. 1 root root 0 6월 18 23:44 data-9
[root@localhost korea]# touch f{1..3}.txt
[root@localhost korea]# ll
합계 0
-rw-r--r--. 1 root root 0 6월 18 23:54 f1.txt
-rw-r--r--. 1 root root 0 6월 18 23:54 f2.txt
-rw-r--r--. 1 root root 0 6월 18 23:54 f3.txt
## .txt 확장자를 .bak로 수정 ##
# rename [변경할 범위][변경할 이름][파일/디렉터리명] #
[root@localhost korea]# rename .txt .bak f*
[root@localhost korea]# ll
합계 0
-rw-r--r--. 1 root root 0 6월 18 23:54 f1.bak
-rw-r--r--. 1 root root 0 6월 18 23:54 f2.bak
-rw-r--r--. 1 root root 0 6월 18 23:54 f3.bak
## 디렉터리 일자 수정(Modify) ##
[root@localhost korea]# stat f1.bak
File: f1.bak
Size: 0 Blocks: 0 IO Block: 4096 일반 빈 파일
Device: fd00h/64768d Inode: 68539975 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2024-06-18 23:54:02.866376321 +0900
Modify: 2024-06-18 23:54:02.866376321 +0900
Change: 2024-06-18 23:54:17.647502360 +0900
Birth: 2024-06-18 23:54:02.866376321 +0900
[root@localhost korea]# touch f1.bak
[root@localhost korea]# stat f1.bak
File: f1.bak
Size: 0 Blocks: 0 IO Block: 4096 일반 빈 파일
Device: fd00h/64768d Inode: 68539975 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2024-06-19 00:12:44.518250580 +0900
Modify: 2024-06-19 00:12:44.518250580 +0900
Change: 2024-06-19 00:12:44.518250580 +0900
Birth: 2024-06-18 23:54:02.866376321 +0900
## touch만 하면 현재 시각으로 적용 ##
[root@localhost korea]# touch f1.bak
[root@localhost korea]# ll
합계 0
-rw-r--r--. 1 root root 0 6월 19 00:16 f1.bak
-rw-r--r--. 1 root root 0 6월 18 23:54 f2.bak
-rw-r--r--. 1 root root 0 6월 18 23:54 f3.bak
## 년(23)월(12)일(31)시(00)분(00)로 시작 정해서 사용 touch 가능 ##
# [해커들이 많이 사용함] #
[root@localhost korea]# touch -t 2312310000 f1.bak
[root@localhost korea]# ll
합계 0
-rw-r--r--. 1 root root 0 12월 31 00:00 f1.bak
-rw-r--r--. 1 root root 0 6월 18 23:54 f2.bak
-rw-r--r--. 1 root root 0 6월 18 23:54 f3.bak
## shadow, passwd 파일을 현재 디렉터리에 복수 ##
[root@localhost korea]# cp /etc/shadow /etc/passwd .
[root@localhost korea]# ll
합계 8
-rw-r--r--. 1 root root 2104 6월 19 00:26 passwd
----------. 1 root root 1131 6월 19 00:26 shadow
## word count로 passwd 파일 ##
# [행수][단어수][문자수] #
[root@localhost korea]# wc passwd
37 90 2104 passwd
# -l옵션으로 line수 확인 #
[root@localhost korea]# wc -l passwd
37 passwd
we 옵션
-l : line(행 수)
-w : word(단어 수)
-c : character(문자 수)
6일차
[HDD 추가]
1. HDD 장착
2. 파티션 나누기
3. 파일 시스템 생성
4. 마운트(자동 마운트)
[ 리눅스 2 ]
1일차
# 웹 서버 설치 #
[root@localhost ~]# yum -y install httpd*
# 웹 서버 실행 #
[root@localhost ~]# systemctl restart httpd
# 웹 서버 실행 여부 확인 #
[root@localhost ~]# ps -aux | grep httpd
# 웹 서버 삭제 #
[root@localhost ~]# yum -y remove httpd
~
제거되었습니다:
apr-1.7.0-12.el9_3.x86_64 apr-devel-1.7.0-12.el9_3.x86_64 apr-util-1.6.1-23.el9.x86_64 apr-util-bdb-1.6.1-23.el9.x86_64
apr-util-devel-1.6.1-23.el9.x86_64 apr-util-openssl-1.6.1-23.el9.x86_64 cyrus-sasl-2.1.27-21.el9.x86_64 cyrus-sasl-devel-2.1.27-21.el9.x86_64
expat-devel-2.5.0-1.el9_3.1.x86_64 httpd-2.4.57-5.el9.x86_64 httpd-core-2.4.57-5.el9.x86_64 httpd-devel-2.4.57-5.el9.x86_64
httpd-filesystem-2.4.57-5.el9.noarch httpd-manual-2.4.57-5.el9.noarch httpd-tools-2.4.57-5.el9.x86_64 libdb-devel-5.3.28-53.el9.x86_64
mod_http2-1.15.19-5.el9.x86_64 mod_lua-2.4.57-5.el9.x86_64 openldap-devel-2.6.3-1.el9.x86_64 rocky-logos-httpd-90.15-2.el9.noarch
완료되었습니다!
http(apache) 전세계 80% 가량이 사용함
서버(192.168.10.129)가 실행되고 있기 때문에 Firefox에 IP로 접근 가능
명령어 = 클라이언트 프로그램
클라이언트 | 서버 |
Firefox / Edge 등와 같이 사용자가 사용하는 브라우저 | apach 등과 값이 웹 서버가 설치된 프로그램 |
데몬(프로세스) : 메모리에 어떤 프로그램이 실행되고 있는 상태(ex. httpd)
- 운영체제에서 사용자가 직접 제어하지 않아도, 백그라운드에서 여러 작업을 하는 프로그램
반응형