로그 파일 생성 없이, 세션 종료 없이 백그라운드 실행
nohup {실행파일} 1>/dev/null 2>&1 &저장 안하고 나가기
# E37: No write since last change (add ! to override) 발생 시
:q!실행중인 프로세스 확인
ps -ef | grep {패턴}
ps aux | grep {패턴}ps -ef는 System V 스타일로 모든 프로세스를 full format으로 보여주며ps aux는 BSD 스타일로 CPU/메모리 사용량 중심의 프로세스 정보를 제공한다.
특정 PORT 사용 프로세스 확인
lsof -i:8080로그 파일 확인
tail -f {로그 파일 경로}파일 작성
cat << EOF > /home/ec2-user/{파일이름}
#!/usr/bin/python
...
EOFSCP 파일 전송
scp -rp -i ssh-key-2023-08-09.key {파일} opc@129.154.55.231:/home/opc
SSH 접속
ssh -i ssh-key-2023-08-09.key opc@129.154.55.231
SSH Config
~/.ssh/
├── config ← SSH 설정 파일
├── id_rsa ← 기본 개인 키 (기본값)
├── id_rsa.pub ← 기본 공개 키
├── company_id_rsa ← 회사용 개인 키
├── company_id_rsa.pub ← 회사용 공개 키
├── personal_server_id ← 개인 서버용 키
├── personal_server_id.pub
└── known_hosts ← 접속한 호스트 정보 저장
# ~/.ssh/config
# 회사 서버
Host company-server
HostName server.company.com
User ec2-user
IdentityFile ~/.ssh/company_id_rsa
IdentitiesOnly yes
# 개인 서버
Host my-vps
HostName 123.45.67.89
User ubuntu
IdentityFile ~/.ssh/personal_server_id
IdentitiesOnly yes
# 개인 서버 접속
ssh my-vps
# 회사 서버 접속
ssh company-server
파일 권한 확인
ls -al
파일 권한 설정
chmod {권한} {변경할 파일 or 디렉토리}
rwx(User)rwx(Group)rwx(Other)rwx(421)
심볼릭 링크
ln [option] [source] [link]
ln -s ~/Library/Mobile\ Documents/iCloud\~md\~obsidian/Documents/Vault\ Name ~/path/to/local
- link 의 약자인
ln명령어를 통해 링크파일 생성 가능 - Obsidian 을 사용할 경우 iCloud Drive 를 통해 기기간 연동이 가능한데 로컬에서의 변경사항을 iCloud Drive 내에 링크파일을 생성해서 동기화 및 백업을 수행할 수 있음
set -exuo pipefail
set -exuo pipefail
쉘 스크립트의 오동작, 버그를 줄이는 명령어
set -e(errexit) 오류가 발생하면 스크립트 종료set -x(xtrace) 실행되는 명령어와 인수들 출력set -u(nounset) 설정되지 않은 변수 사용 시 종료set -o pipefail(옵션 on/off(+o)) 파이프 사용 시 오류 코드를 이어 받음
mkdir
mkdir -p /not_yet_parent/target_dir
-p(parents) 필요한 상위 디렉토리 생성
ifconfig
# Private IP 확인
root@lima-default:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.5.15 netmask 255.255.255.0 broadcast 192.168.5.255
inet6 fe80::5055:55ff:fe3d:a9b1 prefixlen 64 scopeid 0x20<link>
ether 52:55:55:3d:a9:b1 txqueuelen 1000 (Ethernet)
RX packets 21647 bytes 29662336 (29.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2818 bytes 215856 (215.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 95 bytes 7812 (7.8 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 95 bytes 7812 (7.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
# Public IP 확인
root@lima-default:~# curl ifconfig.co
3.36.244.20curl
root@lima-default:~# curl -v https://google.com
* Host google.com:443 was resolved.
* IPv6: (none)
* IPv4: 142.250.197.14
* Trying 142.250.197.14:443...
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / X25519MLKEM768 / id-ecPublicKey
* ALPN: server accepted h2
* Server certificate:
* subject: CN=*.google.com
* start date: Dec 3 15:50:09 2025 GMT
* expire date: Feb 25 15:50:08 2026 GMT
* subjectAltName: host "google.com" matched cert's "google.com"
* issuer: C=US; O=Google Trust Services; CN=WE2
* SSL certificate verify ok.
* Certificate level 0: Public key type EC/prime256v1 (256/128 Bits/secBits), signed using ecdsa-with-SHA256
* Certificate level 1: Public key type EC/prime256v1 (256/128 Bits/secBits), signed using ecdsa-with-SHA384
* Certificate level 2: Public key type EC/secp384r1 (384/192 Bits/secBits), signed using ecdsa-with-SHA384
* Connected to google.com (142.250.197.14) port 443
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://google.com/
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: google.com]
* [HTTP/2] [1] [:path: /]
* [HTTP/2] [1] [user-agent: curl/8.14.1]
* [HTTP/2] [1] [accept: */*]
> GET / HTTP/2
> Host: google.com
> User-Agent: curl/8.14.1
> Accept: */*
>
* Request completely sent off
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
< HTTP/2 301
< location: https://www.google.com/
< content-type: text/html; charset=UTF-8
< content-security-policy-report-only: object-src 'none';base-uri 'self';script-src 'nonce-etdn54IcTHyGObO82DqZZQ' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp
< date: Mon, 22 Dec 2025 12:27:16 GMT
< expires: Wed, 21 Jan 2026 12:27:16 GMT
< cache-control: public, max-age=2592000
< server: gws
< content-length: 220
< x-xss-protection: 0
< x-frame-options: SAMEORIGIN
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
<
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>
* Connection #0 to host google.com left intact- verbose 옵션
nslookup
root@lima-default:~# nslookup google.com
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: google.com
Address: 142.250.197.14
root@lima-default:~# cat /etc/hosts
127.0.0.1 localhosttelnet
root@lima-default:~# telnet google.com 80
Trying 142.250.197.14...
Connected to google.com.
Escape character is '^]'.
^C
Connection closed by foreign host.- ping 과는 다르다. ping 은 L3 에서 호스트가 살아있는지만 확인한다. ICMP Echo Request/Reply 로 동작하고 포트나 TCP/UDP 개념은 포함하지 않는다. ping 응답이 안온다면 네트워크 경로, ICMP 차단, 호스트 다운 등을 의심해볼 수 있다.
- telnet 은 L3 에서 특정 포트가 열려있고 서비스가 listening 중인지 확인할 수 있다. TCP 3-way handshake 를 수행한다.
netstat
root@lima-default:~# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.54:53 0.0.0.0:* LISTEN 1423/systemd-resolv
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 1423/systemd-resolv
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1/init
tcp 0 0 127.0.0.1:34479 0.0.0.0:* LISTEN 4286/containerd
tcp6 0 0 :::22 :::* LISTEN 1/inittop
root@lima-default:~# top
top - 21:16:28 up 3:11, 1 user, load average: 0.06, 0.03, 0.00
Tasks: 131 total, 1 running, 129 sleeping, 0 stopped, 1 zombie
%Cpu(s): 0.0 us, 0.0 sy, 0.0 ni, 99.9 id, 0.0 wa, 0.0 hi, 0.1 si, 0.0 st
MiB Mem : 3899.1 total, 1891.3 free, 434.1 used, 1738.1 buff/cache
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 3465.1 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 25504 14792 10184 S 0.0 0.4 0:03.55 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.04 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:00.00 pool_wosar
root@lima-default:~# sar
Linux 6.17.0-6-generic (lima-default) 12/22/25 _aarch64_ (4 CPU)
18:05:28 LINUX RESTART (4 CPU)
18:10:36 CPU %user %nice %system %iowait %steal %idle
18:20:36 all 0.06 0.00 0.12 0.00 0.00 99.82
18:30:36 all 0.07 0.00 0.12 0.00 0.00 99.81
18:40:36 all 0.08 0.00 0.13 0.00 0.00 99.79
18:50:36 all 0.09 0.00 0.14 0.00 0.00 99.77
19:00:36 all 0.08 0.00 0.13 0.00 0.00 99.78
19:10:36 all 0.12 0.00 0.16 0.00 0.00 99.72
19:20:36 all 0.06 0.00 0.10 0.00 0.00 99.83
19:30:36 all 0.08 0.00 0.12 0.00 0.00 99.80
19:40:36 all 0.07 0.00 0.11 0.00 0.00 99.82
19:50:36 all 0.05 0.00 0.09 0.00 0.00 99.85
20:00:36 all 0.06 0.00 0.10 0.00 0.00 99.84
20:10:36 all 0.08 0.00 0.13 0.00 0.00 99.79
20:20:36 all 0.09 0.00 0.14 0.00 0.00 99.77
20:30:36 all 0.09 0.00 0.14 0.00 0.00 99.77
20:40:36 all 0.07 0.00 0.12 0.00 0.00 99.80
20:50:36 all 0.07 0.00 0.12 0.00 0.00 99.80
21:00:36 all 0.08 0.00 0.13 0.00 0.00 99.79
21:10:36 all 0.08 0.00 0.14 0.00 0.00 99.78
Average: all 0.08 0.00 0.13 0.00 0.00 99.80Insufficient space for shared memory file
디스크 용량 확인
df -h메모리 확인
free -m
- 사실
/proc/meminfo내용
경로 메모리 확인
sudo du -h --max-depth=1Vim
여러 줄 문자 수정
Ctrl+v로 VISUAL BLOCKShift+g로 맨 밑까지 씌우기Shift+i로 문자 삽입 /x로 문자 제거Esc두 번으로 적용