[사용 예]
#cd → 현재 사용자의 홈 디렉터리로이동. 만약 현재 사용자가
root면 ‘/root’ 디렉터리로 이동
#cd ~centos → 바로 상위의 디렉터리로 이동
[사용 예]
#pwd
명령을 실행한 사용자의 소유가 된다.
[사용 예]
#mkdir abd → 현재 디렉터리 아래에 /abc 이름의 디렉터리 생성
것을 허용하지 않는다.
[사용 예]
[root@Centos-srv ~]# mkdir -p /root/bye/today
[root@Centos-srv ~]# cd bye/today/
[사용 예]
cp abc.txt cba.txt → abc.txt를 cba.txt라는 이름으로 바꿔서 복사
[root@Centos-srv ~]# cp bye bye2
cp: omitting directory ‘bye’
[root@Centos-srv ~]# cp -r bye bye2
anaconda-ks.cfg bye bye2 hell hell2 hello test.txt
[root@Centos-srv ~]# cd bye2/today
[사용 예]
[root@Centos-srv ~]# touch test.txt
[root@Centos-srv ~]# ls
anaconda-ks.cfg bye bye2 hell hell2 hello test.txt
[root@Centos-srv ~]# mv test.txt hello/option
[root@Centos-srv ~]# ls hello
option test
[사용 예]
#rm abc.txt → 해당 파일 삭제
#rm -i abc.txt - 삭제시 정말 삭제할지 확인하는메세지가 나옴
#rm -f abc.txt - 삭제 시 확인하지 않고 바로 삭제함
#rm -r abc → 해당 디렉터리 삭제
[사용 예]
#cat a.txt → a.txt 파일의 내용을 화면에 보여줌
[root@Centos-srv ~]# cat anaconda-ks.cfg
#version=DEVEL
auth --enableshadow --passalgo=sha512
cdrom
graphica
[사용 예]
#more anaconda-ks.cfg
#more+100 anaconda-ks.cfg →100행부터 출력
[root@Centos-srv ~]# more anaconda-ks.cfg
[root@Centos-srv ~]# more +50 anaconda-ks.cfg
[사용 예]
#less anaconda-ks.cfg
#less +100 anaconda-ks.cfg → 100행부터 출력
### rm
- ReMove의 약자로, 파일이나 디렉터리를 삭제한다. 당연히 파일이나 디렉터리를 삭제할 권한이 있어야한다. 단 root사용자는 모든 권한이 있으므로 이 명령에 제약이 없다.
[사용 예]
#rm abc.txt → 해당 파일 삭제
#rm -i abc.txt - 삭제시 정말 삭제할지 확인하는메세지가 나옴
#rm -f abc.txt - 삭제 시 확인하지 않고 바로 삭제함
#rm -r abc → 해당 디렉터리 삭제
### cat
- conCATenate의 약자로, 파일 내용을 화면에 보여준다. 여러 개의 파일을 나열하면 파일을 연결해서 보여준다.
- 파일의 내용을 한번에 디스플레이에 출력해준다.
- 내용이 한페이지가 넘어가는 경우 마우스를 사용할 수 없는 실제 콘솔인 경우 이전 내용을 볼 수없으므로 주의!
[사용 예]
#cat a.txt → a.txt 파일의 내용을 화면에 보여줌
[root@Centos-srv ~]# cat anaconda-ks.cfg
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use graphical install
graphica
### more
- 텍스트 형식으로 작성된 파일을 페이지 단위로 화면에 출력한다. spacebar를 누르면 다음 페이지로 이동하며 B를 누르면 앞 페이지로 이동한다. Q 를 누르면 종료한다.
[사용 예]
#more anaconda-ks.cfg
#more+100 anaconda-ks.cfg →100행부터 출력
[root@Centos-srv ~]# more anaconda-ks.cfg
[root@Centos-srv ~]# more +50 anaconda-ks.cfg
### less
- more 명령과 용도가 비슷하지만 기능이 더 확장되어 있다. more에서 사용하는 키도 사용할 수 있으며 추가로 화살표나 키나 Page Up, Page Down도 사용할 수 있다.
[사용 예]
#less anaconda-ks.cfg
#less +100 anaconda-ks.cfg → 100행부터 출력
[사용 예]
[root@Centos-srv ~]# tail anaconda-ks.cfg
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
-n 옵션
- 출력할 라인의 수를 지정
- 마지막 3개의 행을 출력하도록 지정
[root@Centos-srv ~]# tail -n 3 anaconda-ks.cfg
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
root@9b84a25d2fa7:/usr/local/tomcat/logs# tail -f catalina.2023-05-22.log
nano 패키지 설치
[root@Centos-srv ~]# yum install nano -y
[root@Centos-srv ~]# nano nano_test
GNU nano 2.3.1 File: nano_test
asdfzxclvkjalsdkjfqwe0porasd;lkjxcv;lkjasdfpoq328450puasdfasdf
xacvasdfqwer
xcvasdfrt
[root@Centos-srv ~]# MEMTOTAL=$(free -b | sed -n '2p' | awk '{print $2}')
[root@Centos-srv ~]# SHMMAX=$(expr $MEMTOTAL / 2)
[root@Centos-srv ~]# SHMMNI=4096
[root@Centos-srv ~]# PAGESIZE=$(getconf PAGE_SIZE)
[root@Centos-srv ~]# i=54321; for group in oinstall dba oper backupdba dgdba kmdba asmdba asmoper asmadmin racdba; do
groupadd -g $i $group; i=$(expr $i + 1)
done