반응형


현재 디렉토리에서, pl 확장자를 가진 모든 파일 찾기

find -name '*.pl'


(현재 디렉토리 밑의 하위 디렉토리까지 다 찾습니다.)


루트에서부터, 즉 전체 하드에서, pl 확장자를 가진 모든 파일 찾기

find / -name '*.pl'




전체 하드 디스크에서, 파일명이 ab 로 시작하는 모든 파일 찾기

find / -name 'ab*'




전체 하드 디스크에서, 파일명이 .bash 로 시작하는 모든 파일 찾기

find / -name '.bash*'




전체 하드 디스크에서, 파일명이 .bash 로 시작하는 모든 파일 찾기
+ ls 명령 형식으로 출력

find / -name '.bash*' -ls


뒤에 -ls 라는 옵션을 붙이면 됩니다.




디렉토리명 찾기


전체 하드 디스크에서, 디렉토리 이름이 et 로 시작하는 모든 디렉토리 찾기

find / -name 'et*' -type d



주의! 옵션 순서를 바꾸면 에러가 납니다.




반응형

'프로그램 관련 > Linux(리눅스)' 카테고리의 다른 글

linux find 파일찾기  (0) 2018.08.22
리눅스 명령어모음!!!  (0) 2018.08.22
LINUX 파일만들기, 파일옮기기,이동,복사하기  (1) 2018.08.22
UBUNTU APT 패키지 삭제  (0) 2018.08.22
LINUX HDD MOUNT 하기  (0) 2018.08.22
반응형

mv

mv는 이름변경 및 이동을 담당하는 명령어이다.

 

형식) mv 원본파일 대상파일

 

예를들어 test.txt 라는 파일이 있다고 치고 나는 /home 디렉토리로 옮기고싶다.

하면 mv test.txt /home 이런식으로 적으면 test.txt 파일이 /home 디렉토리로 이동하게 된다.

( 물론 원래 현재 디렉토리에 있던 test.txt은 없어지게 된다. ) 

 

만약에 mv test.txt test1.txt 라고 하면,

test1.txt 라는 파일은 원래 없기때문에 자연스럽게 test.txt란 파일은 사라지고 test1.txt로 남게된다.

즉, 이름 변경이 가능하다는 뜻이다.

 

 

cp

 

cp는 파일이나 디렉토리를 다른 파일 또는 다른 디렉토리로 복사(Copy)를 수행한다.

 

형식) cp 원본파일 대상파일

 

예를들어 test.txt 라는 파일이 있다고 치고 /home 디렉토리에 복사해서 내용이 같은 파일을

복사하고 싶다면 cp test.txt /home 이런식으로 적으면 test.txt 파일은 그대로 있되

/home 디렉토리에도 또다른 test.txt 파일이 내용똑같은 상태에서 저장하게 된다.

 

또는 cp test.txt test2.txt 이런식으로 하면 test.txt 내용이 똑같이 복사된 test2.txt를

생성하게 된다.

 

옵션)

-a : 원본 파일의 속성, 링크 파일 정보를 유지하며 복사

-b : 파일이 존재할 경우 기존 파일을 백업

-d : 복사할 원본이 심볼릭 링크일 때 심볼릭 링크 자체를 복사

-f : 복사할 대상이 있으면 강제로 지우고 복사

-i : 복사할 대상이 있으면 강제로 지우고 복사

-r : 디렉토리 복사할 때 사용

-v : 복사 과정 자세히 출력

-u : 복사할 대상의 변경 날짜가 같거나 더 최근 것이면 복사하지 않음

 

옵션 예 ) cp -r 디렉토리명1 디렉토리명2

 

 

자, 그럼 실습을 통해 이해하기 쉽게 알아보자.

 

 

 

mv 명령 실습

 

 

 

 

 

cp 명령 실습

 

 

 

 

내용 저장시 당연히 콜론상태에서 wq 해줘야하는거 잊지않기

 

옵션을 이용해서 응용해 스스로 실습하는 시간을 가져보길 바란다.




반응형

'프로그램 관련 > Linux(리눅스)' 카테고리의 다른 글

리눅스 명령어모음!!!  (0) 2018.08.22
리눅스 파일 찾기 (파일명 검색)  (0) 2018.08.22
UBUNTU APT 패키지 삭제  (0) 2018.08.22
LINUX HDD MOUNT 하기  (0) 2018.08.22
UBUNTU POSTGRESQL PASSWORD변경  (0) 2018.08.22
반응형

우분투(Ubuntu)에서 패키지를 관리하는 명령어가 몇가지 있습니다. 그 중 가장 기본이 되는 것이 apt-get입니다. 많은 옵션이 있는데, 자주 쓰는 몇가지를 정리해보겠습니다.

apt-get update

패키지 목록을 갱신합니다.

apt-get upgrade

모든 패키지를 최신 버전으로 업그레이드합니다.

apt-get install abc

abc 패키지를 설치합니다.

apt-get remove abc

abc 패키지를 삭제합니다. 설정파일은 삭제하지 않습니다.

apt-get purge abc

abc 패키지를 삭제합니다. remove와 다르게 설정파일도 삭제합니다.

참고로 패키지 검색은 apt-cache로 합니다. abc라는 단어를 포함한 패키지를 검색하려면 

apt-cache search abc

와 같이 하면 됩니다.

apt-get 명령어의 사용법과 옵션은

apt-get -h

으로 알아낼 수 있습니다. 결과는 다음과 같습니다.

apt 0.8.16~exp12ubuntu10.12 for i386 compiled on Jul 16 2013 18:00:58
Usage: apt-get [options] command
       apt-get [options] install|remove pkg1 [pkg2 ...]
       apt-get [options] source pkg1 [pkg2 ...]

apt-get is a simple command line interface for downloading and
installing packages. The most frequently used commands are update
and install.

Commands:
   update - Retrieve new lists of packages
   upgrade - Perform an upgrade
   install - Install new packages (pkg is libc6 not libc6.deb)
   remove - Remove packages
   autoremove - Remove automatically all unused packages
   purge - Remove packages and config files
   source - Download source archives
   build-dep - Configure build-dependencies for source packages
   dist-upgrade - Distribution upgrade, see apt-get(8)
   dselect-upgrade - Follow dselect selections
   clean - Erase downloaded archive files
   autoclean - Erase old downloaded archive files
   check - Verify that there are no broken dependencies
   changelog - Download and display the changelog for the given package
   download - Download the binary package into the current directory

Options:
  -h  This help text.
  -q  Loggable output - no progress indicator
  -qq No output except for errors
  -d  Download only - do NOT install or unpack archives
  -s  No-act. Perform ordering simulation
  -y  Assume Yes to all queries and do not prompt
  -f  Attempt to correct a system with broken dependencies in place
  -m  Attempt to continue if archives are unlocatable
  -u  Show a list of upgraded packages as well
  -b  Build the source package after fetching it
  -V  Show verbose version numbers
  -c=? Read this configuration file
  -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp
See the apt-get(8), sources.list(5) and apt.conf(5) manual
pages for more information and options.
                       This APT has Super Cow Powers.



반응형

+ Recent posts