본문 바로가기
Server/Linux

Linux Essential Certification - 2

by 포항돼지 2025. 7. 16.

 

a.txt  
b.txt
🧾 스크립트 내용
bash
Copy
Edit
for file in *.txt
do 
  echo $file
done
🧠 작동 방식
🔹 *.txt
*.txt는 현재 디렉토리에서 .txt로 끝나는 파일을 모두 찾는 glob(글로빙) 패턴입니다.

즉, a.txt와 b.txt를 대상으로 반복문이 실행됩니다.

🔹 for file in ...
file이라는 변수에 각각의 .txt 파일명이 하나씩 들어갑니다.

🔹 echo $file
각 파일 이름을 출력합니다.

✅ 결과 출력
css
Copy
Edit
a.txt
b.txt
📌 요약
*.txt는 a.txt, b.txt를 의미하고

각각 echo 하니까,

a.txt, b.txt가 한 줄씩 출력됨

 

What is a Linux distribution?

A Linux distribution (or distro) is a complete operating system built around the Linux kernel, bundled with:

  1. The Linux kernel (the core of the OS)
  2. System utilities and libraries (like GNU tools)
  3. Package manager (like apt, yum, or dnf)
  4. User interface tools (command-line and/or graphical desktop environments)
  5. Optional software (web browsers, office tools, etc.)

📦 Why are there different distributions?

Because different goals and users need different setups. Some are made for beginners, others for servers, security, or lightweight performance.


🐧 Examples of Popular Linux Distributions:

DistributionPurpose / Strength
Ubuntu User-friendly, desktop-focused
Debian Stable and free, basis for many others
Red Hat Enterprise Linux (RHEL) Enterprise-focused, paid support
Fedora Cutting-edge features, upstream of RHEL
CentOS / Rocky Linux / AlmaLinux RHEL-compatible, community edition
Arch Linux Minimal, DIY for advanced users
Kali Linux Penetration testing and security
Linux Mint Easy-to-use for Windows switchers

 

 

 

 

Recursive directory listing이란, 한 디렉토리 안의 파일과 폴더뿐만 아니라 그 하위 폴더들 안에 있는 모든 파일과 폴더까지 전부 나열하는 것을 말합니다.

예를 들어, 리눅스에서 ls 명령어에 -R 옵션을 붙여서 실행하면:

bash
CopyEdit
ls -R

현재 디렉토리와 그 안에 있는 모든 하위 디렉토리들을 재귀적으로 탐색해서 모든 파일과 폴더 목록을 보여줍니다.


쉽게 말해

  • 일반 listing: 해당 폴더에 있는 파일과 폴더만 보여줌.
  • Recursive listing: 해당 폴더 안에 있는 폴더들까지 들어가서, 그 안의 파일과 폴더도 모두 보여줌.

필요할 때 하위 디렉토리 구조를 한 번에 전체 확인할 때 유용합니다.

 

 

 

 

 

 

 

 

 

 

 

 

 

'Server > Linux' 카테고리의 다른 글

Linux Essential Certification - 1  (2) 2025.07.16
Linux - 3  (0) 2025.06.20
Linux - 2  (0) 2025.06.11
Linux exam preparation & study  (0) 2025.04.17
리눅스강의 - 1  (0) 2025.02.25