리눅스 / 명령어 / mkdir / 디렉토리 만드는 명령어

mkdir은 make directory의 약자로, 디렉토리를 만드는 명령어입니다.

  • abc 디렉토리를 만듭니다.
mkdir abc
  • abc 디렉토리 아래에 def 디렉토리를 만듭니다. 만약 abc 디렉토리가 없다면 def 디렉토리를 만들 수 없다는 메시지가 나옵니다.
mkdir abc/def
  • p 옵션을 붙이면 abc 디렉토리가 없어도 abc 디렉토리를 만든 후에 def 디렉토리를 만듭니다.
mkdir -p abc/def

같은 카테고리의 다른 글

리눅스 / rsync / 동기화 프로그램

리눅스 / rsync / 동기화 프로그램

rsync는 동기화 프로그램이다. 백업할 때 유용하게 사용할 수 있다. 사용법 기본 rsync -avz /abc/def /xyz abc 디렉토리 안의 def 디렉토리를 xyz 디렉토리 안에 동기화시킨다. 처음 실행하는 것이라면 xyz 디렉토리 안에 def 디렉토리가 복사된다. 다시 실행시키면 /abc/def 디렉토리의 내용 중 수정되거나 추가된 것만 /xyz/def 디렉토리로 복사된다. /abc/def에서 삭제된 내용은 /xyz/def에 반영되지 않는다. rsync -avz /abc/def/ /xyz def 뒤에 /를 붙이면 ...

리눅스 / 명령어 / alias / 명령어 별칭 만들기

리눅스 / 명령어 / alias / 명령어 별칭 만들기

긴 명령어 또는 복잡한 명령어를 자주 사용한다면 alias를 사용하자. 시간을 많이 절약할 수 있다. alias 목록 보기 alias를 실행하면 현재 등록된 alias를 출력한다. alias 예를 들어 ll을 실행한다는 것은 ls -alF를 실행하는 것과 같다. alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias grep='grep --color=auto' alias l='ls -CF' alias la='ls -A' alias ll='ls -alF' alias ls='ls --color=auto' alias 만들기 alias는 다음과 같이 만든다. abc를 실행하는 ...

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

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

명령어의 위치를 찾을 때 사용할 수 있는 명령어에는 which, whereis, locate가 있습니다. 명령어의 위치만 찾을 때는 which를 사용하고, 관련된 파일들의 위치까지 찾을 때는 whereis나 locate를 사용합니다. 각 명령어로 find 명령어를 찾아보겠습니다. # which find /usr/bin/find # whereis find find: /usr/bin/find /usr/share/man/man1/find.1.gz # 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 옵션으로 출력 개수를 정할 수 있습니다. # locate ...

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

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

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

리눅스 / 명령어

리눅스 / 명령어

명령어 개요 adduser 사용자 추가하는 명령어. alias 명령어 별칭을 만든다. cal calendar. 달력을 출력하는 명령어. cat concatenate. 파일 내용 출력하는 명령어. cd change directory. 다른 디렉토리로 이동하는 명령어. chmod 파일 또는 디렉토리의 읽기, 쓰기, 실행 권한 설정하는 명령어 chown 파일 또는 디렉토리의 소유자(그룹) 설정하는 명령어 clear 터미널 화면의 내용을 다 지운다. cp copy. 파일 또는 디렉토리 복사. du disk usage. 디스크 사용량 출력. file 파일의 종류를 출력하는 명령어 find 파일 또는 디렉토리를 검색하는 명령어 history 이전에 실행한 ...

리눅스 / 명령어 / find / 파일 또는 디렉토리를 찾는 명령어

리눅스 / 명령어 / find / 파일 또는 디렉토리를 찾는 명령어

find는 파일 또는 디렉토리를 찾는 명령어입니다. 자주 사용하는 옵션 등을 정리해봅니다. find 현재 디렉토리 안에 있는 모든 파일과 디렉토리를 출력합니다. 숨긴 파일 또는 숨긴 디렉토리도 출력합니다. find /etc /etc 디렉토리 안에 있는 모든 파일과 디렉토리를 출력합니다. 숨긴 파일 또는 숨긴 디렉토리도 출력합니다. find -name abc 현재 디렉토리 안에서 이름이 abc인 파일 또는 abc인 디렉토리를 검색합니다. find -name ...

리눅스 / 명령어 / passwd / 사용자 암호 설정 명령어

리눅스 / 명령어 / passwd / 사용자 암호 설정 명령어

사용자의 비밀번호 설정은 passwd 명령어로 한다. 비밀번호 만들기, 변경하기 사용자 jb의 비밀번호를 만들거나 변경한다. passwd jb 사용자을 적지 않으면 현재 로그인한 사용자의 비밀번호를 만들거나 변경한다. 비밀번호 삭제하기 사용자 jb의 비밀번호를 삭제한다. 사용자는 비밀번호 입력 없이 로그인 가능하다. passwd -d jb 비밀번호 잠그기, 잠금 풀기 사용자 jb를 잠근다. 즉, 사용자는 로그인하지 못한다. passwd -l jb 사용자 jb의 잠금을 푼다. passwd -u jb 비밀번호 만료시키기 사용자 ...

리눅스 / 명령어 / man / 명령어의 설명서 출력하는 명령어

리눅스 / 명령어 / man / 명령어의 설명서 출력하는 명령어

man은 manual의 약어로, 명령어의 설명서를 출력하는 명령어입니다. man 뒤에 명령어 이름을 넣고 엔터를 누릅니다. 예를 들어 man rm 은 rm 명령어의 설명서를 출력합니다. ↑키를 누르면 한 줄 위로 올라가고, ↓키를 누르면 한 줄 아래로 내려갑니다. Page Up 키를 누르면 한 페이지 위로 올라가고, Page Down 키를 누르면 한 페이지 아래로 내려갑니다. /를 누르고 단어를 입력하면 ...

리눅스 / 명령어 / mkdir / 디렉토리 만드는 명령어

리눅스 / 명령어 / mkdir / 디렉토리 만드는 명령어

mkdir은 make directory의 약자로, 디렉토리를 만드는 명령어입니다. abc 디렉토리를 만듭니다. mkdir abc abc 디렉토리 아래에 def 디렉토리를 만듭니다. 만약 abc 디렉토리가 없다면 def 디렉토리를 만들 수 없다는 메시지가 나옵니다. mkdir abc/def p 옵션을 붙이면 abc 디렉토리가 없어도 abc 디렉토리를 만든 후에 def 디렉토리를 만듭니다. mkdir -p abc/def 리눅스 / 명령어 / rm / 파일 또는 디렉토리 삭제하는 ...

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

리눅스 / 명령어 / 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 ...