OS

리눅스 실습하기-03{2023년05월17일}

늦게 시작한 개발자 2023. 5. 21. 21:55

Bourne Shell(sh) : 유닉스 7버전의 기본 쉘.

C Shell(csh) : C언어 기반으로 개발 / History, alias 등 유용한 기능이 존재 / 명령행 편집 기능이 없음

TC Shell(tcsh) : C쉘(csh)과 통합해서 탕생된 쉘 / C 쉘에 없는 명령어 자동완성, 편집기능을 지원

Korn Shell(ksh) : 본쉘(sh)을 확장해서 만들어진 쉘 / History, vi, 명령해 편집 등 여러 기능을 제공 

Bourne Again Shell(bash) : 본쉘(sh)을 기반으로 만들어진 쉘 / 리눅스의 표준 쉘

Z Shell(zsh) : 본쉘의 확장된 버전 / 맞춤법 검사 / 로그인(로그아웃) 감시 기능

 

현재 설치되어 있는 쉘 확인하기

[root@localhost ~]# cat /etc/shells
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
/bin/tcsh
/bin/csh

[root@localhost ~]# chsh -l
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
/bin/tcsh
/bin/csh

현재 지정된 쉘 확인하기

[root@localhost ~]# echo $SHELL
/bin/bash
[root@localhost ~]# su - jslee
[jslee@localhost ~]$ echo $SHELL
/bin/bash

# 사용자별 지정된 쉘 확인하기 grep 사용자계정 /etc/passwd
[jslee@localhost root]$ grep jslee /etc/passwd
jslee11g:x:1000:1000:jslee11g:/home/jslee11g:/bin/bash
jslee:x:1002:1002::/home/jslee:/bin/bash
# /bin/bash라는 것을 확인할 수 있다.

쉘 변경하기

# 현재 root의 쉘은 bash로 되어 있다.
[root@localhost ~]# grep root /etc/passwd
root:x:0:0:root:/root:/bin/bash

# 변경이 가능한 쉘 리스트
[root@localhost ~]# chsh -l
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
/bin/tcsh
/bin/csh

# chsh -s /bin/sh 로 sh쉘로 변경
[root@localhost ~]# chsh -s /bin/sh
Changing shell for root.
Shell changed.

# passwd에서 root의 bash에서 sh로 변경 된 것을 확인
[root@localhost ~]# cat /etc/passwd | grep root 
root:x:0:0:root:/root:/bin/sh

# 하지만 echo $SHELL 에서는 계정 재접속 후에 환경변수가 변경된 모습을 확인할 수 있다.