728x90
cd
- change directory
- 지정한 경로로 작업 경로를 이동한다.
예)
cd /usr/home/tomcat
결과: /usr/tomcat/bin 경로로 이동한다.
pwd
- print working directory
- 현재 경로를 출력한다.
예) 현재 경로가 /usr/tomcat/bin인 경우
[mugwart@localhost /usr/tomcat/bin] pwd
/usr/tomcat/bin
결과: /usr/tomcat/bin을 출력한다.
ls
- list
- 현재 경로의 파일명 목록을 출력한다.
- ls 명령어만 단독으로 사용하면 파일명만 공백 구분으로 쭈우욱 출력되기 때문에 옵션과 함께 쓴다.
- 옵션에 대해서는 추후 정리 예정.
예)
[mugwart@localhost /usr/tomcat/bin] ls
tomcat.exe file1.txt file2.txt
결과: 현재 경로 내의 파일 목록을 출력한다.
mkdir
- make directory
- 지정한 이름의 디렉토리를 현재 경로에 생성한다.
예) testdir 디렉토리를 생성하고, 해당 디렉토리로 이동 후 pwd로 현재 경로를 출력한다.
[mugwart@localhost /usr/tomcat/bin] mkdir testdir
[mugwart@localhost /usr/tomcat/bin] cd testdir
[mugwart@localhost /usr/tomcat/bin/testdir] pwd
/usr/tomcat/bin/testdir
touch
- 지정한 이름의 빈 파일 생성, 또는 파일의 타임스탬프 관련 정보 수정
예 1) 현재 경로의 파일 목록 출력 후 file3.txt 파일 생성하고 다시 파일 목록 출력
[mugwart@localhost /usr/tomcat/bin] ls
testdir tomcat.exe file1.txt file2.txt
[mugwart@localhost /usr/tomcat/bin] touch file3.txt
[mugwart@localhost /usr/tomcat/bin] ls
testdir tomcat.ext file1.txt file2.txt file3.txt
예 2) file3.txt의 날짜를 2023년 6월 19일 10시 00분 00초로 변경
[mugwart@localhost /usr/tomcat/bin] touch -t 20230619100000 file3.txt
mv
- move
- 파일이 저장된 경로 이동 또는 파일명 변경
예 1) file2.txt를 /usr/tomcat/bin에서 /usr/tomcat/bin/testdir로 이동한 후 testdir의 파일 목록 출력
[mugwart@localhost /usr/tomcat/bin] ls
testdir tomcat.exe file1.txt file2.txt file3.txt
[mugwart@localhost /usr/tomcat/bin] mv file2.txt /testdir
[mugwartj@localhost /usr/tomcat/bin] cd testdir
[mugwart@localhost /usr/tomcat/bin/testdir] ls
file2.txt
예 2) file2.txt의 파일명을 testfile.txt로 변경
[mugwart@localhost /usr/tomcat/bin/testdir] mv file2.txt testfile.txt
[mugwart@localhost /usr/tomcat/bin/testdir] ls
testfile.txt
cp
- copy
- 파일 또는 디렉토리를 복사
- 디렉토리 복사 시 -r 옵션 사용 (recursive)
예 1) testfile.txt를 testfile2.txt라는 이름으로 복사
[mugwart@localhost /usr/tomcat/bin/testdir] cp testfile.txt testfile2.txt
[mugwart@localhost /usr/tomcat/bin/testdir] ls
testfile.txt testfile2.txt
예2) bin 폴더에 testdir2 경로 생성 후 testdir 디렉토리 하위의 모든 파일을 testdir2로 복사
[mugwart@localhost /usr/tomcat/bin] mkdir testdir2
[mugwart@localhost /usr/tomcat/bin] cp -r testdir testdir2
[mugwart@localhost /usr/tomcat/bin] cd testdir2
[mugwart@localhost /usr/tomcat/bin/testdir2] ls
testfile.txt testfile2.txt
rm
- remove
- 파일 또는 디렉토리를 삭제
- 디렉토리 삭제 시 -r 사용 (recursive)
예 1) testfile2.txt 파일 삭제
[mugwart@localhost /usr/tomcat/bin/testdir2] ls
testfile.txt testfile2.txt
[mugwart@localhost /usr/tomcat/bin/testdir2] rm testfile2.txt
[mugwart@localhost /usr/tomcat/bin/testdir2] ls
testfile.txt
예 2) testdir2 경로 삭제
[mugwart@localhost /usr/tomcat/bin] ls
testdir testdir2 tomcat.exe file1.txt file2.txt file3.txt
[mugwart@localhost /usr/tomcat/bin] rm -r testdir2
[mugwart@localhost /usr/tomcat/bin] ls
testdir tomcat.exe file1.txt file2.txt file3.txt
cat
- catenate
- 파일의 내용을 화면에 출력
- 여러 파일을 공백으로 구분하여 입력 시 여러 파일 내용 동시 출력 가능
예) file1.txt의 내용을 화면에 출력
[mugwart@localhost /usr/tomcat/bin] cat file1.txt
Hello world!
My name is
Mugwart
728x90
'개발 지식 > 인프라' 카테고리의 다른 글
[젠킨스] 젠킨스 최초 설치 후 설정하기 (Getting Started) (0) | 2024.11.04 |
---|---|
[라즈베리파이] root 계정 최초 접근 방법 (0) | 2024.11.02 |
[라즈베리파이] 라즈베리파이 3B+에 라즈베리파이 OS 설치하기 (1) | 2024.11.02 |
AWS란 무엇인가? AWS의 대표 서비스 EC2, S3, RDS 간단 정리 (0) | 2023.07.02 |
댓글