W

ls 명령에서 LS_COLOR 환경변수로 확장자별 색 바꾸기

· 19년 전 · 2985
제 .bashrc 중 일부분입니다.
---------------------------------------------------------------------------------------------
...
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
# NORMAL 00 # global default, although everything should be something.
# FILE 00 # normal file
# DIR 01;34 # directory
# LINK 01;36 # symbolic link
# FIFO 40;33 # pipe
# SOCK 01;35 # socket
# BLK 40;33;01 # block device driver
# CHR 40;33;01 # character device driver
# ORPHAN 01;05;37;41 # orphaned syminks
# MISSING 01;05;37;41 # ... and the files they point to

LS_COLORS="di=01;31:or=1;40;31:*.gz=1;35:*.bz2=1;35:*.tar=1;35:*.rpm=1;35:*.tgz=1;35:*.h=1;37:*.c=1;37:*.patch=1;37"
export LS_COLORS
...
---------------------------------------------------------------------------------------------


주석은 /etc/DIR_COLORS 에서 참고 했습니다.

제 설정을 설명하면,

규칙은 [특수파일|*.확장자]= [속성];[색]
이고, 구분자는 ":" 입니다.

di는 DIR의 단축 입니다.
or은 ORPHAN의 단축 이고요.

예 처럼주석에 나와있는 특수 파일에 대한 설정도 하실 수 있습니다.
위의 예를 .bashrc 에 넣으시고, 입맛에 맞게 색을 바꿔보세요.<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:32:05 Linux에서 이동 됨]</div>
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
19년 전 조회 2,387
19년 전 조회 3,850
19년 전 조회 2,846
19년 전 조회 3,046
19년 전 조회 4,645
19년 전 조회 3,849
19년 전 조회 2,582
19년 전 조회 4,589
19년 전 조회 3,560
19년 전 조회 4,439
19년 전 조회 2,289
19년 전 조회 2,507
19년 전 조회 2,432
19년 전 조회 3,639
19년 전 조회 3,018
19년 전 조회 3,784
19년 전 조회 2,983
19년 전 조회 2,804
19년 전 조회 2,633
19년 전 조회 2,514
19년 전 조회 2,425
19년 전 조회 4,542
19년 전 조회 2,975
19년 전 조회 2,448
19년 전 조회 2,552
19년 전 조회 3,126
19년 전 조회 2,252
19년 전 조회 3,488
19년 전 조회 3,066
19년 전 조회 2,566
19년 전 조회 2,098
19년 전 조회 2,516
19년 전 조회 2,316
19년 전 조회 2,192
19년 전 조회 2,759
19년 전 조회 2,602
19년 전 조회 4,171
19년 전 조회 4,042
19년 전 조회 2,547
19년 전 조회 3,568
19년 전 조회 2,258
19년 전 조회 2,670
19년 전 조회 2,568
19년 전 조회 2,621
19년 전 조회 2,485
19년 전 조회 3,109
19년 전 조회 3,119
19년 전 조회 3,445
19년 전 조회 3,329
19년 전 조회 2,986
19년 전 조회 3,210
19년 전 조회 3,442
19년 전 조회 3,156
19년 전 조회 2,885
19년 전 조회 3,210
19년 전 조회 4,784
19년 전 조회 2,700
19년 전 조회 2,719
19년 전 조회 3,771
19년 전 조회 3,427
19년 전 조회 3,097
19년 전 조회 2,347
19년 전 조회 2,074
19년 전 조회 3,156
19년 전 조회 1,999
19년 전 조회 2,601
19년 전 조회 4,218
19년 전 조회 4,016
19년 전 조회 3,729
19년 전 조회 3,663
19년 전 조회 1,849
19년 전 조회 2,214
19년 전 조회 2,139
19년 전 조회 2,802
19년 전 조회 4,902
19년 전 조회 3,029
19년 전 조회 2,190
19년 전 조회 2,192
19년 전 조회 2,089
19년 전 조회 2,847
19년 전 조회 8,454
19년 전 조회 3,006
19년 전 조회 3,059
19년 전 조회 3,334
19년 전 조회 2,489
19년 전 조회 2,504
19년 전 조회 2,458
19년 전 조회 2,344
19년 전 조회 2,551
19년 전 조회 2,784
19년 전 조회 3,359
19년 전 조회 2,610
19년 전 조회 2,185
19년 전 조회 3,110
19년 전 조회 5,293
19년 전 조회 3,768
19년 전 조회 3,732
19년 전 조회 3,249
19년 전 조회 2,671
19년 전 조회 1,751