Mac/Apple

Asciinema 를 통하여 터미널 명령을 녹화 해 보자

  • jroh

요즘 Youtube 나 Vimeo 등 휼륭한 스트리밍 어플리케이션이 있지만, 쉘 커맨드 및 터미날 작업을 Youtube 등을 통하여 업로드하여 공유하기에는 조금은 번거롭습니다. 이와같은 불편함을 해소 할 수 있는 유틸이 바로 Asciinema 입니다.

Asciinema 설치

파이썬의 인스톨러 pip를 이용하여 Asciinema 를 설치합니다.

❯ sudo pip3 install asciinema
Password:
Collecting asciinema
  Downloading https://files.pythonhosted.org/packages/2e/02/cb4aeded6a77e1c23a316a7faeb710b3247dd7294002ccc7123f38f2ade7/asciinema-2.0.1.tar.gz
Installing collected packages: asciinema
  Running setup.py install for asciinema ... done
Successfully installed asciinema-2.0.1

Asciinema 사이트 가입

일단 https://asciinema.org/ 에 접속하여 사용하는 개인 이메일을 통하여 가입을 진행합니다. 이메일을 로그인하여 확인메일의 링크를 클릭하면 최종 가입이 완료 됩니다.

이제 터미널로 돌아가서 아래 명령을 수행합니다.

❯ asciinema auth
Open the following URL in a web browser to link your install ID with your asciinema.org user account:

https://asciinema.org/connect/34857349-3444-53aa-getr-348rofjkldg

This will associate all recordings uploaded from this machine (past and future ones) to your account, and allow you to manage them (change title/theme, delete) at asciinema.org.

생성된 URL을 브라우저로 복사하여 실행하면 최종 인증이 완료됩니다.

Asciinema 를 통한 터미널 녹화

❯ asciinema rec

위 명령을 사용하면 바로 터미널 녹화가 시작됩니다. 기록한 명령이나 작업이 모두 수행이 되고나면 exit 를 통하여 녹화 작업을 종료합니다. 종료 후 <enter> 를 치면 asciinema.org 로 녹화된 내용이 업로드 되며, 자신의 계정에서 확인 할 수 있습니다.

❯ asciinema rec
asciinema: recording asciicast to /var/folders/21/k4dd7r0971x_g1bjcst9l3hc0000gn/T/tmpkj8_dlgt-ascii.cast
asciinema: press <ctrl-d> or type "exit" when you're done
~
❯ echo "hello"
hello

~
❯ echo "hello RSEC.KR"
hello RSEC.KR

~
❯ exit
asciinema: recording finished
asciinema: press <enter> to upload to asciinema.org, <ctrl-c> to save locally

자신의 계정페이지에서 사용할 터미널 녹화 비디오의 Share 부분을 확인하면 Embed 등의 코드를 확인 할 수 있습니다. 이를 SNS나 자신의 블로그에 넣어 포스팅 하면 녹화된 내용을 활용 할 수 있습니다.



터미널에서 긴 명령어를 Vim을 이용하여 편집하고 실행하는 팁Mac/Apple