beauty in struggle

linux pycharm 실행 명령어 등록하기 본문

After-work/linux

linux pycharm 실행 명령어 등록하기

dgdeus 2023. 1. 7. 12:40
728x90
SMALL

pycharm을 ubuntu에 설치하고 실행할 때, 매번 해당 경로에 들어가서 스크립트를 수행시켜줘야 한다.

 

이거 너무 귀찮으니까,

1. pycharm을 실행하는 shell script를 만들어주고,

2. 이 script를 실행하는 command를 alias로 등록해주자

 

 

1. pycharm 실행 script 작성

# Run this command on your shell to create shell script
>> vi run_pycharm.sh


# Write this inside run_pycharm.sh file
echo "Start running pycharm!"
cd <your_pycharm_path>/bin
sh pycharm.sh

# Run this command on your shell to execute the script using './'
# - This command adds execution privilige to target.
>> sudo chmod +x run_pycharm.sh

 

 

2. alias에 해당 shell script 실행 command를 (영구적으로) 등록

vi ~/.bashrc 로 .bashrc 파일을 열어보니 alias별칭은 .bash_aliases 파일로 따로 관리를 추천하고 있다.

 

./bash_aliases 파일에 'pycharm' alias 별칭을 위에서 만든 shell script를 실행하도록 설정

# Make and start writing down .bash_aliases file
>> vim ~/.bash_aliases

# Write your alias to run the script we made before to run pycharm
alias pycharm='<your_path_to_the_script>/run_pycharm.py'

# Run this command on your shell to apply the added alias
>> source ~/.bash_aliases

# Now you can run pycharm by just typing 'pycharm' on your shell
>> pycharm

 

작성한 .bash_aliases 파일

 

이제 shell에서 pycharm 입력만으로 pycharm 프로그램이 실행되는 것을 확인할 수 있다.

728x90
LIST
Comments