# APT가 터미널에서 멋진 프로그레스바를 표시한 방법

> Clean Markdown view of GeekNews topic #5198. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=5198](https://news.hada.io/topic?id=5198)
- GeekNews Markdown: [https://news.hada.io/topic/5198.md](https://news.hada.io/topic/5198.md)
- Type: news
- Author: [xguru](https://news.hada.io/@xguru)
- Published: 2021-10-15T09:34:01+09:00
- Updated: 2021-10-15T09:34:01+09:00
- Original source: [mdk.fr](https://mdk.fr/blog/how-apt-does-its-fancy-progress-bar.html)
- Points: 11
- Comments: 0

## Topic Body

- apt가 설치 진행할 때, 스크롤되는 터미널 화면에서도 최하단에 멋진 프로그레스 바를 표시

ㅤ→ 커서 위치를 저장했다가 최하단으로 가서 출력하고 커서 포지션을 복원

- 사용한 Escape 코드 (ESC = "\033" ):

print(f"\0337\033[0;{lines}r\033[{lines};0f\033[0K\0338")

ESC 7 is DECSC (Save Cursor)

ESC 8 is DECRC (Restore Cursor)

ESC [ Pn ; Pn r is DECSTBM (Set Top and Bottom Margins)

ESC [ Pn A is CUU (Cursor Up)

ESC [ Pn ; Pn f is HVP (Horizontal and Vertical Position)

ESC [ Ps K is EL (Erase In Line)

## Comments



_No public comments on this page._
