리눅스 / 로그아웃 명령어, 재부팅 명령어, 종료 명령어

로그아웃 명령어

# logout
# exit

재부팅 명령어

즉시 재부팅

# reboot
# shutdown -r now
# init 6

일정 시간 또는 일정 시간 후 재부팅

  • 10분 후 재부팅
# shutdown -r 10
  • 12시에 재부팅
# shutdown -r 12:00
  • 취소
# shutdown -c

종료 명령어

즉시 종료

# poweroff
# shutdown -h now
# shutdown -P now
# halt -p
# init 0

일정 시간 또는 일정 시간 후에 종료

  • 10분 후에 종료
# shutdown -P 10
  • 13시에 종료
# shutdown -P 13:00
  • 취소
# shutdown -c

기타

  • 10분 후에 종료할 거라는 메시지를 사용자에게 보내지만, 종료하지는 않음.
# shutdown -k 10
같은 카테고리의 다른 글

리눅스 / 명령어 / rdate / 타임서버의 시간과 동기화해주는 명령어

rdate는 서버의 시간과 타임서버의 시간을 동기화해주는 명령어이다. rdate는 설치되어있지 않는 경우가 많으므로, 필요하다면 설치를 해야 한다. CentOS라면 # yum install rdate Ubuntu라면 # apt install rdate 와 같이 명령하여 설치할 수 있습니다. 타임서버의 시간을 확인할 때는 -p 옵션을 사용합니다. 현재 서버의 시간을 변경하지 않는다. # rdate -p time.bora.net 현재 서버의 시간을 타임서버의 시간으로 맞출 때에는 -s 옵션을 ...

리눅스 / 스왑 메모리(Swap Memory) 만드는 방법

리눅스 시스템이 메모리를 다 사용하면 프로그램이 멈추는 등 문제가 발생한다. 이때 스왑 메모리(Swap Memory) 늘려서 메모리 부족 문제를 해결할 수 있다. 스왑 파일 만들기 적당한 디렉토리에 적당한 이름의 파일을 적당한 크기로 만든다. 예를 들어 다음과 같이 하면, 루트 디렉토리에 jb-swap이라는 파일을 2G의 크기로 만든다. # fallocate -l 2G /jb-swap root만 읽고 쓸 수 있게 권한 ...

리눅스 / 그룹 / 그룹 조회, 그룹 추가, 그룹 삭제, 그룹 수정

그룹 조회 그룹 목록은 /et/group 파일에 있습니다. cat 명령어로 전체를 조회하거나... cat /etc/group tail 명령어로 마지막 부분을 조회할 수 있습니다. # tail -n 5 /etc/group avahi:x:70: slocate:x:21: rngd:x:974: tcpdump:x:72: vboxsf:x:973: X:Y:Z 형식으로 나오는데, X는 그룹 이름, Y는 그룹 비밀번호, Z는 그룹 ID입니다. 그룹 추가 groupadd 명령으로 그룹을 추가합니다. # groupadd group-1 # tail -n 5 /etc/group slocate:x:21: rngd:x:974: tcpdump:x:72: vboxsf:x:973: group-1:x:1000: 그룹 삭제 groupdel 명령으로 그룹을 삭제합니다. # ...

리눅스 / 명령어 / cp - 복사하는 명령어, mv - 이동하는 명령어

cp는 copy의 약자로 복사하는 명령어, mv는 move의 약자로 이동하는 명령어이다. 복사하기 abc.txt 파일을 def.txt로 이름을 바꾸어 복사한다. cp abc.txt def.txt xyz라는 디렉토리가 없다면 abc.txt 파일을 xyz 파일로 복사한다. xyz라는 디렉토리가 있다면 xyz 디렉토리 안에 abc.txt 파일을 복사한다. cp abc.txt xyz abc.txt 파일을 xyz 디렉토리 안에 def.txt라는 이름으로 복사한다. cp abc.txt xyz/def.txt abc가 디렉토리이고 xyz라는 디렉토리가 없다면, abc 디렉토리를 xyz로 ...

리눅스 / 명령어 / history / 이전에 실행했던 명령어 목록 출력하는 명령어

history는 이전에 실행했던 명령어 목록 출력하는 명령어이다. history 이전에 실행했던 명령어 목록을 일련번호와 함께 출력한다. # history history n 최근 n개의 명령어 목록을 출력한다. 다음과 같이 명령하면 최근 실행한 10개의 명령어를 출력한다. # history 10 !! !!를 입력하고 엔터를 누르면 직전에 실행했던 명령어를 다시 실행한다. !n 일련번호가 n인 명령어를 실행한다. 다음과 같이 명령하면 번호가 202인 명령어를 실행한다. # !202

리눅스 / 명령어 / cat / 파일 내용 출력하는 명령어

다음과 같은 두 개의 파일이 있다고 할 때 file1 1-1 1-2 1-3 file2 2-1 2-2 2-3 cat filename cat 뒤에 파일 이름을 넣으면 파일 안의 내용을 보여줍니다. # cat file1 1-1 1-2 1-3 파일 이름을 연달아 넣으면 연속하여 파일의 내용을 보여줍니다. # cat file1 file2 1-1 1-2 1-3 2-1 2-2 2-3 cat filename -n -n 옵션을 붙이면 줄번호를 보여줍니다. # cat -n file1 1 1-1 2 1-2 3 1-3 # cat -n file1 file2 1 1-1 2 1-2 3 1-3 4 2-1 5 2-2 6 ...

리눅스 / 명령어 / which, whereis, locate / 명령어 위치 찾기

명령어의 위치를 찾을 때 사용할 수 있는 명령어에는 which, whereis, locate가 있다. 명령어의 위치만 찾을 때는 which를 사용하고, 관련된 파일들의 위치까지 찾을 때는 whereis나 locate를 사용한다. which 명령어로 find 명령어를 찾는다. # which find /usr/bin/find whereis 명령어로 find 명령어를 찾는다. # whereis find find: /usr/bin/find /usr/share/man/man1/find.1.gz locate 명령어로 find 명령어를 찾는다. # locate find /usr/bin/find /usr/bin/find2perl /usr/bin/findmnt /usr/bin/nl-link-ifindex2name /usr/bin/nl-link-name2ifindex /usr/bin/oldfind /usr/lib64/python2.7/modulefinder.py /usr/lib64/python2.7/modulefinder.pyc /usr/lib64/python2.7/modulefinder.pyo /usr/sbin/btrfs-find-root /usr/sbin/findfs /usr/share/bash-completion/completions/findmnt /usr/share/doc/findutils-4.5.11 /usr/share/doc/findutils-4.5.11/AUTHORS /usr/share/doc/findutils-4.5.11/COPYING /usr/share/doc/findutils-4.5.11/ChangeLog /usr/share/doc/findutils-4.5.11/NEWS /usr/share/doc/findutils-4.5.11/README /usr/share/doc/findutils-4.5.11/THANKS /usr/share/doc/findutils-4.5.11/TODO /usr/share/doc/wpa_supplicant-2.6/examples/p2p/p2p_find.py /usr/share/doc/wpa_supplicant-2.6/examples/p2p/p2p_stop_find.py /usr/share/info/find-maint.info.gz /usr/share/info/find.info.gz /usr/share/locale/be/LC_MESSAGES/findutils.mo /usr/share/locale/bg/LC_MESSAGES/findutils.mo /usr/share/locale/ca/LC_MESSAGES/findutils.mo /usr/share/locale/cs/LC_MESSAGES/findutils.mo /usr/share/locale/da/LC_MESSAGES/findutils.mo /usr/share/locale/de/LC_MESSAGES/findutils.mo /usr/share/locale/el/LC_MESSAGES/findutils.mo /usr/share/locale/eo/LC_MESSAGES/findutils.mo /usr/share/locale/es/LC_MESSAGES/findutils.mo /usr/share/locale/et/LC_MESSAGES/findutils.mo /usr/share/locale/fi/LC_MESSAGES/findutils.mo /usr/share/locale/fr/LC_MESSAGES/findutils.mo /usr/share/locale/ga/LC_MESSAGES/findutils.mo /usr/share/locale/gl/LC_MESSAGES/findutils.mo /usr/share/locale/hr/LC_MESSAGES/findutils.mo /usr/share/locale/hu/LC_MESSAGES/findutils.mo /usr/share/locale/id/LC_MESSAGES/findutils.mo /usr/share/locale/it/LC_MESSAGES/findutils.mo /usr/share/locale/ja/LC_MESSAGES/findutils.mo /usr/share/locale/ko/LC_MESSAGES/findutils.mo /usr/share/locale/lg/LC_MESSAGES/findutils.mo /usr/share/locale/lt/LC_MESSAGES/findutils.mo /usr/share/locale/ms/LC_MESSAGES/findutils.mo /usr/share/locale/nl/LC_MESSAGES/findutils.mo /usr/share/locale/pl/LC_MESSAGES/findutils.mo /usr/share/locale/pt/LC_MESSAGES/findutils.mo /usr/share/locale/pt_BR/LC_MESSAGES/findutils.mo /usr/share/locale/ro/LC_MESSAGES/findutils.mo /usr/share/locale/ru/LC_MESSAGES/findutils.mo /usr/share/locale/rw/LC_MESSAGES/findutils.mo /usr/share/locale/sk/LC_MESSAGES/findutils.mo /usr/share/locale/sl/LC_MESSAGES/findutils.mo /usr/share/locale/sr/LC_MESSAGES/findutils.mo /usr/share/locale/sv/LC_MESSAGES/findutils.mo /usr/share/locale/tr/LC_MESSAGES/findutils.mo /usr/share/locale/uk/LC_MESSAGES/findutils.mo /usr/share/locale/vi/LC_MESSAGES/findutils.mo /usr/share/locale/zh_CN/LC_MESSAGES/findutils.mo /usr/share/locale/zh_TW/LC_MESSAGES/findutils.mo /usr/share/man/man1/find.1.gz /usr/share/man/man1/find2perl.1.gz /usr/share/man/man1/oldfind.1.gz /usr/share/man/man8/btrfs-find-root.8.gz /usr/share/man/man8/findfs.8.gz /usr/share/man/man8/findmnt.8.gz locate 명령어는 -n 옵션으로 출력 ...

리눅스 / 캐시 메모리 삭제하는 방법

free 명령어로 메모리 사용 현황을 볼 수 있다. 아래의 경우 free에 여유가 있는데, 만약 buff/cache 사용량이 많아 free에 공간이 없다면 시스템이 느려진다. 그런 경우 메모리 캐시를 삭제하여 속도를 향상 시킬 수 있다. # free total ...

리눅스 / 명령어 / rmdir / 빈 디렉토리 삭제하는 명령어

rmdir rmdir은 빈 디렉토리를 삭제하는 명령어이다. Remove the DIRECTORY(ies), if they are empty. 사용법 rmdir directory a 디렉토리를 삭제한다. # rmdir a  비어있다면 삭제를 하고, 그렇지 않다면 다음을 출력한다. rmdir: failed to remove ‘a’: Directory not empty rmdir --ignore-fail-on-non-empty directory 디렉토리가 비어있지 않아도 메시지를 출력하지 않는다. rmdir -v directory 현재 디렉토리 안에 있는 모든 비어있는 디렉토리를 삭제한다. v 옵션을 넣으면 작업 결과를 ...

리눅스 / 명령어 / scp

scp는 ssh 프로토콜을 이용하여 파일을 송수신하는 명령어이다. local → remote remote → local remote → remote 모두 가능하다. local → remote 파일 복사 # scp a.txt root@192.168.3.211:/temp/a.txt root@192.168.3.211's password: 명령어를 실행한 디렉토리에 있는 a.txt 파일을 192.168.3.211 컴퓨터에 root 계정으로 연결하여 복사한다. 원격 컴퓨터에 /temp 디렉토리가 없으면 복사되지 않는다. 원격 컴퓨터에 /temp 디렉토리가 있으면 a.txt로 복사된다. a.txt 파일이 이미 있다면 덮어쓴다. root 계정의 ...