AI·빅데이터 융합 경영학 Study Note
리눅스 팁. 본문
1. 한 개의 창만 캡쳐할 때는 Alt + 프린트스크린
2. ls -l (1 아니고 알파벳 ㅣ) 실행 결과
3.
ls
현재 디렉토리 보기
ls -al
다 보기(올)
cat .profile
# 다음에 나오는건 주석
???
ls -a
???
막 .. ... 이런거 나옴
man ~~~
~~~에 대한 메뉴얼이 뜸. 나가려면 q. 다음페이지는 스페이스
ls /usr
홈 디렉토리
ls /etc
???
pwd
print work directory
ec2-user@ip-172-31-38-145:~> pwd
/home/ec2-user
ec2-user@ip-172-31-38-145:~> mkdir ss
ec2-user@ip-172-31-38-145:~> ls
bin lshome.sh sample1.txt sample2.txt ss test test.sh
ec2-user@ip-172-31-38-145:~> mv sample2.txt ss
ec2-user@ip-172-31-38-145:~> ls
bin lshome.sh sample1.txt ss test test.sh
ec2-user@ip-172-31-38-145:~> ls ss
sample2.txt
ss 폴더를 만들어라
잘 만들어졌는지 확인해라
sample2.txt 파일을 ss 폴더로 옮겨라
ss폴더에 뭐가 있는지 확인해라
ec2-user@ip-172-31-38-145:~> ls /usr/ec2-user/ss
ls: cannot access '/usr/ec2-user/ss': No such file or directory
ec2-user@ip-172-31-38-145:~> pwd
/home/ec2-user
ec2-user@ip-172-31-38-145:~> ls /home/ec2-user/ss
sample2.txt
절대경로 표시를 시도했는데 실패함.
절대경로를 확인해기 위해 pwd 함.
그대로 절대경로를 표시해서 ss폴더에 있는 sample2.txt 파일을 확인함.
ec2-user@ip-172-31-38-145:~> mkdir kk
ec2-user@ip-172-31-38-145:~> ls
bin kk lshome.sh sample1.txt ss test test.sh
ec2-user@ip-172-31-38-145:~> mv home/ec2-user/ss/sample2.txt kk
mv: cannot stat 'home/ec2-user/ss/sample2.txt': No such file or directory
절대경로를 표시하는데 home 앞에 /를 안해서 오류남.
ec2-user@ip-172-31-38-145:~> mv /home/ec2-user/ss/sample2.txt kk
ec2-user@ip-172-31-38-145:~> ls kk
sample2.txt
이번에는 제대로 함.
ec2-user@ip-172-31-38-145:~> mv kk/sample2.txt .
쩜 (.)이 홈 디렉토리임.
ec2-user@ip-172-31-38-145:~> ls
bin kk lshome.sh sample1.txt sample2.txt ss test test.sh
ec2-user@ip-172-31-38-145:~> mv sample1.txt kk
ec2-user@ip-172-31-38-145:~> cd kk
#cd(change directory) 명령은 current directory를 변경하기 위한 명령이다.
ec2-user@ip-172-31-38-145:~/kk> ls
sample1.txt
ec2-user@ip-172-31-38-145:~/kk> cp sample1.txt ss
ec2-user@ip-172-31-38-145:~/kk> cp sample1.txt ../ss
ec2-user@ip-172-31-38-145:~/kk> ls ../ss
sample1.txt
ec2-user@ip-172-31-38-145:~/kk> ls /home/ec2-user/ss
sample1.txt
ec2-user@ip-172-31-38-145:~> mkdir hh
ec2-user@ip-172-31-38-145:~> mv sample2.txt hh
ec2-user@ip-172-31-38-145:~> ls
bin hh kk lshome.sh ss test test.sh
ec2-user@ip-172-31-38-145:~> ls hh
sample2.txt
ec2-user@ip-172-31-38-145:~> mv hh/sample2.txt .
ec2-user@ip-172-31-38-145:~> ls
bin hh kk lshome.sh sample2.txt ss test test.sh
ec2-user@ip-172-31-38-145:~> mkdir xx
ec2-user@ip-172-31-38-145:~> mv xx yy
ec2-user@ip-172-31-38-145:~> ls
bin hh kk lshome.sh sample2.txt ss test test.sh yy
ec2-user@ip-172-31-38-145:~> rm yy
rm: cannot remove 'yy': Is a directory
ec2-user@ip-172-31-38-145:~> rmdir yy
ec2-user@ip-172-31-38-145:~> ls
bin hh kk lshome.sh sample2.txt ss test test.sh
ec2-user@ip-172-31-38-145:~> ls kk
sample1.txt ss
ec2-user@ip-172-31-38-145:~> rmdir kk
rmdir: failed to remove 'kk': Directory not empty
ec2-user@ip-172-31-38-145:~> man rmdir
ec2-user@ip-172-31-38-145:~> man rmdir
ec2-user@ip-172-31-38-145:~> ls kk
sample1.txt ss
ec2-user@ip-172-31-38-145:~> ls .
bin hh kk lshome.sh sample2.txt ss test test.sh
ec2-user@ip-172-31-38-145:~> rm kk/sample1.txt
ec2-user@ip-172-31-38-145:~> ls kk
ss
ec2-user@ip-172-31-38-145:~> rm kk/ss
ec2-user@ip-172-31-38-145:~> ls kk
ec2-user@ip-172-31-38-145:~> rmdir kk
ec2-user@ip-172-31-38-145:~> ls
bin hh lshome.sh sample2.txt ss test test.sh
ec2-user@ip-172-31-38-145:~> cat sample2.txt
bin
sample1.txt
sample2.txt
test
ec2-user@ip-172-31-38-145:~> vi sample2.txt
ec2-user@ip-172-31-38-145:~> sort sample2.txt
bin
sample1.txt
sample2.txt
test
ec2-user@ip-172-31-38-145:~> sort -r sample2.txt
test
sample2.txt
sample1.txt
bin
ec2-user@ip-172-31-38-145:~> sort -r sample2.txt > sample3.txt
ec2-user@ip-172-31-38-145:~> ls
bin hh lshome.sh sample2.txt sample3.txt ss test test.sh
ec2-user@ip-172-31-38-145:~> cat sample3.txt
test
sample2.txt
sample1.txt
bin
ec2-user@ip-172-31-38-145:~> grep sample sample2.txt
sample1.txt
sample2.txt
ec2-user@ip-172-31-38-145:~> grep test *
grep: bin: Is a directory
grep: hh: Is a directory
sample2.txt:test
sample3.txt:test
grep: ss: Is a directory
grep: test: Is a directory
=================================
'EC2·Linux' 카테고리의 다른 글
리눅스 shell script 등 (0) | 2022.12.26 |
---|---|
리눅스 와일드 카드 (0) | 2022.12.26 |
Linux에 파이썬 설치 후 간단 테스트 (0) | 2022.12.22 |
EC2 Linux instance 생성 후 PuTTY(푸티)(SSH), FileZilla(파일질라)(sftp) 설정 (0) | 2022.12.22 |
[리눅스] 기본 명령어 모음 (0) | 2022.12.22 |