/
설정 파일 변경 사항을 반영하는 linux source 명령어 사용법
설정 파일 변경 사항을 반영하는 linux source 명령어 사용법
개요
리눅스의 source 는 파일에 있는 command를 읽고 실행하는 bash 내장 명령어로 현재 shell session 내에서 실행됩니다.
source 명령어는 주로 shell의 초기화 파일(~/.bash_profile, ~/.zshrc) 을 수정했을 경우 logoff 와 login 을 하지 않고 현재 쉘 세션에 설정을 반영하기 위해서 사용합니다.
사용법은 source 명령어 뒤에 command 를 기술한 파일의 경로를 주면 되며 주로 shell 초기화 파일을 전달합니다.
예로 다음 명령은 .bash_profile 내에 변경한 설정을 현재 세션에 반영합니다.
$ source ~/.bash_profile
zsh 를 사용할 경우 설정 파일이 변경되면 아래와 같이 설정 파일을 경로를 입력해 주면 됩니다.
$ source ~/.zshrc
. 명령어 의미는?
예전에는 source 명령어대신 . 을 많이 사용했지만 가독성이 떨어지므로 최근에는 source 명령어 사용을 권장하고 있습니다.
즉 아래 2가지 명령어는 동일한 의미입니다.
$ source ~/.bash_profile
$ . ~/.bash_profile
Ref
, multiple selections available,
Related content
Linux 파일 이름에서 경로와 확장자를 추출하는 법(Extract File Basename Without Path and Extension in Bash)
Linux 파일 이름에서 경로와 확장자를 추출하는 법(Extract File Basename Without Path and Extension in Bash)
More like this
파일의 앞 부분을 보는 linux head 명령어 사용법
파일의 앞 부분을 보는 linux head 명령어 사용법
More like this
파일 유형(file type)을 알려주는 linux file 명령어 사용법
파일 유형(file type)을 알려주는 linux file 명령어 사용법
More like this
리눅스 설치와 관리
리눅스 설치와 관리
More like this
bash 자동 완성(auto completion) 기능으로 커맨드라인 생산성 높이기
bash 자동 완성(auto completion) 기능으로 커맨드라인 생산성 높이기
More like this
bash on Ubuntu on Windows 쉘로 cmder 사용하기
bash on Ubuntu on Windows 쉘로 cmder 사용하기
More like this