명령어 |
설명 |
uname -a |
커널 및 시스템 정보를 출력합니다. |
hostname |
현재 시스템의 호스트 이름을 확인합니다. |
uptime |
시스템 가동 시간 및 로드 평균 확인. |
whoami |
현재 로그인한 사용자 이름 확인. |
df -h |
디스크 사용량을 확인 (가독성 높은 형식). |
free -h |
메모리 사용량을 확인. |
$ uname -a
Linux ubuntu 5.15.0-79-generic #86-Ubuntu SMP Thu Sep 7 17:38:23 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 50G 25G 23G 52% /
- 디스크 사용량 확인 (남은 용량 및 마운트된 디스크).
$ free -h
total used free shared buff/cache available
Mem: 7.8Gi 2.1Gi 4.5Gi 110Mi 1.2Gi 5.4Gi
Swap: 2.0Gi 0B 2.0Gi
명령어 |
설명 |
ls |
디렉토리의 파일 목록을 출력. |
ls -l |
상세 정보와 함께 파일 목록을 출력. |
cd [디렉토리명] |
디렉토리로 이동. |
pwd |
현재 디렉토리의 경로를 출력. |
mkdir [디렉토리명] |
새 디렉토리를 생성. |
rm [파일명] |
파일 삭제. |
rm -r [디렉토리명] |
디렉토리 및 하위 파일 삭제. |
cp [파일1] [파일2] |
파일 복사. |
mv [파일1] [파일2] |
파일 이동 또는 이름 변경. |
$ mkdir my_project
$ cd my_project
$ pwd
/home/user/my_project
- 새 디렉토리를 생성하고 이동한 후 현재 경로 확인.
$ touch index.html
$ ls -l
-rw-r--r-- 1 user user 0 Jan 7 10:30 index.html
- 빈 파일 index.html을 생성하고 디렉토리 내 파일 확인.
$ echo "<h1>Hello, Ubuntu!</h1>" > index.html
$ cat index.html
<h1>Hello, Ubuntu!</h1>
$ cp index.html about.html
$ ls
about.html index.html
명령어 |
설명 |
sudo [명령어] |
관리자 권한으로 명령 실행. |
chmod [권한] [파일명] |
파일의 권한을 변경. |
chown [사용자:그룹] [파일] |
파일 소유자 변경. |
passwd |
사용자 비밀번호 변경. |
adduser [사용자명] |
새 사용자 생성. |
deluser [사용자명] |
사용자 삭제. |
$ chmod 644 index.html
$ ls -l
-rw-r--r-- 1 user user 31 Jan 7 10:30 index.html
- index.html 파일의 읽기/쓰기 권한 설정.
$ sudo chown other_user index.html
$ ls -l
-rw-r--r-- 1 other_user user 31 Jan 7 10:30 index.html
명령어 |
설명 |
ps -aux |
현재 실행 중인 프로세스 목록 확인. |
top |
실시간 프로세스 정보 확인. |
kill [PID] |
특정 프로세스를 종료. |
jobs |
백그라운드 작업 확인. |
fg |
백그라운드 작업을 포그라운드로 이동. |
bg |
작업을 백그라운드에서 실행. |
$ ps -aux | grep python
user 1234 0.0 1.2 50000 2500 pts/0 S+ 10:40 0:00 python app.py
$ kill 1234
$ ps -aux | grep python
# 출력 없음 (프로세스 종료됨)
명령어 |
설명 |
ip addr |
네트워크 인터페이스 및 IP 정보 확인. |
ping [주소] |
네트워크 연결 상태 확인. |
curl [URL] |
URL에 요청을 보내고 응답 확인. |
wget [URL] |
파일 다운로드. |
netstat -tuln |
열린 포트와 연결 확인. |
ssh [사용자]@[호스트] |
원격 서버 접속. |
$ ping -c 4 google.com
PING google.com (142.250.190.78) 56(84) bytes of data.
64 bytes from fra16s10-in-f14.1e100.net (142.250.190.78): icmp_seq=1 ttl=118 time=14.3 ms
$ curl <https://jsonplaceholder.typicode.com/posts/1>
{
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati",
"body": "quia et suscipit\\nsuscipit recusandae ..."
}
- REST API를 호출하여 JSON 데이터를 확인.
명령어 |
설명 |
apt update |
패키지 목록 갱신. |
apt upgrade |
설치된 패키지 업그레이드. |
apt install [패키지명] |
패키지 설치. |
apt remove [패키지명] |
패키지 삭제. |
dpkg -l |
설치된 패키지 목록 확인. |
$ sudo apt update
$ sudo apt install git
- 시스템 패키지 목록을 업데이트하고 Git 설치.
$ git --version
git version 2.25.1
명령어 |
설명 |
find [경로] -name [파일명] |
특정 파일 이름으로 검색. |
locate [파일명] |
파일의 위치 빠르게 검색. |
grep [문자열] [파일명] |
파일 내 특정 문자열 검색. |
$ find /home/user -name "*.html"
/home/user/my_project/index.html
$ locate config
/etc/ssh/ssh_config
/etc/mysql/my.cnf
명령어 설명
명령어 |
설명 |
shutdown now |
즉시 시스템 종료. |
shutdown -r now |
즉시 시스템 재부팅. |
reboot |
시스템 재부팅. |
halt |
시스템 종료. |
$ sudo shutdown -h now
$ sudo reboot