터미널 문자 인코딩을 변경하는 방법

터미널 문자 인코딩을 변경하는 방법

오늘 저는 집에 설치된 CentOS 설치에서 GUI 패키지를 제거했습니다. 이제 머신이 부팅되면 로그인 프롬프트가 나타납니다. 그 행동은 까다롭습니다. 때로는 각 프롬프트에 응답한 후 Enter 키를 한 번만 누르면 되는 경우도 있습니다. 다른 때에는 그렇지 않습니다. 성공적으로 로그인하면 bash한 번에 한 문자만 입력하여 명령을 입력할 수 있습니다. 예:

l, enter
o, enter
c, enter
a, enter
l, enter
e, enter
enter

누구든지 이것에 대한 통찰력을 가지고 있습니까?

업데이트: 결과는 다음과 같습니다 stty -a.

speed 38400 baud; rows 64; columns 160; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts cdtrdsr
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

그러나 다른 설정은 stty sane적용되지 않습니다.

답변1

편집 2:http://unixhelp.ed.ac.uk/CGI/man-cgi?stty stty 출력을 이해하는 데 도움이 될 수 있습니다. "min=1"과 다른 echo* 설정을 구체적으로 살펴보겠습니다.

stty 호출을 시도해 볼 수도 있습니다(예제는 "sty cbreak" 또는 "raw" 모드와 비슷합니다). 다음을 입력해 보세요. stty sane

문제가 해결되면(작동하는 경우) 더 쉽게 조사할 수 있습니다.

편집 1: stty -a설정을 추가한 후에는 귀하의 설정과 내 설정의 차이점을 보여 드리겠습니다.

(저는 이 작업을 오래된 AIX xterm에서 수행하고 있으므로 물론 차이점이 많이 있습니다! 그러나 관련된 차이점을 지적할 수는 있습니다. 어느 것이 가장 적합한지 확인하는 작업을 하도록 하겠습니다. 범인, 지금은 시간이 있는 것 같아서 미안해요!)

이를 위해 stty가 보여준 모든 키워드를 "WELIST"에 나열한 다음 각 stty의 각 줄 앞에 ""를 추가하고 다음과 같이 표시했습니다.

for i in $( cat WELIST) ; do
   I_Have=$(grep "[ -]$i " IHAVE)
   You_Have=$(grep "[ -]$i " YOUHAVE)
   if [ "$I_Have" = "$You_Have" ]
   then
      printf "%-20s : %s\n" "$I_Have"   "BOTH"
   else
      if [ -z "$I_Have" ]
      then
         printf "%-20s : %s\n" "$You_Have" "ONLY you"
         continue
      fi
      if [ -z "$You_Have" ]
      then
         printf "%-20s : %s\n" "$I_Have"   "ONLY me"
         continue
      fi
      printf "%-20s : %s\n" "$I_Have"   "me"
      printf "%-20s : %s\n" "$You_Have" "you"
   fi
done

그것은 다음을 제공합니다:

 brkint              : me
-brkint              : you
 bs0                 : ONLY you
 cdtrdsr             : ONLY you
-clocal              : BOTH
 179 columns         : me
 columns 160         : you
 cr0                 : ONLY you
 cread               : BOTH
-crtscts             : ONLY you
 cs8                 : BOTH
-cstopb              : BOTH
 discard = ^O        : ONLY me
 dsusp = ^Y          : ONLY me
 echo                : BOTH
-echoctl             : me
 echoctl             : you
-echoe               : me
 echoe               : you
-echok               : me
 echok               : you
-echoke              : me
 echoke              : you
-echonl              : BOTH
-echoprt             : BOTH
 eof = ^D            : BOTH
 eol = <undef>       : BOTH
 eol2 = <undef>      : BOTH
 erase = ^?          : BOTH
 eucw 1:1:0:0        : ONLY me
 ff0                 : ONLY you
 flush = ^O          : ONLY you
-flusho              : ONLY me
-hupcl               : me
 hupcl               : you
 icanon              : BOTH
 icrnl               : BOTH
-iexten              : me
 iexten              : you
-ignbrk              : BOTH
-igncr               : BOTH
-ignpar              : BOTH
-imaxbel             : BOTH
-inlcr               : BOTH
-inpck               : BOTH
 intr = ^C           : BOTH
 isig                : BOTH
-istrip              : BOTH
-iuclc               : BOTH
 iutf8               : ONLY you
-ixany               : BOTH
-ixoff               : BOTH
 ixon                : BOTH
 kill = ^U           : BOTH
 line = 0            : ONLY you
 lnext = ^V          : BOTH
 min = 1             : ONLY you
 nl0                 : ONLY you
-noflsh              : BOTH
-ocrnl               : BOTH
-ofdel               : BOTH
-ofill               : BOTH
-olcuc               : BOTH
 onlcr               : BOTH
-onlret              : BOTH
-onocr               : BOTH
 opost               : BOTH
-parenb              : BOTH
-parext              : ONLY me
-parmrk              : BOTH
-parodd              : BOTH
-pending             : ONLY me
 quit = ^\           : BOTH
 reprint = ^R        : ONLY me
 60 rows             : me
 rows 64             : you
 rprnt = ^R          : ONLY you
 scrw 1:1:0:0:       : ONLY me
 speed 38400 baud    : BOTH
 start = ^Q          : BOTH
 stop = ^S           : BOTH
 susp = ^Z           : BOTH
 swtch = <undef>     : ONLY you
 tab0                : ONLY you
 tab3                : ONLY me
 time = 0            : ONLY you
-tostop              : BOTH
 vt0                 : ONLY you
 werase = ^W         : BOTH
-xcase               : BOTH

관련 정보