public:computer:linux

This is an old revision of the document!


linux 기초 사용법

$ history

  • ls

$ ls
$ ls /etc/systemd
$ ls -a
$ ls -l
$ ls *.conf
$ ls -l /etc/systemd/b*

  • cd
  • pwd
  • rm
  • cp
  • touch
  • mv
  • mkdir
  • rmdir
  • cat
  • head
  • tail
  • more
  • less
  • file
  • clear
  • pwd
  • 파이프; |
  • 필터; grep, tail, wc, sort, awk, sed 등
  • 리디렉션; >(overwrite), »(append), <, < >
  • 연속 실행 ;
  • 프로세스
    • foreground process
    • background process
    • 프로세스 번호
    • 작업 번호
    • 부모 프로세스, 자식 프로세스
    • ps
    • kill
    • pstree
  • 데몬; 명령 &
  • 서비스;
    • systemctl start/stop/restart
    • systemctl status
    • systemctl enable/disable
  • 소켓; /lib/systemd/system 디렉토리 소켓이름.socket
  • GRUB; /etc/default/grub
  • uname -r; 커널 버전 확인
  • /etc/issue; 우분투 버전
  • wget
  • curl
  • ls -l
    • 파일유형; d(디렉토리),-(일반), b(블록 디바이스), c(문자 디바이스), l(링크)
    • 파일허가권; r(read)w(write)x(execute) 형식, 소유자-그룹-기타 순.
    • 링크수
    • 파일소유자
    • 파일소유그룹
    • 파일크기(Bytes)
    • 마지막변경 날짜/시간
    • 파일 이름
  • chmod; u(user), g(group), o(others)
  • chown
  • chgrp
  • whoami
  • 링크
    • Hard link; 원본 데이터를 직접 가르킴
    • Symbolic link; ln -s, 별도의 포인터
    • inode에 대한 이해
  • package
    • dpkg -i(–install), -r(–remove), -P(–purge), -l, -L
    • apt-get; 의존성 문제 해결,
      • apt-get -y install 패키지 이름
      • apt-get update
      • apt-get remove,
      • apt-get purge,
      • apt-get autoremove
    • apt-cache
      • apt-cache show
      • apt-cache depends
      • apt-cache rdepends
  • 파일 압축
    • xz
    • bzip2
    • gzip
    • zip / unzip
  • 파일 묶기
    • tar
  • 파일 위치 검색
    • find
    • which
    • whereis
    • locate
  • cron; crond : /etc/crontab
  • at
  • ifconfig
  • ifdown
  • ifup
  • systemctl start/stop/restart/status networking
  • nslookup
  • ping
  • /etc/resolv.conf; dns 서버의 정보와 호스트 이름이 들어있는 임시 사용 파일
  • /etc/hosts; 호스트 이름과 FQDN이 들어있는 파일
  • /etc/network/interfaces
  • 사용자/그룹;
    • /etc/passwd; 사용자이름:암호:사용자ID:사용자소속그룹ID:추가정보:홈디렉토리:기본쉘
    • /etc/group; 그룹이름:비밀번호:그룹ID:보조그룹사용자
    • adduser
    • passwd
    • usermod
    • userdel
    • chage
    • groups
    • groupadd
    • groupmod
    • groupdel
    • gpasswd
  • mount / unmount
  • 히스토리

$ history

  • 도움말
  • 로그 아웃 (사용자 계정)

$ logout
$ exit

  • 시스템 재부팅 (root 계정)

# reboot
# shutdown -r now
# init 6

런레벨
런레벨 영문 모드 설명 비고
0 Power Off 종료 모드
1 Rescue 시스템 복구 모드 단일 사용자 모드
2 Multi-User 사용하지 않음
3 Multi-User 텍스트 모드의 다중 사용자 모드
4 Multi-User 사용하지 않음
5 Graphical 그래픽 모드의 다중 사용자 모드
6 Reboot
  • 시스템 종료 (root 계정)

# poweroff
# shutdown -P now
# halt -p
# init 0
# shutdown -P +10  # 10분 후 종료 (P: poweroff)
# shutdown -r 22:00  # 오후 10시에 재부팅 (r: reboot)
# shutdown -c  # 예약된 shutdown 취소 (c: cancel)
# shutdown -k +15  # 현재 접속한 사용자에게 15분 후에 종료 메시지 브로드캐스팅, 실제 종료는 안됨

  • public/computer/linux.1629480585.txt.gz
  • Last modified: 2021/08/21 02:29
  • by alex