일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- ubuntu
- ubuntu grep
- 쏴아리 딥러닝
- AnoGAN
- unsupervised learning
- Image to image translation
- 말해보시개 Linux
- ubuntu pipe
- AWS
- ubuntu 명령어
- anomaly detection
- ubuntu zsh
- gan
- bash 명령어
- git log
- bash vs zsh
- F-AnoGAN
- AWS Certificate
- git commit
- autoencoder
- CycleGAN
- ubuntu mount
- aws rds
- linux
- DCGAN
- docker
- AWS EC2
- pix2pix
- EC2
- 말해보시개 딥러닝
- Today
- Total
쏴아리의 딥러닝 스터디
ubuntu 명령어 모음 3 본문
ubuntu 명령어 모음 3
cp: 파일 및 디렉토리 복사
cp 명령어는 ubuntu에서 파일과 디렉토리를 복사하는데 활용됩니다.
$cp [option] [대상 위치 및 이름] [복사하고 싶은 위치]
- oprion
- -r: 하위 디렉토리와 파일 전체를 복사합니다.
- -p: 소유주, 그룹, 권한, 시간 정보를 그대로 복사합니다.
예제) folder1에 있는 deepmal.txt 파일을 folder2에 복사하기
mkdir 명령어로 folder1, folder2를 생성 한 뒤, ls 명령어로 folder1, folder2가 생성되었는지 확인합니다.
$mkdir folder1 folder2
$ls

touch 명령어로 folder1 디렉토리 내에 deepmal.txt 파일을 생성한 뒤, cd 명령어로 folder1으로 이동합니다.
ls 명령어로 deepmal.txt이 생성되었는지 확인합니다.
$touch folder1/deepmal.txt
$cd folder1
$ls

다시 부모 디렉토리로 돌아옵니다
$cd ..

cp 명령어를 통해 folder1의 deepmal.txt 파일을 folder2로 복사합니다.
$cp folder1/deepmal.txt folder2

folder2로 이동 한 뒤, deepmal.txt 파일이 복사되었음을 확인합니다.
$cd folder2
$ls

mv: 파일 및 디렉토리 이동
mv 명령어는 ubuntu에서 파일과 디렉토리를 이동시키는데 활용됩니다.
$ mv [대상 위치/이름] [이동하고 싶은 위치/이름]
예제) folder1의 deepmal.txt 파일을 folder2로 이동시키기
mkdir 명령어로 folder1과 folder2 디렉고티를 생성한 뒤, folder1, folder2 디렉토리가 생성됨을 확인합니다.
$mkdir folder1 folder2
$ls

touch 명령어로 folder1 디렉토리 내에 deepmal.txt 파일을 생성합니다.
$touch folder1/deepmal.txt

mv 명령어를 통해 folder1 디렉토리 내, deepmal.txt 파일을 folder2로 이동시킵니다.
$mv folder1/deepmal.txt folder2

cd 명령어로 folder2 디렉토리로 이동한 뒤, ls 명령어를 통해 deepmal.txt 파일이 이동되었음을 확힌합니다.
$cd folder2
$ls

cd 명령어로 다시 부모디렉토리로 돌아왔다가, folder1 디렉토리로 이동 한 뒤, ls 명령어를 통해 deepmal.txt 파일이 folder1에 없음을 확인합니다.(folder2로 이동되었음)
$cd ..
$cd folder1
$ls

cat: 파일 내용 출력
cat 명령어는 ubuntu에서 파일 내용을 출력할 때 사용합니다.
$cat [option] [파일명]
- option
- -n: 왼쪽에 줄 번호와 함께 내용을 출력합니다.
- >: 파일의 내용을 덮어씁니다.
- >>: 파일의 내용이 있다면 뒤에 내용을 추가합니다.
예제) deepmal.txt 파일 내용을 출력하기
touch 명령어로 deepmal.txt 빈 파일을 생성합니다.
cat 명령어로 deepmal.txt 파일을 덮어씁니다.
$touch deepmal.txt
$cat > deepmal.txt
Hello World!

cat 명령어로 deepmal.txt 파일을 출력합니다.
$cat deepmal.txt

cat 명령어로 deepmal.txt 파일 뒤에 내용을 추가합니다
$cat >> deepmal.txt
Deep Learning!

cat 명령어로 deepmal.txt 파일을 출력합니다.
$cat deepmal.txt

Hello World! 뒤에 Deep Learning!이 추가되었습니다.
find: 파일 검색
find 명령어는 ubuntu에서 파일을 검색하는데 사용됩니다.
$find [파일 경로] [-name] [파일 이름] [-type d/f]
- [-type d/f]
- 디렉토리나 폴더만을 검색하는 옵션
예제) find 명령어로 folder1 디렉토리 내 deepmal1.txt 파일 검색
mkdir 명령어를 통해 folder1 디렉토리를 생성하고, cd를 통해 folder 1디렉토리로 이동합니다.
touch 명령어를 통해 deepmal1.txt, deepmal2.txt, deepmal3.txt 파일을 생성한 뒤, ls 명령어를 통해 디렉토리 내 목록들을 출력합니다.
$mkdir
$cd folder1
$touch deepmal1.txt deepmal2.txt deepmal3.txt
$ls

folder1 디렉토리 내, deepmal1.txt, deepmal2.txt, deepmal3.txt 파일이 생성된 것을 확인할 수 있습니다.
부모 디렉토리로 이동합니다.
$cd ..

find 명령어를 통해 folder1 디렉토리내, deepmal1.txt, deepmal2.txt, deepmal3.txt 파일이 있는지 확인합니다.
$find folder1 -name deepmal1.txt
$find folder1 -name deepmal2.txt
$find folder1 -name deepmal3.txt

같이 보시면 좋아요.
2021.04.30 - [Linux] - ubuntu 명령어 모음 1
ubuntu 명령어 모음 1
ubuntu 명령어 모음 1 whoami: 사용자 ID 확인 whoami 명령어는 로그인한 사용자의 ID를 알려줍니다. $whoami 다음과 같이 ubuntu에서 whoami 명령어를 통해 사용자의 ID를 확인할 수 있습니다. whoami 명령..
deepmal.tistory.com
2021.05.03 - [Linux] - ubuntu 명령어 모음 2
ubuntu 명령어 모음 2
ubuntu 명령어 모음 2 tree: 디렉토리 구조를 확인 tree 명령어는 ubuntu에서 디렉토리 구조를 출력합니다. treetree명령어가작동하지않는다면,다음명령어를통해설치합니다.sudo apt install tree..
deepmal.tistory.com
포스팅 내용이 도움이 되었나요? 공감과 댓글은 큰 힘이 됩니다!
'Linux' 카테고리의 다른 글
Linux Shell Script 예제 (0) | 2021.05.21 |
---|---|
Linux Shell bash vs zsh (0) | 2021.05.19 |
ubuntu 명령어 모음 4 (0) | 2021.05.10 |
ubuntu 명령어 모음 2 (0) | 2021.05.03 |
ubuntu 명령어 모음 1 (0) | 2021.04.30 |