W

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

· 19년 전 · 2724
제 .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,129
19년 전 조회 3,577
19년 전 조회 2,599
19년 전 조회 2,768
19년 전 조회 4,384
19년 전 조회 3,565
19년 전 조회 2,339
19년 전 조회 4,312
19년 전 조회 3,302
19년 전 조회 4,156
19년 전 조회 2,024
19년 전 조회 2,237
19년 전 조회 2,167
19년 전 조회 3,365
19년 전 조회 2,737
19년 전 조회 3,534
19년 전 조회 2,701
19년 전 조회 2,537
19년 전 조회 2,362
19년 전 조회 2,247
19년 전 조회 2,140
19년 전 조회 4,279
19년 전 조회 2,695
19년 전 조회 2,176
19년 전 조회 2,276
19년 전 조회 2,869
19년 전 조회 1,974
19년 전 조회 3,227
19년 전 조회 2,780
19년 전 조회 2,287
19년 전 조회 1,828
19년 전 조회 2,261
19년 전 조회 2,026
19년 전 조회 1,920
19년 전 조회 2,480
19년 전 조회 2,339
19년 전 조회 3,916
19년 전 조회 3,755
19년 전 조회 2,258
19년 전 조회 3,312
19년 전 조회 1,973
19년 전 조회 2,413
19년 전 조회 2,300
19년 전 조회 2,363
19년 전 조회 2,195
19년 전 조회 2,835
19년 전 조회 2,839
19년 전 조회 3,184
19년 전 조회 3,055
19년 전 조회 2,725
19년 전 조회 2,943
19년 전 조회 3,187
19년 전 조회 2,904
19년 전 조회 2,627
19년 전 조회 2,947
19년 전 조회 4,528
19년 전 조회 2,443
19년 전 조회 2,461
19년 전 조회 3,502
19년 전 조회 3,181
19년 전 조회 2,828
19년 전 조회 2,066
19년 전 조회 1,803
19년 전 조회 2,893
19년 전 조회 1,752
19년 전 조회 2,333
19년 전 조회 3,969
19년 전 조회 3,749
19년 전 조회 3,469
19년 전 조회 3,425
19년 전 조회 1,585
19년 전 조회 1,953
19년 전 조회 1,873
19년 전 조회 2,550
19년 전 조회 4,635
19년 전 조회 2,779
19년 전 조회 1,935
19년 전 조회 1,952
19년 전 조회 1,835
19년 전 조회 2,578
19년 전 조회 8,191
19년 전 조회 2,743
19년 전 조회 2,807
19년 전 조회 3,057
19년 전 조회 2,211
19년 전 조회 2,227
19년 전 조회 2,192
19년 전 조회 2,084
19년 전 조회 2,271
19년 전 조회 2,535
19년 전 조회 3,102
19년 전 조회 2,344
19년 전 조회 1,922
19년 전 조회 2,849
19년 전 조회 5,020
19년 전 조회 3,513
19년 전 조회 3,467
19년 전 조회 2,990
19년 전 조회 2,416
19년 전 조회 1,503