티스토리 뷰

반응형

맥터미널 경로 표시를 리눅스처럼 바꾸어 보겠습니다.

먼저 터미널에 echo $PS1을 입력하시면 \h:\W \u$로 나올 것입니다.

\h 컴퓨터의 호스트 이름

\W 디렉토리 경로를 표시

\u 유저 이름

$ 위에 터미널 사진처럼 문자 그대로 표시 입니다 (:)와 동일

그외 적용가능한 프롬프트 코드는 아래와 같습니다.

  • \a : an ASCII bell character (07)
  • \d : the date in "Weekday Month Date" format (e.g., "Tue May 26")
  • \D{format} : the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required
  • \e : an ASCII escape character (033)
  • \h : the hostname up to the first '.'
  • \H : the hostname
  • \j : the number of jobs currently managed by the shell
  • \l : the basename of the shell’s terminal device name
  • \n : newline
  • \r : carriage return
  • \s : the name of the shell, the basename of $0 (the portion following the final slash)
  • \t : the current time in 24-hour HH:MM:SS format
  • \T : the current time in 12-hour HH:MM:SS format
  • \@ : the current time in 12-hour am/pm format
  • \A : the current time in 24-hour HH:MM format
  • \u : the username of the current user
  • \v : the version of bash (e.g., 2.00)
  • \V : the release of bash, version + patch level (e.g., 2.00.0)
  • \w : the current working directory, with $HOME abbreviated with a tilde
  • \W : the basename of the current working directory, with $HOME abbreviated with a tilde
  • \! : the history number of this command
  • \# : the command number of this command
  • \$ : if the effective UID is 0, a #, otherwise a $
  • \nnn : the character corresponding to the octal number nnn
  • \\ : a backslash
  • \[ : begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
  • \] : end a sequence of non-printing characters
터미널 시작시 바로 적용하기위해서는 bash_profile을 만들어 설정해 주셔야 됩니다.
sudo vi ~/.bash_profile 입력

export CLICOLOR=1 터미널 칼라를 사용하겠다는 뜻입니다.
export CLICOLOR_FORCE=1 항상 칼라로 표시한다는 뜻입니다.
export PS1="원하는 설정값" 선택하시면 됩니다.
저의 경우는 exportPS1="\u\w$"

그리고 터미널을 완전히 종류 후 다시 키시면 바뀝니다.
잘못된 정보가 있으면 바로바로 지적 해주시면 감사하겠습니다.



 

 

반응형
댓글
최근에 올라온 글
최근에 달린 댓글