반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- springboot
- 컨테이너
- namespace
- 쿠버네티스
- 파이썬
- container
- k8s
- python
- devops #jenkins
- linux
- nginx
- multivm
- 초간단파이썬
- devops #engineer
- docker
- Kubernetes
- java
- mongodb operator
- Engineer
- aws #engineer
- variable
- Vagrant
- httpd실행
- DOIK
- Strimzi
- 도커
- bash
- WEB
- ioredirection
- RSS
Archives
- Today
- Total
샤인의 IT (막 적는) 메모장
[Linux] 기본 명령어 정리 본문
반응형
기본 개념
GNU 프로젝트의 일환
누구나 사용할 수 있는 오픈소스
ubuntu, centos, opensuse, debian 등등 여러가지 리눅스 존재
패키지
.deb
.rpm
디렉토리
홈디렉토리 /root /home
유저 명령어 /bin /usr/bin /usr/local/bin
시스템 명령어 /sbin, /usr/sbin
마운트 /media, /mnt
설정정보 /etc
임시파일 /tmp
커널 및 부트로더 /boot
서버 데이터 /var /srv
시스템 정보 /proc, /sys
라이브러리 /lib, /usr/lib
기본 명령어
#디렉토리 확인
[vagrant@localhost ~]$ ls -al
total 20
drwx------. 4 vagrant vagrant 132 Jan 14 10:54 .
drwxr-xr-x. 3 root root 21 Jun 8 2021 ..
drwx------. 3 vagrant vagrant 37 Jun 8 2021 .ansible
-rw-------. 1 vagrant vagrant 16 Jan 14 10:54 .bash_history
-rw-r--r--. 1 vagrant vagrant 18 Apr 1 2020 .bash_logout
-rw-r--r--. 1 vagrant vagrant 193 Apr 1 2020 .bash_profile
-rw-r--r--. 1 vagrant vagrant 231 Apr 1 2020 .bashrc
drwx------. 2 vagrant vagrant 29 Jan 14 10:52 .ssh
-rw-r--r--. 1 vagrant vagrant 6 Jun 8 2021 .vbox_version
[vagrant@localhost ~]$ clear
#유저 확인
[vagrant@localhost ~]$ whoami
vagrant
#현재 디렉토리
[vagrant@localhost ~]$ pwd
/home/vagrant
#OS 정보
[vagrant@localhost ~]$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
#Root 권한 변경
[vagrant@localhost ~]$ sudo -i
[root@localhost ~]# whoami
root
#/etc 디렉토리
[root@localhost ~]# cd /etc
[root@localhost etc]# ls
adjtime crypttab groff krb5.conf.d netconfig profile.d sasl2 system-release
aliases csh.cshrc group ld.so.cache NetworkManager protocols securetty system-release-cpe
aliases.db csh.login group- ld.so.conf networks python security tcsd.conf
alternatives dbus-1 grub2.cfg ld.so.conf.d nfs.conf rc0.d selinux terminfo
anacrontab default grub.d libaudit.conf nfsmount.conf rc1.d services tmpfiles.d
asound.conf depmod.d gshadow libnl nsswitch.conf rc2.d sestatus.conf tuned
audisp dhcp gshadow- libuser.conf nsswitch.conf.bak rc3.d shadow udev
audit DIR_COLORS gss locale.conf openldap rc4.d shadow- vconsole.conf
bash_completion.d DIR_COLORS.256color gssproxy localtime opt rc5.d shells virc
bashrc DIR_COLORS.lightbgcolor host.conf login.defs os-release rc6.d skel wgetrc
binfmt.d dracut.conf hostname logrotate.conf pam.d rc.d ssh wpa_supplicant
centos-release dracut.conf.d hosts logrotate.d passwd rc.local ssl X11
centos-release-upstream e2fsck.conf hosts.allow lvm passwd- redhat-release statetab xdg
chkconfig.d environment hosts.deny machine-id pkcs11 request-key.conf statetab.d xinetd.d
chrony.conf ethertypes idmapd.conf magic pki request-key.d subgid yum
chrony.keys exports init.d makedumpfile.conf.sample plymouth resolv.conf subuid yum.conf
cifs-utils exports.d inittab man_db.conf pm rpc sudo.conf yum.repos.d
cron.d favicon.png inputrc mke2fs.conf polkit-1 rpm sudoers
cron.daily filesystems iproute2 modprobe.d popt.d rsyncd.conf sudoers.d
cron.deny firewalld issue modules-load.d postfix rsyslog.conf sudo-ldap.conf
cron.hourly fstab issue.net motd ppp rsyslog.d sysconfig
cron.monthly gcrypt kdump.conf mtab prelink.conf.d rwtab sysctl.conf
crontab gnupg kernel my.cnf printcap rwtab.d sysctl.d
cron.weekly GREP_COLORS krb5.conf my.cnf.d profile samba systemd
#/tmp 디렉토리
[root@localhost etc]# cd /tmp
[root@localhost tmp]# ls
ks-script-2jyllt packer-provisioner-ansible-local systemd-private-3dcf2b8b3f4d4373813b60b51739be47-chronyd.service-etpEV2 yum.log
ks-script-3wXFeZ ssh-ANiR8K6Thv vboxguest-Module.symvers
#/boot 디렉토리
[root@localhost tmp]# cd /boot
[root@localhost boot]# ls
config-3.10.0-1160.25.1.el7.x86_64 initramfs-0-rescue-0360a9124ae14542bcc5792000db0717.img System.map-3.10.0-1160.25.1.el7.x86_64
config-3.10.0-1160.el7.x86_64 initramfs-3.10.0-1160.25.1.el7.x86_64.img System.map-3.10.0-1160.el7.x86_64
efi initramfs-3.10.0-1160.el7.x86_64.img vmlinuz-0-rescue-0360a9124ae14542bcc5792000db0717
grub symvers-3.10.0-1160.25.1.el7.x86_64.gz vmlinuz-3.10.0-1160.25.1.el7.x86_64
grub2 symvers-3.10.0-1160.el7.x86_64.gz vmlinuz-3.10.0-1160.el7.x86_64
[root@localhost boot]# cd grub
[root@localhost grub]# ls
splash.xpm.gz
#/proc 디렉토리
[root@localhost grub]# cd /proc/
[root@localhost proc]# ls
1 1212 1970 25 291 368 388 46 51 560 579 632 7 buddyinfo dma irq locks partitions sys vmstat
10 13 1972 26 292 369 389 461 513 561 580 637 744 bus driver kallsyms mdstat sched_debug sysrq-trigger zoneinfo
100 14 1990 27 293 37 390 47 530 562 581 639 8 cgroups execdomains kcore meminfo schedstat sysvipc
1014 16 2 273 3 38 391 477 554 563 582 64 868 cmdline fb keys misc scsi timer_list
1020 17 20 28 30 383 392 48 555 564 6 641 9 consoles filesystems key-users modules self timer_stats
11 19 21 288 31 384 393 49 556 575 609 648 991 cpuinfo fs kmsg mounts slabinfo tty
1198 1940 22 289 358 385 394 5 557 576 613 65 992 crypto interrupts kpagecount mtrr softirqs uptime
12 1943 23 29 359 386 4 50 558 577 614 650 993 devices iomem kpageflags net stat version
1211 1944 24 290 36 387 454 500 559 578 631 660 acpi diskstats ioports loadavg pagetypeinfo swaps vmallocinfo
[root@localhost proc]# uptime
12:00:51 up 5 min, 1 user, load average: 0.00, 0.04, 0.04
[root@localhost proc]# cat /proc/uptime
327.51 624.30
[root@localhost proc]# free -m
total used free shared buff/cache available
Mem: 486 98 282 4 105 370
Swap: 1023 0 1023
[root@localhost proc]# uptime
12:00:51 up 5 min, 1 user, load average: 0.00, 0.04, 0.04
[root@localhost proc]# cat /proc/uptime
327.51 624.30
#메모리 확인
[root@localhost proc]# free -m
total used free shared buff/cache available
Mem: 486 98 282 4 105 370
Swap: 1023 0 1023
[root@localhost proc]# cd
[root@localhost ~]# ls
anaconda-ks.cfg original-ks.cfg
#mkdir / cp / touch 테스트
[root@localhost ~]# mkdir dev
[root@localhost ~]# cd dev
[root@localhost dev]# pwd
/root/dev
[root@localhost dev]# touch testfile
[root@localhost dev]# ls
testfile
[root@localhost dev]# cat testfile
[root@localhost dev]# touch file{1..3}.txt
[root@localhost dev]# ls
file1.txt file2.txt file3.txt testfile
[root@localhost dev]# cp file1.txt file1-update.txt
[root@localhost dev]# ls
file1.txt file1-update.txt file2.txt file3.txt testfile
[root@localhost dev]# cd ..
[root@localhost ~]# ls
anaconda-ks.cfg dev original-ks.cfg
[root@localhost ~]# cp -r dev/ dev-paste/
[root@localhost ~]# ls
anaconda-ks.cfg dev dev-paste original-ks.cfg
[root@localhost ~]# cd dev-paste/
[root@localhost dev-paste]# ls
file1.txt file1-update.txt file2.txt file3.txt testfile
[root@localhost dev-paste]# touch movefile
[root@localhost dev-paste]# ls
file1.txt file1-update.txt file2.txt file3.txt movefile testfile
[root@localhost dev-paste]# mv movefile ../dev
[root@localhost dev-paste]# cd ../dev
dev/ dev-paste/
[root@localhost dev-paste]# cd ../dev
[root@localhost dev]# ls
file1.txt file1-update.txt file2.txt file3.txt movefile testfile
VIM 편집기 기본
gg - 제일 첫 페이지
G - 제일 끝 페이지
w - 문자열 끝
b - 문자열 처음
숫자 + w - 숫자번째 단어 끝
숫자 + b - 숫자번째 단어 처음
u - 되돌리기
U - 전체 되돌리기
ctrl + r - 되돌린거 다시 변경
yy - 라인 복사
숫자 + yy - 숫자 라인 복사
p - 아래 라인에 붙여넣기
P - 윗라인에 붙여넣기
dw - 단어 삭제
x - 하나 삭제
dd - 라인 삭제
/ - 찾기
:set nu - 라인 넘버 출력
/q - 저장하지 않고 나가기
/wq - 저장하고 나가기
반응형
'Cloud Infra > Linux' 카테고리의 다른 글
[Linux] Process & Archive (0) | 2022.01.15 |
---|---|
[Linux] Package & Service (0) | 2022.01.15 |
[Linux] User Group & Permission (0) | 2022.01.15 |
[Linux] File Type & IO Redirection (0) | 2022.01.15 |
[Linux] Rocky Linux 설치 (0) | 2021.05.15 |
Comments