일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- 클래스 관계
- madia designer ui design
- 구조적 설계
- base64
- UseCase
- factory metohd pattern
- status diagram
- 생성패턴 행위패턴 구조패턴
- 팬인과 팬아웃
- gof design pattern
- telnet
- 리버스쉘
- sofrware architeture
- fan-in fan-out
- prototypepattern 예시 example
- 매크로를 바라보는 시각
- 상태다이어그램
- 암표거래
- ui 디자인 기본원칙
- 모듈구조도
- strucuture charat
- cron
- 객체 상속 속성 인스턴스 메소드 오퍼레이션
- 소프트웨어공학 디자인패턴
- bandit21
- 디자인패턴
- usecase description
- Bandit
- ssh
- nc reverse shell
- Today
- Total
2.log
Shell 과 bashrc 본문
Shell
사용자(user)와 커널(Kernel) 사이에서 매개체 역할하는 프로그램
사용자로부터 명령을 받아 프로세싱 하기 위해 커널에 넘겨주어 사용자가 커널에 직접 명령 내릴 수 있게 함
bashrc
Bourne Again Shell 의 축약어로, 리눅스에서 가장 널리 사용되는 쉘
보통 5개의 공통된 설정 파일 가지며 일반적으로 전역 파일은 /etc 디렉토리,
지역 파일(특정 사용자에게만 영향 끼치는 파일)은 사용자의 홈 디렉토리에서 숨김파일( ' . ' 으로 시작) 형태로 존재함
파일종류
- /etc/profile
- ~/.bash_profile
- ~/.bashrc
- /etc/bashrc
- ~/.bash_logout
파일설명
/etc/profile
환경변수와 bash 가 수행될 때 실행되는 프로그램 제어하는 전역 시스템 설정과 관련된 파일
bashrc와 마찬가지로 로그인 시 수행되는 시스템 전체 환경 설정 파일
~/.bash_profile
환경변수와 bash 수행 시 실행되는 프로그램 제어하는 지역 시스템 설정과 관련된 파일
이 환경변수는 오직 해당 사용자에게 한정됨
전역 설정 파일인 /etc/profile 수행된 후 곧바로 수행 됨
~/.bashrc
alias(별칭)와 bash 수행 시 실행되는 함수를 제어하는 지역 시스템 설정과 관련된 파일
별칭과 함수는 오직 해당 사용자에게 한정됨
.bash_profile : bash 가 login shell 로 쓰일때 (처음 로그인 할 때) 수행 됨
.bashrc : bash 실행될 때마다 수행 됨
/etc/bashrc
~/.bashrc 와 달리 전체용(모든 사용자에게 영향 미침) 환경 설정 파일
~/.bash_logout
사용자가 로그아웃 하기 직전 실행하는 프로그램에 관한 bash의 지역 시스템 설정과 관련된 파일
오직 해당 프로그램 실행하는 사용자에게 영향 미침
호출순서
OS 는 /etc/profile 과 ~/.bashprofile 2개 순서대로 호출
각 파일은 내부적으로 다른 파일 호출
- 리눅스(OS) >> /etc/profile >> ...
- 리눅스(OS) >> ~/.bash_profile >> ~/.bashrc >> /etc/bashrc
실행순서
/etc/profile >> /.bash_profile >> /.bashrc >> /etc/bashrc
/.bash_logout
코드분석
# /etc/profile
execute /etc/profile
IF ~/.bash_profile exists THEN
execute ~/.bash_profile
ELSE
IF ~/.bash_login exist THEN
execute ~/.bash_login
ELSE
IF ~/.profile exist THEN
execute ~/.profile
END IF
END IF
END IF
>> .bash_profile 있으면 실행
# /.bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
>> .bashrc 있으면 실행
# /.bashrc
# cat ~/.bashrc
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
>> /etc/bashrc 있으면 실행
# /etc/bashrc
# System wide functions and aliases
# Environment stuff goes in /etc/profile
... 중략 ...
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
if [ "$PS1" ]; then
. $i
else
. $i >/dev/null 2>&1
fi
fi
done
unset i
unset pathmunge
fi
# vim:ts=4:sw=4
>> /etc/profile.d 폴더 내의 모든 sh 파일 실행
# when logout
IF ~/.bash_logout exists THEN
execute ~/.bash_logout
END IF
※ 오류 지적 감사히 받겠습니다..
[출처]
쉘의 개념, bashrc의 개념
쉘(Shell) 쉘이란, 사용자와 커널 사이의 매개체 역할을 하는 프로그램이다. 사용자가 커널에 직접 명령을 내릴 수 있게하는 프로그램이다. 즉, 쉘은 사용자로부터 명령을 받아서 그것을 프로세싱
dohk.tistory.com
profile bashrc bash profile 실행 순서 - 제타위키
✔️ 페도라 11 (Leonidas)에서 테스트하였습니다. bash 쉘 초기화 파일 실행 순서 profile bashrc bash_profile 실행 순서 profile bashrc bash_profile 호출 순서 1 실행순서 (간단히 정리)[ | ] 기본 설정에서 실행 순
zetawiki.com
Execution sequence for .bash_profile, .bashrc, .bash_login, .profile and .bash_logout
Execution sequence for .bash_profile, .bashrc, .bash_login, .profile and .bash_logout by Ramesh Natarajan on October 6, 2008 This article will explain the sequence in which the following files are executed: /etc/profile ~/.bash_profile ~/.bashrc ~/.bash_lo
www.thegeekstuff.com
'HACKING > Bandit+' 카테고리의 다른 글
install 명령어로 파일 권한 변경 하는 법 (0) | 2023.04.06 |
---|---|
setuid 에 대하여 (0) | 2023.04.06 |
SSH 키 이용 시 bad permissions: ignore key: 에러가 발생할 경우 (0) | 2023.04.01 |
diff 명령어 (0) | 2023.04.01 |
리다이렉트(Redirect)과 포워드(Forward) 차이 (0) | 2023.03.30 |