/etc/passwd
: 사용자 정보 확인 가능
/etc/group
: 그룹 정보 확인 가능
그룹
groupadd-g : gid(group id) 지정groupmod-g : 해당 그룹의 gid 수정groupdelroot 권한 필요하므로 sudo 붙여줘야 함
groupadd[user@localhost practice]$ sudo groupadd group01
[sudo] password for user:
[user@localhost practice]$ tail -n 1 /etc/group
group01:x:1007:
[user@localhost practice]$ sudo groupadd -g 2000 group02
[user@localhost practice]$ tail -n 1 /etc/group
group02:x:2000:
groupmod[user@localhost practice]$ sudo groupmod -g 2001 group02
[user@localhost practice]$ tail -n 1 /etc/group
group02:x:2001:
groupdel[user@localhost practice]$ sudo groupdel group02
[user@localhost practice]$ tail -n 2 /etc/group
user05:x:1006:
group01:x:1007:
/etc/skel: 사용자 생성 시 기본 제공되는 파일/디렉토리
[user@localhost ~]$ **ls -a /etc/skel**
. .. .bash_logout .bash_profile .bashrc
/etc/login.defs: 사용자 생성에 대한 기본 정보가 담겨있는 설정 파일
명령어로 바꾼 설정
→ 반영구적. 재부팅할 때 초기화되는 경우 있음.
설정 파일
→ 영구적
/etc/shadow: 비밀번호에 대한 정보
root:$~$~$~::0:99999:::
#사용자명 / 암호 알고리즘 / 솔트 값 / 실제 암호화된 값
user05:!:20320:0:99999:7:::
# ! : 잠금
# !! : 비밀번호 설정 x
chage: 계정 비밀번호 관련 제어 명령어
-l : 비밀번호 관련 정보 리스트 확인[user@localhost ~]$ sudo chage -l user03
Last password change : Aug 21, 2025
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7-m : 비밀번호 변경 최소 기간(비밀번호 최소 사용 일수) 수정-M : 비밀번호 변경 최대 기간(비밀번호 최대 사용 일수) 수정-W : 비밀번호 만료 전 경고 기간 수정-I : 비밀번호 만료 후 유예 기간 수정sudo usermod -L user03
: 사용자에게 Lock 을 걸 수 있음
→ 휴직 중인 직원들의 계정을 사용 못하게 잠금
$: 해당 변수의 내용 확인 가능
env: 현재 설정된 환경변수들 목록 확인 가능
set: 영구적인 환경변수 적용 가능
[user@localhost ~]$ hello=linux #반영구적 환경변수 설정
[user@localhost ~]$ echo $hello
linux
set hello=linux #영구적 환경변수 설정
[user@localhost ~]$ echo $hello
linux
[user@localhost ~]$ unset hello #환경변수 제거
[user@localhost ~]$ echo $hello
|: 명령어의 표준 출력을 또 다른 명령어의 표준 입력으로 받게함
ls -l | grep fileA
→ ls -l 의 결과를 뒤의 명령어의 입력으로 넘겨서 추가 처리 가능
# ls -l 의 결과에서 file 이 포함된 애들을 찾음
[user@localhost ~]$ ls -l | grep file
-r---wxrwx. 1 user user 44 Aug 19 22:40 fileA
-rw-r--r--. 1 user user 16 Aug 19 21:24 fileB
-rw-r--r--. 1 user user 31 Aug 19 21:31 fileC
-rw-r--r--. 1 user user 41636 Aug 19 21:39 fileD
-rw--w--w-. 1 user user 0 Aug 20 01:44 fileX
-rw-r--r--. 1 user user 0 Aug 20 01:33 fileY
# ps -ef : 숨겨진 정보까지 보기
# more: 아래 방향으로 한 페이지 단위로 볼 수 있게 함
$ ps -ef | more
history
: 최근 실행한 명령어 목록
ps: 현재 시스템에서 구동 중인 프로세스의 목록을 보여주는 명령어
ps auxps -ef- 사용: UNIX 옵션 표기법
- 사용x: BSD 옵션 표기법
sleep : 프로세스를 일정 시간동안 잠들게 함. 일시정지 시킴 [user@localhost ~]$ sleep 10000 &
[1] 1878
[user@localhost ~]$ sleep 10000 &
[2] 1879
[user@localhost ~]$ sleep 10000 &
[3] 1880$ sleep 10000 &
[1] 1878
$ sleep 10000 &
[2] 1879
$ sleep 10000 &
[3] 1880
$ ps aux
...
user 1878 0.0 0.0 5400 1736 pts/0 S 23:07 0:00 **sleep** 100
user 1879 0.0 0.1 5400 1772 pts/0 S 23:07 0:00 **sleep** 100
user 1880 0.0 0.1 5400 1772 pts/0 S 23:07 0:00 **sleep** 100
...
$ fg %1
sleep 10000 → 저 세개 프로세스가 sleep 상태임을 확인 가능 → 1번 프로세스를 포어그라운드로 전환하면서 다시 sleep 실행 상태가 육안으로 보임[user@localhost ~]$ jobs
[1] Running sleep 10000 & # 제일 구동된지 오래된 프로세스
[2]- Running sleep 10000 & # 직전 실행?
[3]+ Running sleep 10000 & # 제일 최근?& : 백그라운드 실행jobs : 작업 목록 확인fg : 포어그라운드 전환bg : 백그라운드 전환top
: 현재 구동 중인 프로세스들의 목록을 실시간으로 확인 가능
q 로 빠져나올 수 있음ps | grep[user@localhost ~]$ ps aux | grep sleep
user 1879 0.0 0.1 5400 1772 pts/0 S 23:07 0:00 sleep 10000
user 1880 0.0 0.1 5400 1772 pts/0 S 23:07 0:00 sleep 10000
user 1909 0.0 0.1 6380 2060 pts/0 S+ 23:18 0:00 grep --color=auto sleep
→ 프로세스 목록에서 sleep 문자열이 포함된 프로세스 검색
→ 마지막은 방금 검색한 프로세스
kill: 프로세스 제어 명령어
sudo 사용[user@localhost ~]$ kill -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1
11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP
21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR
31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3
38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8
43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7
58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2
63) SIGRTMAX-1 64) SIGRTMAX
→ 시그널 목록 확인 가능
SIGHUP : 1 : Hang up : 프로세스 종료 없이 프로그램을 새로 초기화함SIGINT : 2 : Interrupt : Ctrl+c 를 사용할 때 발생SIGKILL : 9 : Kill : 강제 종료SIGTERM : 15 : Terminate : 정상 종료kill 의 기본 시그널SIGTSTP : 20 : Stop : 일시 정지(Ctrl+z)# 정상종료 (기본 시그널 15)
$ kill 1879
[2]- Terminated sleep 10000
# 강제종료 (시그널 9)
$ kill -9 1880
[3]+ Killed sleep 10000
pkill [프로세스 명령어]# sleep 중인 프로세스들 모두 kill
$ pkill sleep
systemdRedhat7
유닛 기반
병렬 처리
- 속도 해결
systemctl
→ .socket, .target 등 각 유닛으로 묶인 걸 확인 가능
man bootup
→ booting 전 단계?
→ 부모 프로세스에서 자식 프로세스들이 뻗어나와서 자식 프로세스들끼리 병렬 처리되고 있음을 확인 가능
sudo dnf -y install httpd
: httpd 패키지 설치
→ django, flask, springboot 등의 프레임워크 모두 http 를 가지고 있음
systemctl: 유닛 관리
systemctl status : 상태 확인$ **systemctl status httpd**
○ httpd.service - The **Apache HTTP Server**
Loaded: loaded (/usr/lib/systemd/system/httpd.service; **disabled**; prese>
Active: inactive (dead)
Docs: man:httpd.service(8)sudo systemctl start : 서비스 시작→ 방화벽 오픈
sudo firewall-cmd --add-service=http
sudo systemctl stop : 서비스 중지sudo systemctl restart : 서비스 재시작$ systemctl status httpd
● httpd.service - The Apache HTTP Server
...
Main PID: 2429 (httpd)
...
$ sudo systemctl restart httpd
$ systemctl status httpd
● httpd.service - The Apache HTTP Server
...
Main PID: 2623 (httpd)
... → 재시작 후 pid 가 달라진 걸 확인 가능sudo systemctl reload : 서비스 설정 리로드 → 시스템 설정 100%를 다 보장할 수 없음$ sudo systemctl reload httpd
$ systemctl status httpd
● httpd.service - The Apache HTTP Server
...
Main PID: 2623 (httpd)
... → pid 가 달라지지 않음sudo systemctl enable : 재부팅시 시작되도록 함$ sudo systemctl enable httpd
Created symlink '/etc/systemd/system/multi-user.target.wants/httpd.service' → '/usr/lib/systemd/system/httpd.service'.
$ systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; **enabled**; preset>sudo systemctl disable : 재부팅시 시작되지 않도록 함$ sudo systemctl disable httpd
Removed '/etc/systemd/system/multi-user.target.wants/httpd.service'.
$ systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; **disabled**; prese>아카이브 → 압축
tar: 아카이브, 압축 명령어
tar [옵션1] [옵션2] [옵션3] 파일명
아카이브 생성, 추출
| tar | [옵션1] | [옵션2] | [옵션3] |
|---|---|---|---|
| c(생성) | f(필수) 파일명 | z(gzip) | |
| x(추출) | j(bzip2) | ||
| t(확인) | J(xz) |
압축률: gzip < bzip2 < xz
시간: gzip < bzip2 < xz
아카이브 추출시 덮어쓰기 되는 거 조심
맨앞에 / 를 붙이면 해당 경로에 다 덮어쓰기 되므로 앞에 최상위 경로는 제거됨
gzip: 압축 명령어
gunzip
: 압축 해제 명령어
공통점: 원격 접속 툴
ssh 사용자명@ip주소ssh 사용자명@호스트 이름호스트 이름: DNS 주소
127.0.0.1 → 자기 자신
localhost