본문 바로가기
네트워크 수업/리눅스

[리눅스] fstab, 복사, 시간 23.03.23

by 6^6 2023. 3. 23.
728x90

검은창이 켜질 때

 

vi /etc/fstab 

:wq 

# shutdown -r now

 

fstab = 자동마운트되는 설정이 여기 들어간다.

 

[heejae@centos7 ~]$ su
암호:
[heejae@centos7 heejae]# cd..
cd..: Command not found.
[heejae@centos7 heejae]# cd ..
[heejae@centos7 /home]# cd ..
[heejae@centos7 /]# ls drive*
drive2:

drive3:
test3
[heejae@centos7 /]# ls
bin   dev     drive3  home  lib64  mnt  proc  run   srv  tem   tmp  var
boot  drive2  etc     lib   media  opt  root  sbin  sys  temp  usr
[heejae@centos7 /]# mkdir /drive4
[heejae@centos7 /]# ls
bin   dev     drive3  etc   lib    media  opt   root  sbin  sys  temp  usr
boot  drive2  drive4  home  lib64  mnt    proc  run   srv   tem  tmp   var
[heejae@centos7 /]# ls drive*
drive2:

drive3:
test3

drive4:
[heejae@centos7 /]# vi /etc/fstab

파일에 확신이 안들면 앞에 #을 붙여서 주석처리를 해줘

 

 

date 월일시간년도.초

 

[heejae@centos7 /]# date 032316112023
2023. 03. 23. (목) 16:11:00 KST
[heejae@centos7 /]# date 032316112023.11
2023. 03. 23. (목) 16:11:11 KST

 

[heejae@centos7 ~]# rdate -p time.bora.net
rdate: [time.bora.net] Thu Mar 23 16:12:32 2023 //타임서버의 현재시간 확인

 

 

 

 

[heejae@centos7 heejae]# rdate -s time.bora.net //한국표준시로 맞춘다
[heejae@centos7 heejae]# date 
2023. 03. 23. (목) 16:29:10 KST

 

ROM-BIOS 는 CMOS에 저장되어있다.

CMOS에 시간이 들어있다.

[heejae@centos7 /dev]# clock -s  = CMOS의 시간과 동기화된다.

[heejae@centos7 /dev]# rdate -s time.bora.net

[heejae@centos7 /dev]# clock -w
[heejae@centos7 /dev]# clock
2023년 03월 23일 (목) 오후 04시 36분 44초  -0.195563 seconds

pwd = 현재디렉터리


[heejae@centos7 ~]# ls
anaconda-ks.cfg  initial-setup-ks.cfg
[heejae@centos7 ~]# cd /
[heejae@centos7 /]# ls
bin   dev     drive3  home  lib64  mnt  proc  run   srv  tem   tmp  var
boot  drive2  etc     lib   media  opt  root  sbin  sys  temp  usr
[heejae@centos7 /]# ls -l
합계 20
lrwxrwxrwx.   1 root root    7  2월  9 12:13 bin -> usr/bin
dr-xr-xr-x.   5 root root 4096  2월  9 12:20 boot
drwxr-xr-x.  20 root root 3360  3월 22 14:43 dev
drwxr-xr-x.   2 root root    6  3월 21 17:17 drive2
drwxr-xr-x.   2 root root   19  3월 22 14:28 drive3
drwxr-xr-x. 139 root root 8192  3월 23 16:28 etc
drwxr-xr-x.   3 root root   20  2월  9 12:19 home
lrwxrwxrwx.   1 root root    7  2월  9 12:13 lib -> usr/lib
lrwxrwxrwx.   1 root root    9  2월  9 12:13 lib64 -> usr/lib64
drwxr-xr-x.   2 root root    6  4월 11  2018 media
drwxr-xr-x.   2 root root    6  4월 11  2018 mnt
drwxr-xr-x.   3 root root   16  2월  9 12:16 opt
dr-xr-xr-x. 254 root root    0  3월 22 14:42 proc
dr-xr-x---.   5 root root  241  3월 22 16:00 root
drwxr-xr-x.  42 root root 1280  3월 23 16:28 run
lrwxrwxrwx.   1 root root    8  2월  9 12:13 sbin -> usr/sbin
drwxr-xr-x.   2 root root    6  4월 11  2018 srv
dr-xr-xr-x.  13 root root    0  3월 22 14:42 sys
drwxr-xr-x.   2 root root    6  3월 22 15:14 tem
drwxr-xr-x.   4 root root   67  3월 22 15:20 temp
drwxrwxrwt.  26 root root 4096  3월 23 16:28 tmp
drwxr-xr-x.  13 root root  155  2월  9 12:13 usr
drwxr-xr-x.  20 root root  282  2월  9 12:20 var

 

[heejae@centos7 /]# ls -a = 숨겨진거 다보여줌
.   bin   dev     drive3  home  lib64  mnt  proc  run   srv  tem   tmp  var
..  boot  drive2  etc     lib   media  opt  root  sbin  sys  temp  usr


[heejae@centos7 /]# ls -d drive2 = drive2 다 보여줌

drive2

 

[heejae@centos7 /]# ls -d dr*
drive2  drive3

 

 

 

 

[heejae@centos7 /]# mkdir test
[heejae@centos7 /]# mkdir test1/test2 = 당연 test1이있으니까.
mkdir: `test1/test2' 디렉토리를 만들 수 없습니다: 그런 파일이나 디렉터리가 없습니다
[heejae@centos7 /]# mkdir -p test1/test2 = -p는 부모까지 만들겠다(강제로 만들어짐)

[heejae@centos7 /]# rmdir test1/test2
[heejae@centos7 /]# ls -R /test1 =test2만 지워진것 확인.
/test1:

 

[heejae@centos7 /]# rmdir -p test1/test2 =test1까지 다 날리기
[heejae@centos7 /]# ls -R /test1 =확인
ls: cannot access /test1: 그런 파일이나 디렉터리가 없습니다

 

[heejae@centos7 /]# mkdir -p test1/test2
[heejae@centos7 /]# cd /test1/test2
[heejae@centos7 test2]# pwd 
/test1/test2
[heejae@centos7 test2]# cd ..
[heejae@centos7 /test1]# cd /test1
[heejae@centos7 /test1]# ls
test2
[heejae@centos7 /test1]# cd test2
[heejae@centos7 test2]# touch a = 빈파일 만들기

[heejae@centos7 test2]# ls
a

[heejae@centos7 test2]# ls -l

합계 0
-rw-r--r--. 1 root root 0  3월 23 17:01 a =0은 0bite

[heejae@centos7 test2]# cd / = 루트디렉터리로 이동

[heejae@centos7 /]# rmdir -p test1/test2
rmdir: failed to remove `test1/test2': 디렉터리가 비어있지 않음 ==왜냐? 비어있지않기 때문에 / 그래서 이 명령어는 잘 안쓴다.

[heejae@centos7 /]# rm -fr test1 = 사용자들한테 물어보지않고 다 지우겠다. 무서운 명령어

 

[heejae@centos7 /]# cd /test1/test2
[heejae@centos7 test2]# vi ./a =내가 입력한 내용으로 들어가

 

[heejae@centos7 test2]# cat ./a  =내가 입력한 내용 바로보기
hey~~~
:
[heejae@centos7 test2]# cat b
cat: b: 그런 파일이나 디렉터리가 없습니다
[heejae@centos7 test2]# touch b
[heejae@centos7 test2]# ls
a  b
[heejae@centos7 test2]# ls -l
합계 4
-rw-r--r--. 1 root root 9  3월 23 17:14 a
-rw-r--r--. 1 root root 0  3월 23 17:14 b
[heejae@centos7 test2]# cat > b =빈파일안에 채워넣겠다.
:wq
kkkk
ffff

=ctrl + d
[heejae@centos7 test2]# ls =확인
a  b
[heejae@centos7 test2]# cat b = 확인
:wq
kkkk
ffff
[heejae@centos7 test2]# cat > c =c에 바로 적을수있다.
this is test file ahahaahahah
[heejae@centos7 test2]# ls =확인
a  b  c
[heejae@centos7 test2]# cat a b c > d = d에 다 병합할거다
[heejae@centos7 test2]# cat d = 확인
hey~~~
:
:wq
kkkk
ffff
this is test file ahahaahahah

[heejae@centos7 test2]# cat >> d = 추가해서 더 쓸수있다.
add someting

[heejae@centos7 test2]# cat d

hey~~~
:
:wq
kkkk
ffff
this is test file ahahaahahah
add someting ==추가된거 확인
[heejae@centos7 test2]# cat -n d = 넘버링 됨.
     1 hey~~~
     2 :
     3 :wq
     4 kkkk
     5 ffff
     6 this is test file ahahaahahah
     7 add someting
[heejae@centos7 test2]# cat -b d = 공백라인 제거
     1 hey~~~
     2 :
     3 :wq
     4 kkkk
     5 ffff
     6 this is test file ahahaahahah
     7 add someting

 

 

 

[heejae@centos7 /test1]# mkdir ./test3
[heejae@centos7 /test1]# ls
test2  test3

[heejae@centos7 /test1]# cp test2/d test3/f = test2에있는d파일을 test3에 f 로 바꾸겠다.

[heejae@centos7 /test1]# cat test3/f = 확인
hey~~~
:
:wq
kkkk
ffff
this is test file ahahaahahah
add someting

[heejae@centos7 /test1]# cp test2/* test3/ =test2에있는 모든내용을 test3에 복사하겠다.

[heejae@centos7 /test1]# ls test3/ =확인
a  b  c  d  f

 

[heejae@centos7 /test1]# rm -fr /test*

또는

[heejae@centos7 /test1]# rm -fr ./*

 

 

728x90

댓글