yumyum
[Linux] 기본 명령어 본문
shut down 끄는 명령어
hlat 셧다운 멘트가 안먹힐때 (잘 안쓰는거 추천)
power off 끄는 명령어
ctrl + d 작업에서 나가는 명령어
[런레벨] init 명령어 뒤에 붙는 숫자
init 0 종료 명령어
init 1 시스템 복구
init 6 재부팅 명령어
**GUI 그래픽 유저 인터페이스
CUI=CLI 커맨드 유저(라인) 인터페이스
free 메모리 용량 보여주는 명령어
[가상콘솔]
ctrl+alt+f1 원래 작업하던 공간으로 돌아오는 명령어
(f1~f6까지 작업 공간 나눠서 작업 할 수 있다.)
[vi 에디터] (vi에디터의 대상은 파일이어야 한다.)
vim text.txt 텍스트 모드
(숫자 붙여서 명령어 넣으면 숫자만큼 복사 )
dd 현재 커서의 행 모두 삭제
yy 현재 커서가 있는 행 복사
p 복사한것 붙여넣기
set number (set nu) 숫자 지정
: (숫자) 그 숫자가 있는 줄로 이동
man (궁금한 명령어) 궁금한 명령어에대한 정보
df 마운트에 대한 정보
[CD 마운팅, 언마운팅]
[root@localhost ~]# cd /mnt
[root@localhost mnt]# mkdir cd
[root@localhost mnt]# ls
cd
[root@localhost mnt]#
[root@localhost mnt]# df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 480808 0 480808 0% /dev
tmpfs 497836 0 497836 0% /dev/shm
tmpfs 497836 8548 489288 2% /run
tmpfs 497836 0 497836 0% /sys/fs/cgroup
/dev/mapper/centos-root 17811456 5568716 12242740 32% /
/dev/sda1 1038336 176880 861456 18% /boot
tmpfs 99568 24 99544 1% /run/user/1000
[root@localhost mnt]# mount /dev/sr0 /mnt/cd
mount: /dev/sr0 is write-protected, mounting read-only
[root@localhost mnt]# df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 480808 0 480808 0% /dev
tmpfs 497836 0 497836 0% /dev/shm
tmpfs 497836 8552 489284 2% /run
tmpfs 497836 0 497836 0% /sys/fs/cgroup
/dev/mapper/centos-root 17811456 5568716 12242740 32% /
/dev/sda1 1038336 176880 861456 18% /boot
tmpfs 99568 24 99544 1% /run/user/1000
/dev/sr0 4600876 4600876 0 100% /mnt/cd
[root@localhost mnt]# cd
[root@localhost ~]# umount /dev/sr0
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 480808 0 480808 0% /dev
tmpfs 497836 0 497836 0% /dev/shm
tmpfs 497836 8552 489284 2% /run
tmpfs 497836 0 497836 0% /sys/fs/cgroup
/dev/mapper/centos-root 17811456 5568968 12242488 32% /
/dev/sda1 1038336 176880 861456 18% /boot
tmpfs 99568 24 99544 1% /run/user/1000
[root@localhost ~]#
검색 : pwd(경로검색) ls -l, -al, ll
이동 : cd, .(현재) ..(상위폴더) (change directory약자 : 디렉토리를 이동) (상대경로, 절대경로 개념)
생성 : mkdir(폴더), touch, vim(파일)
삭제 : rmdir(폴더), rm(파일) -r, -f, -rf
[ls-l : 자세히 보기] (ll)
[root@localhost ~]# ls -l
합계 8
-rw-------. 1 root root 1851 8월 29 11:24 anaconda-ks.cfg
drwxr-xr-x 2 root root 6 8월 30 11:45 cd
-rw-r--r--. 1 root root 1899 8월 29 11:30 initial-setup-ks.cfg
[ls-la : 숨겨진거까지 다 보기]
[root@localhost ~]# ls -la
합계 44
dr-xr-x---. 6 root root 271 8월 30 11:45 .
dr-xr-xr-x. 17 root root 244 8월 30 10:19 ..
-rw------- 1 root root 196 8월 30 11:43 .bash_history
-rw-r--r--. 1 root root 18 12월 29 2013 .bash_logout
-rw-r--r--. 1 root root 176 12월 29 2013 .bash_profile
-rw-r--r--. 1 root root 176 12월 29 2013 .bashrc
drwx------. 4 root root 31 8월 29 13:56 .cache
drwxr-xr-x. 3 root root 18 8월 29 13:56 .config
-rw-r--r--. 1 root root 100 12월 29 2013 .cshrc
drwx------. 3 root root 25 8월 29 11:29 .dbus
-rw-r--r--. 1 root root 129 12월 29 2013 .tcshrc
-rw------- 1 root root 3149 8월 30 11:37 .viminfo
-rw-------. 1 root root 132 8월 29 13:56 .xauthSEri3W
-rw------- 1 root root 132 8월 30 11:45 .xauthbPBbbr
-rw-------. 1 root root 1851 8월 29 11:24 anaconda-ks.cfg
drwxr-xr-x 2 root root 6 8월 30 11:45 cd
-rw-r--r--. 1 root root 1899 8월 29 11:30 initial-setup-ks.cfg
cd .. 한개의 상위폴더로 올라가짐
pwd 내가 현재 있는곳 확인
>touch로 만든건 파일이니, 파일 삭제하는 명령어인 rm으로 touch로 만든 파일 삭제해주기
[rm으로 할때 삭제되지 않는 모습]
[root@localhost mnt]# mkdir data1
[root@localhost mnt]# mkdir data2
[root@localhost mnt]# mkdir data3
[root@localhost mnt]#
[root@localhost mnt]# ls
data.sh data1 data2 data3
[root@localhost mnt]#
[root@localhost mnt]# rm data3
rm: cannot remove `data3': 디렉터리입니다
[root@localhost mnt]#
[root@localhost mnt]# rm -r data3
rm: remove 디렉토리 `data3'? y
[root@localhost mnt]# ls
data.sh data1 data2
파일은 복사가 되지만 폴더는 복사 안되는 모습
파일내용 조회 : cat, tail, head, more
cat /var/log/messages
tail -n 20 /var/log/messages
file 파일의 종류를 알려주는 명령어
[현업에서 많이 쓰이는 명령어]
watch -n 10 "tail -n 20 /var/log/messages"
watch -n 10 "tail -n 20 /var/log/messages | grep error"
cat /etc/passwd
centos를 benmin 파일 안에 넣어주는 명령어
'ICT기반 클라우드 네트워크 해킹 침해대응전문가 > Linux' 카테고리의 다른 글
[Linux] RPM, dnf (1) | 2023.08.30 |
---|---|
[Linux] hardlink, softlink (0) | 2023.08.30 |
[Linux]권한설정 (0) | 2023.08.30 |
[Linux] 그룹 생성, 유저 추가 (0) | 2023.08.30 |
[Linux] Centos 7 설정 (0) | 2023.08.29 |