반응형

git diff 제대로 안될 때

\r 때문이라면
\r=CR(Carriage Return) // Used as a new line character in Mac OS before X 캐럿이 그 줄 맨 앞으로
\n=LF(Line Feed) // Used as a new line character in Unix/Mac OS X 캐럿이 다음 줄로
\r\n=(End Of Line) CR + LF // Used as a new line character in Windows
해결방법
git config --global core.autocrlf true 로 설정변경

git config --global -l 로 확인함

https://www.lesstif.com/pages/viewpage.action?pageId=20776404 참조

 

아래와 같이 LF로 바꿔도 계속 다시 crlf로 자동변환하는데 이거 안하게 하는 방법은?

$ git stash
warning: LF will be replaced by CRLF in src/main/java/com/lge/cdp/model/Program.java.
The file will have its original line endings in your working directory.

 

반응형

'git' 카테고리의 다른 글

git rebase, cherry-pick을 잘 이해해보자  (0) 2019.06.11
git tag  (0) 2019.06.07
gerrit  (0) 2019.04.30
Git: ssh public key 등록  (0) 2019.04.26
git  (0) 2019.04.26
반응형
  • gerrit이란?
    • Google에서 만든 code review tool, 커밋단위로 리뷰를 진행하여 -2,-1,0,2,1점을 줄수 있으며, 2점을 받아야 main branch로 소스적용(submit)할 수 있음 
    • submit된 리뷰는 추가수정(patchset올리기)할 수 없음, commit message도 못고침, reviewer추가는 할 수 있음 
      • 추가 시도하면 다음 에러발생

  • code review를 올린다는 것은 다음과 같이 바로 push하지 않고 아래와 같이 push하는 것
    • git push origin HEAD:refs/for/[branch name] 공개리뷰
    • git push origin HEAD:refs/drafts/[branch name] 비공개리뷰
  • 위 push가 무슨 뜻인지 이해해보자
    • 원래 git push도 많은 것들이 생략되어 있음, 즉 원래는
      • git push [<repository>] [<refspec>...]
      • git push [remote repository, 생략하면 origin] [<local branch refs>:<remote branch refs>]
      • git push = git push origin master = git push origin refs/heads/master:refs/heads/master
      • 이말인즉슨, 내 master에서 remote의 master로 push하라는 것
    • 그렇다면 git push origin HEAD:refs/for/master (branch name) 얘는 이런의미!
      • 내 것중에 HEAD에서 refs/for/master라는 곳으로 push하라
      • HEAD는 내가 현재 branch에서 commit한 최신 위치를 가리킴, master일수도 있고 아닐수도 있고 remote랑 연결안된 애일수도 있고, 아무튼 현재 checkout되어 있는 브랜치에서 작업한 사항을 말하는 것
      • refs/for/master는 master로 적용되기 위한 code review(그냥 임시 브랜치라고 볼수 있을 것 같음)를 위한 공간, +2점을 받으면 master branch로 merge (이것을 submit이라 표현)될수 있음

  • code review는 patchSet이라고도 하며 리뷰받은 것들을 계속 수정해가며 추가할 수 있는데, 그러기 위해서 커밋메세지 내 change-id라는 것을 통해 동일 code review patch라는 것을 연결할 수 있음
    • 커밋메세지 연결을 위해서 아래 작업 필요
      • scp -p -P 29448 sy919.kim@wall.lge.com:hook/commit-msg ./git/hooks/ (를 commit전에 입력해야 한다고 하는데 hook..가 없다며 에러남)
      • commit message 마지막에 Change-Id: Ib99b87b88cead9f5afe4beaee624c1935f4f33b0 이걸 항상 연결시켜줘야 함 - git/hooks/commit-msg가 저절로 해줌
      • Change-Id: review에 대한 revision (uniqueID)

  • git push origin master → code review, merge없이 바로 push, 하면 안됨
    • 뭔가 원복하기 위해서 이거저거 해봤으나 안됨: git push HEAD:refs/for/master를 다시 실행하면 다음 메세지뜸
      warning: push.default를 설정하지 않았습니다. 묵시적 값은 깃 2.0에서
      'matching'에서 'simple'로 바뀌었습니다. 이 메시지를 표시하지
      않고 과거의 동작을 유지하려면 다음과 같이 하십시오:이 메시지를 표시하지 않고 새 동작을 받아들이려면 다음과 같이
      하십시오:push.default가 'matching'으로 설정되면, 로컬 브랜치를 이미 같은 이름이
      있는 리모트 브랜치로 푸시합니다.더 자세한 정보는 'git help config'에서 'push.default' 설명을 보십시오.
      ('simple' 모드는 깃 1.7.11에 추가되었습니다. 과거 버전의 깃을 사용하게
      되면 비슷한 'current' 모드를 사용하십시오.)
    • 깃 2.0부터 더 보수적인 'simple' 동작이 기본값입니다. 여기서는 현재
      브랜치를 'git pull'에서 현재 브랜치를 업데이트할 때 사용하는 해당
      리모트 브랜치로 푸시합니다.
    • git config --global push.default simple
    • git config --global push.default matching
  • git push origin HEAD:/for/refs/master 로 잘못 쓰면 remote에 for/refs/master라는 branch가 자동생성되고 글로 push되며, 원래 하려고 했던 master로 push로 다시 push하면 new change가 아니라서 push할 수 없다고 함
    • checkout 해서 일단 local에 for/refs/master를 받고  git branch --delete 으로 branch 삭제 (다른 곳으로 가야 삭제가능)후 push 하여 remote branch까지 삭제해줌, 그후 다시 push 하면 동작함

[CCC: build repository 변경]


차이는?

반응형

'git' 카테고리의 다른 글

git rebase, cherry-pick을 잘 이해해보자  (0) 2019.06.11
git tag  (0) 2019.06.07
git diff troubleshooting  (0) 2019.06.07
Git: ssh public key 등록  (0) 2019.04.26
git  (0) 2019.04.26
반응형

git clone 시에 아래와 같이 인증에러가 난다면 ssh public key를 등록하자!

D:\IoT>git clone http://mod.lge.com/prosys/iot-dev/iot-service
Cloning into 'iot-service'...
remote: Unauthorized
fatal: Authentication failed for 'http://mod.lge.com/prosys/iot-dev/iot-service/'

Linux) 먼저 ~/.ssh로 가서 public key가 이미 생성되어 있는지 확인

Windows)의 경우 c:/Users/user/.ssh 위치에서 확인가능

$ ls ~/.ssh
id_rsa  id_rsa.pub  known_hosts ==> 이렇게 나오면, pub키가 생성되어 있는 상태임
$ cd ~/.ssh
$ cat id_rsa.pub          ==> key file 내용 확인 후 클립보드에 저장 ( 아래에서 public key등록 시 사용 )

생성안되었으면 ssh-keygen으로 생성한다!

Windows도 git bash 실행후 console에서 동일하게 ssh-keygen 입력하면 됨, ssh-keygen 입력후 키의 이름을 무엇으로 할 것인지 등 질문을 받는데 그냥 enter키만 반복입력하면 됨 (key 이름 지정하여 생성후 키등록하니까 인증실패로 소스를 못받아옴)

$ ssh-keygen              ==> [중요!!] enter키만 입력하여 키 생성을 완료해주세요. password를 입력하지 말것
$ cat id_rsa.pub          ==> key file 내용 확인 후 클립보드에 저장 ( 아래에서 public key등록 시 사용 )

수정후 자신의 .ssh 폴더 내용

/[자신의 계정]/.ssh/
|-authorized_keys       --> 개인 설정에 따라 없어도 무방
|-config            --> 새로 생성된 파일
|-id_rsa            --> id_dsa로 되어 있어도 무방
|-id_rsa.pub        --> id_dsa.pub로 되어 있어도 무방
`-known_hosts       --> 개인 설정에 따라 없어도 무방

그리고나서 git에 자기 public key를 등록해야함

gerrit login > settings 클릭 >  SSH Public Keys클릭 > Add Key > 클립 보드에 복사한 id_rsa.pub의 내용을 등록

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8G9BUES20uv0aioy333VD+yIQVkNlg/56kdDC/NOcvfzdEx87y6aiUKs26uWnwa8uazwxG/slzjq3iCXqyQ0M7r4xpezzCbxWHroHmvLpmOrtLVkQI0bXyKsRCFE+ZoawQ24CbD0TUJey8l/8KgdpekWIF61BTdYpBmsREJR5VdWwvwKlQ+xhTguf2hxq4yukbxEM831wP/r6c6Y4kuhdrX0GwPqC+HtIHeXgV4Wp6C6ib6uNGl6Q139VSU14QC5bignjl6DYEp7ckG33uzJEgAZQLnD84/ZRF3UVUETqFfrn0dS0MlO/ahxIhkL4zLFh3sBiGoAJoloQg4JKaKt5 ibs@ibs-sykim

위와 같이 생겼을텐데 위 내용 전부 복붙해야함, ssh-rsa 시작하는 이거부터 다~ 

반응형

'git' 카테고리의 다른 글

git rebase, cherry-pick을 잘 이해해보자  (0) 2019.06.11
git tag  (0) 2019.06.07
git diff troubleshooting  (0) 2019.06.07
gerrit  (0) 2019.04.30
git  (0) 2019.04.26
반응형
  • git branch 개념
    • branch: 어떤 한commit을 가리키는 40글자의 SHA-1 체크섬 파일, 결국 branch도 어떤 특정한 commit임
    • master: 기본 branch
    • origin: 기본 remote, remote repository를 여러개 사용할 수 있고 각각의 이름을 지정해서 쓸수도 있으나 사실 이렇게 여러개 remote사용하는 경우가 별로 없음, 그래서 그냥 remote = origin이라고 쉽게 생각하면 됨, origin하면 내 local의 것이 아니라 remote 외부서버 것이라는 의미로 볼 수 있음
  • .git
    • .git/HEAD: 현재 branch
    • .git/refs/heads/*: 로컬 저장소의 branches
    • .git/refs/remotes/*: 원격 저장소의 branches
    • .git/refs/tags/*: 태그, 로컬? 원격?
  • 참고정보

commit 관련

git add <file1> <file2>
git add .
git reset HEAD <file>
git reset HEAD
git checkout -- <file>
git checkout -f <other branch>
아마 git checkout -f <other branch>로 가능할듯git clean -f
로컬저장소의 index(staging area)에 파일 2개 추가
변경된 모든 파일 추가
특정파일 add 취소 (staging area에서 내쫓기)
전체파일 add 취소 (add 취소해도 modified 상태로 남기 때문에 수정한게 없어지지 않음)
add하기 전에 수정한 것 자체를 삭제 (완전히 없어짐)
한꺼번에 모든수정자체를 없앰 (강제로 다른곳으로 가면됨)
기존파일은 이렇게 없어지는데 새로 추가한 파일, 즉 untracked까지 몽땅 없애는 방법은?
git commit <file>
git commit
git commit -a  
git commit -a -m "log" 
git commit --amend

로컬저장소의 head에 변경내용 확정
add된 전체사항 commit
add와 commit을 한꺼번에
add와 commit을 한꺼번에 하는데 commit message "log"로 지정
이전 commit에 묻어가기, commit message만 변경할때에도 사용

git reset HEAD^
(=git reset --mixed HEAD^)
 
git reset HEAD~2
git reset --soft HEAD^
git reset --mixed HEAD^
git reset --hard HEAD^
commit취소 (=Local Repository의 최신 commit 리비전을 바로전 리비전(HEAD^)로 설정) 그럼 이미 커밋한 revision번호는 어디로?
c90f6405920652b379bbfcb8a925940f2c73743f [TVOQAISSUE-8953] delete FB.init 취소했음 이 revision은 어디로?
삭제 후 바로 git show 하니까 정보는 다 나옴


commit 2개 취소
index 보존(add한 상태, staged 상태, 변경사항 당근 보존)
index 취소(add하기 전 상태, unstaged 상태, 변경사항 보존) (기본 옵션)
index 취소(add하기 전 상태, unstaged 상태, 변경사항 삭제) 워킹 디렉터리의 파일 삭제. 즉 모두 취소


 
(1)
git reset HEAD^


git reflog 또는 git log -g
git reset HEAD@{#} 또는 git reset [commit id]
(2) git commit -m "message"
(3) git push origin <branch name> -f 또는 git push origin +<branch name>
git push 취소방법 https://gmlwjd9405.github.io/2018/05/25/git-add-cancle.html
(1) commit 을 되돌림
commit 1개 취소된 상태로
Reflog(branch와 HEAD가 지난 몇달 동안에 가리켰던 commit) 확인
특정 commit 상태로


(2) 되돌려진 상태에서 다시 commit
(3) 원격저장소에 강제 push
  • git log --oneline -10
  • git log --oneline submissions/1
  • git log -5 --decorate --graph –oneline
  • git log -5 --author=dhrim –oneline
  • git log --before={3.weeks.ago} --after={2010-04-18}
  • git log --grep=“some message”
  • git log --pretty=format:"%h,%ar,%an : %s" 
  • git log --pretty=format:"%h,%ar,%an : %s" --graph
  • 1줄씩 최근 10개 commit보여줌
  • 최근 5개의 리비전을 그래프로 보여준다
  • 저자가 dhrim인 리비전을 5개 보여준다
  • 주어진 기간내의 리비전만 보여준다
  • commit 메시지에 “some message”가 포함된 것만 보여준다
  • commit 정보를 한줄 단위로 보여주되. format 에 맞게 보여줌 
  • Git GUI 툴처럼 graph로 보여줌
    • %h : commit 번호(간략) 
    • %ar : 시간 (housrs ago, days ago) 
    • %an : commit한 사람 
    • %s : commit 로그

git init: 새로운 저장소 만들기

git clone: 이미 만들어진 저장소 받아오기 (=svn checkin?)

git diff (=git diff HEAD)

git diff HEAD^

git diff 브랜치명 브랜치명: 2 브랜치간 차이

git diff 브랜치명 revision: 브랜치와 revision간 차이

git help stash (=man git-stash) stash 도움말보기

git mv: 파일명 변경

git rm: 파일삭제

branch 관련 명령

git branch
git branch -r
git branch -a
git branch -vv
local에 있는 전체 branch list랑 현재 작업중인 branch가 뭔지를 알려줌
remote에 있는 전체 branch list
remote, local에 있는 모든 branch list와 현재 작업중인 branch가 뭔지를 알려줌
현재 local branch와 remote branch가 어떤 상태에 있는지 (더 앞서있는지, 뒤에있는지 등) 알려줌
git checkout -b [branch name]
git checkout -b [branch name] revision번호
git checkout -b [생성할 local branch name] [remote branch name]
git checkout [remote branch name]
git checkout -t [remote branch name]
git push origin [생성한 branch name]
git push --set-upstream origin frontend
새로운 브랜치 생성하고 그곳으로 감
새로운 브랜치 생성하고 그곳에 특정revision(다른 branch에서 생성한 revision)을 내려받고 그곳으로 감
 
remote에 있는 특정 branch 내려받는데 local에서 이름을 바꿔서 받기
-b가 어떤 약자인지 확인해 봤으나 ( https://git-scm.com/docs/git-checkout ) branch란 의미외에 다른 약어는 없는듯



remote에 있는 특정 branch 임시로 내려받기, 소스 수정가능하나 comit/push는 안되며 타 branch로 checkout 하면 소스사라짐
remote에 있는 특정 branch 내려받기
생성한 branch를 remote로 push
To push the current branch and set the remote as upstream
git branch --set-upstream-to=origin/<branch> dev.sy branch 생성하고 push해도 remote와 local이 연결되지 않을 수 있는데 (There is no tracking information for the current branch) 그럴 때 If you wish to set tracking information for this branch you can do so with:
tracking(연결)하지 않고 다른 branch 내용 받아오고 싶을 때 (tracking안되면 'git pull' 뒤에 branch 명시해야함) Please specify which branch you want to merge with. See git-pull(1) for details.
git branch --delete [branch name]
git branch -D [branch name]
git push origin :[branch name]
local branch 삭제 (삭제할 branch로 checkout된 상태이면 안됨)
local branch 강제삭제(작업내역이나 commit이력이 있을 때 삭제안될때 있음)(삭제할 branch로 checkout된 상태이면 안됨)
삭제한 branch를 push, 즉 remote branch 삭제, origin(한칸안띄우면 안됨):[branch name]
git push origin --delete [branch] checkout 필요없이 그냥 한방에 remote branch삭제
git merge 브랜치명 현재 내가 있는 브랜치에서 브랜치명의 브랜치 내용을 가져와서 merge (checkout해서 간 다음 끌어당겨온다고 생각)
git remote
git remote -v
git remote add <remote> <url>
git fetch <remote>
git push <remote> <branch>
git remote show origin
현재 프로젝트에 등록된 리모트 저장소 확인, 저장소를 Clone 하면 `origin`이라는 리모트 저장소가 자동으로 등록
리모트 저장소, URL 확인
기존 워킹 디렉토리에 새 리모트 저장소 추가
리모트 저장소에서 데이터 가져오기
리모트 저장소로 push
리모트 저장소의 구체적인 정보 확인

 

git checkout <remote에 없는 branch name> 하면 local에 새 branch만들어지고 그전에 있던 branch내용을 그대로 가져와서 만들어짐, 그전에 commit한 이력도 그대로 다 가져오는 듯

git stash 

  • $ git diff  (1)
  • # Changed …. : ….
  • $ git stash  (2)
  • $ git diff  (3)
  • $ git pull  (4)
  • $ git stash pop  (5)
  • $ git commit –a –m “my modification”  (6)
  • (1) 변경된 사항이 있다.
  • ......
  • (2) 변경된 사항을 Stash에 보관해 두고, 현재의 상태를 Local Repository의 최근 commimt 상태로 변경한다.
  • (3) 변경된 사항이 없음을 확인
  • (4) Remote Repository에서 최신 것을 가져온다.
  • (5) Stash에 보관된 변경사항을 적용하여 머징한다.
  • (6) 변경된 사항을 Local Repository에 commit 한다.
  • $ git stash list  (1)
  • stash@{0}: WIP on master: …
  • stash@{1}: WIP on master: …
  • $ git stash show -p  (2)
  • $ git stash show –p stash@{1}    (3)
  • $ git stash apply  (4)
  • $ git stash clear  (5)
  • (1)Stash에 저장된 것을 조회한다. 현재 2개가 있다.
  • ...
  • ...
  • (2)최신의 것과 비교한다. –p 옵션을 주면 내용까지 확인 한다.
  • ...
  • (3) 이름 ‘stash@{1}’로 저장된 것과 비교한다.
  • ...
  • (4) 최신의 것으로 merging한다. ‘stash pop’을 사용할 경우 merging하고 삭제한다.
  • (5) Stash에 저장된 것을 전부 삭제한다.

.svn은 자기 변경본만 가지고 있지만 .git은 모든 서버정보 다 가짐

반응형

'git' 카테고리의 다른 글

git rebase, cherry-pick을 잘 이해해보자  (0) 2019.06.11
git tag  (0) 2019.06.07
git diff troubleshooting  (0) 2019.06.07
gerrit  (0) 2019.04.30
Git: ssh public key 등록  (0) 2019.04.26
반응형

화면캡쳐


 전체 화면 캡쳐  활성화 창 캡쳐  선택 영역 캡쳐
 그림 파일로 저장 Print  Alt + Print   Shift + Print
 클립 보드로 복사  Ctrl + Print Ctrl + Alt + Print  Ctrl + Shift + Print 

단축키 변경방법

환경설정 (전체설정) -> 키보드 -> 바로가기 -> 스크린샷' 메뉴에 보면 위 6 종류 단축키 설정가능

출처: https://harryp.tistory.com/595 [Park's Life]

 

창 조절: Ctrl + Window Key + 화살표키 (Windows에서 Window Key + 화살표키와 동일기능)

반응형

'etc > linux' 카테고리의 다른 글

linux java process 찾기, java 실행  (0) 2020.01.31
리눅스 PC에 백업  (0) 2019.07.26
시스템 관련  (0) 2019.04.23
troubleshooting  (0) 2019.04.02
Linux 명령어  (0) 2019.03.29
반응형

Disk 관련

  • hdd인지 sdd인지 확인: rota가 1이면 hdd, 0이면 sdd, ROTA means rotational device (1 if true, 0 if false)
    • lsblk -d -o name,rota
    • cat /sys/block/sda/queue/rotational
  • disk 모델, 제조사 등 확인: http://fibrevillage.com/storage/599-how-to-tell-if-a-disk-is-ssd-or-hdisk-on-linux
    • cat /proc/scsi/scsi
  • disk 관리 관련: https://cptyun.tistory.com/3
    • df : 디스크 마운트 상태 및 용량 확인
    • fdisk : 디스크 파티션 관리
    • mkfs.ext4 : EXT4 형식으로 디스크 포맷
    • mount / umount : 디스크 마운트 / 언마운트
    • fstab : 시스템 부팅시에 디스크 마운트
  • df -h (disk free -human readable): 디스크 마운트 상태 및 용량 확인
  • lsblk (list block devices) https://linoxide.com/linux-command/linux-lsblk-command/
    • NAME :This is the device name.
    • MAJ:MIN :This column shows the major and minor device number.
    • RM :This column shows whether the device is removable or not. Note in this example the device sdb and sr0 have their RM values equals to 1 indicating they are removable.
    • SIZE :This is column give information on the size of the device. For example 298.1G indicate the device is 298.1GB and 1K indicate the device size is 1KB.
    • RO :This indicates whether a device is read-only. In this case all devices have a RO=0, indicating they are not read only.
    • TYPE :This column shows information whether the block device is a disk or a partition(part) within a disk. In this example sda and sdb are disks while sr0 is a read only memory (rom).
    • MOUNTPOINT :This column indicates mount point on which the device is mounted.

디스크 마운트 상태 및 용량 확인

Memory 관련

  • free -h : 전체 메모리와 가용 메모리 human readable하게 알려줌
  • top: Windows 작업관리자 같은 것 - top
  • proc/meminfo
  • ps -ef
    • ps -ef --sort -rss, rss(Resident Set Size) : 물리 메모리를 실제 점유하고 있는 크기
    • 가장 위에 있는 프로세스가 물리 메모리를 가장 많이 점유하고 있음!
    • ps -eo user,pid,ppid,rss,size,vsize,pmem,pcpu,time,comm --sort -rss | head -n 11
  • dmidecode: 설치된 RAM 하드웨어 정보 표시.
    • 예) dmidecode -t 17, type 17이 RAM. (그 외 L1/L2 cache 등)

https://m.blog.naver.com/jayeonsaram/220647978281

반응형

'etc > linux' 카테고리의 다른 글

linux java process 찾기, java 실행  (0) 2020.01.31
리눅스 PC에 백업  (0) 2019.07.26
Ubuntu 단축키  (0) 2019.04.26
troubleshooting  (0) 2019.04.02
Linux 명령어  (0) 2019.03.29
반응형
  • hover:
    • 공중을 맴돌다, 공중에 떠다니다, 공중부양하다, 마우스 커서의 공중부양
    • hover=mouseenter+mouseleave
    • mouse over, 마우스 커서가 닿는 것, 모든 element에 적용가능
  • mouse[enter/over]
    • mouseenter: 자식영역 감지X
    • mouseover: 자식영역까지 감지O
  • mouse[out/leave]
    • mouseleave: 자식영역빠져나가는 것 감지X 
    • mouseout: 자식영역빠져나가는 것 감지O
  • focus/blur
    • focus: 입력 커서가 있는 것, input element에 적용됨
    • blur: focus를 잃는 것?
  • toggle: 한개 스위치로 껏다켰다 하는 거
  • modal: ?

ellipsis 생략 말줄임

clipMode={'EllipsisWithTooltip'}
text-overflow: ellipsis;
반응형
반응형

css selector: https://www.w3schools.com/cssref/css_selectors.asp

  • div,p: all div & all p
  • div p: div의 모든 p 자손 (자식, 손주, 증손주...모두 포함)
  • div>p: div의 자기 자식 p만
  • div+p: div 옆 바로 인접한 이웃 p만
  • div~p: div 옆에 있는 같은 레벨의 모든 이웃 p (이웃의 자손은 같은 레벨이 아니므로 포함 안됨)

table: The thead, tbody, and tfoot elements will not affect the layout of the table by default. However, you can use CSS to style these elements.

  • thead
    • tr: table row
      • th: table header
      • th
      • th
  • tbody
    • tr
      • td: table data
      • td
      • td
    • tr
      • td
      • td
      • td
  • tfoot
    • tr
      • td
      • td
      • td

 

 

반응형
반응형

gzip: stdout: No space left on device   

https://askubuntu.com/questions/223248/gzip-stdout-no-space-left-on-device-while-upgrading-the-kernel

https://ubuntuforums.org/showthread.php?t=2362183

  • 먼저 disk용 가용공간 확인
    • df -h: disk free 줄임말, -h는 human readable, 사람이 보기편한 MB,GB 단위로 출력해줌
  • 다운로드된 커널 이미지 목록 확인
    • dpkg -l | grep linux-image: debian package manager? .deb 패키지의 설치, 삭제, 정보 확인등을 위해 사용되는 명령어
  • 현재 사용되는 커널이미지 확인
    • uname -r: find your currently running kernel (uname=UNIX name)
  • 현재 사용되는 것 외에 불필요한 것을 삭제 -> 다시 df 확인하니 가용공간 늘어나고 문제해결됨

Visual Studio Code에서 bootstrap table -  yarn start 잘 되다가 다음날 이런 에러 발생...

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/ibs/react/bootstap-table/public'
    at FSWatcher.start (internal/fs/watchers.js:165:26)
    at Object.watch (fs.js:1274:11)
.....이하 에러메세지 생략

해결책) https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers#the-technical-details

inotify watcher increase해야함

  • get your current inotify file watch limit) cat /proc/sys/fs/inotify/max_user_watches -> 8192 였음
  • max value 524388로 increase) echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
  • 다시 cat /proc/sys/fs/inotify/max_user_watches 하니 524388로 늘어남

visual studio code linux 문서에서 관련사항 설명되어 있음 https://code.visualstudio.com/docs/setup/linux

 

 

 

반응형

'etc > linux' 카테고리의 다른 글

linux java process 찾기, java 실행  (0) 2020.01.31
리눅스 PC에 백업  (0) 2019.07.26
Ubuntu 단축키  (0) 2019.04.26
시스템 관련  (0) 2019.04.23
Linux 명령어  (0) 2019.03.29
반응형
hostname -I ip addr show /sbin/ifconfig ip address 확인 (=ipconfig inWindows)
host ftp1.xumo.com
ping ftp1.xumo.com
domain에 해당하는 IP 찾기
nc -vz GB.internal.emp.lgsmartplatform.com 80

NetCat options
-v: Vebose(장황한, 상세한) 상세결과 출력
-z : Zero-I/O mode [used for scanning]
nc -h 하면 help message, 상세옵션 나옴
특정 서버에 특정 port로 접근이 되는지 확인할 때 사용
ping ping은 ICMP protocol이용하는 것으로 특정 port로 접근가능한지는 테스트못함,
ip layer를 통해 internet 연결이 되는지만 확인가능
tar czvf conory.tar.gz /home/conory
tar xzvf conory.tar.gz
압축할때
압축풀때
chmod 755 파일명 파일권한 변경
read=4, write=2, x=1
755 = 4+2+1, 4+0+1, 4+0+1
644 = 4+2+0, 4+0+0, 4+0+0
find -name 'webos.conf'
find / -name '*.conf'
find / -name 'ab*'
find / -name 'ab*' -type d
현재 디렉토리에서 webos.conf파일 찾기
root아래에서 즉, 전체 디렉토리에서 conf확장자를 가진 파일 찾기
전체 디렉토리에서 ab로 시작하는 파일 찾기
전체 디렉토리에서 ab로 시작하는 디렉토리 찾기
grep [option] [검색 문자열] [파일명]
grep -rc home_amazon 
grep -rl home_amazon 
grep CATALINA_OUT ./*.sh 
옵션
-c 검색할 문자열이 속한 행이 개수를 출력한다.
-H 파일 이름과 함께 출력을 한다.
-i 대소문을 구분하지 않고 출력을 한다.
-n 찾으려는 문자가 속해있는 행의 번호와 같이 출력 한다.
-r 현재 경로부터 하위경로까지 검색해서 출력을 한다.
-v 찾으려는 문자가 없는 행을 출력 한다.
-w 패턴 표현식을 하나의 단어로 취급하여 검색


폴더내 모든 파일에 대해 home_amazon 검색갯수 출력
폴더내 home_amazon이 들어있는 파일에 대해 그 리스트 출력
sh확장자를 가진 파일중에서 CATALINA_OUT을 검색

















ssh seongro@10.186.119.212
ssh seongro@10.186.119.212 -p1022
exit
ssh 연결
22번아닌 1022번포트로 연결할 때
연결종료
sudo minicom serial cable 연결
   

 

TFTP
sudo apt-get install xinetd tftp tftpd
sudo vi /etc/xinetd.d/tftp
service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /tftpboot disable = no per_source = 11 cps = 100 2 flags = IPv4 }
sudo mkdir /tftpboot ~$ sudo chmod 777 /tftpboot
~$ sudo /etc/init.d/xinetd restart
~$cd /tftpboot ~$ vi test.txt 아무런 문자열을 입력하고 저장한 후, VI 에디터를 종료합니다.
~$ cd /tmp // 임시 디렉토리로 이동
~$ tftp localhost // tftp 서버와 연결
tftp> get test.txt // test.txt 다운로드
Received 6 bytes in 0.0 seconds
tftp> quit
~$ ls -al // 다운 받은 파일 확인
합계 76 drwxrwxrwt 14 root root 4096 2009-05-25 13:35 . drwxr-xr-x 22 root root 4096 2009-05-25 13:30 .. drwxrwxrwt 2 root root 4096 2009-05-25 13:26 .ICE-unix -r--r--r-- 1 root root 11 2009-05-25 13:22 .X0-lock drwxrwxrwt 2 root root 4096 2009-05-25 13:22 .X11-unix drwx------ 2 jwjw jwjw 4096 2009-05-25 13:26 .esd-1000 drwx------ 2 jwjw jwjw 4096 2009-05-25 13:27 ssh-CxzfZm6269 -rw-r--r-- 1 jwjw jwjw 5 2009-05-25 13:35 test.txt -rw------- 1 root root 0 2009-05-25 13:22 tmp.btyMJW5940
~$ cat test.txt // 내용 출력 tftp로 전송할 파일

 

ps -> Process Status의 준말인가

대표적인 사용옵션: ps -ef     e는 모든 프로세스를, f는 full format으로 보여줘라는 뜻결과는 UID        PID  PPID  C STIME TTY          TIME CMD 순으로 정렬하여 나옴ps -ef | grep com.lge.ibis.crawler.watch.ViewershipCrawler | head -1 | awk '{print $2}' | xargs kill                -> 첫번째 행 process kill
ps -ef | grep com.lge.ibis.crawler.watch.ViewershipCrawler | head -2 | tail -1 | awk '{print $2}' | xargs kill    -> 두번째 행 process kill head -1은 첫번째 행까지head -2는 두번째 행까지 (즉 1행 + 2행)tail -1은 마지막 첫행tail -2은 마지막 첫행부터 2행까지


특정 port 번호를 사용하는 process (PID) 찾는 방법 3가지

  1. netstat -ntp | grep 50064  결과) tcp        0      0 ::ffff:165.244.145.18:50064 ::ffff:10.185.19.36:3310    ESTABLISHED 24664/java 
  2. lsof -i tcp:8080 -> Q2 sdpbat 계정으로 실행시 없는 명령어라 함 ㅠ
  3. fuser 8080/tcp -> Q2 sdpbat 계정으로 실행시 없는 명령어라 함 ㅠ

Crontab 

현재 사용자 [root@zetawiki ~]# crontab -l다른 사용자 [root@zetawiki ~]# crontab -l -u testuser직접등록 crontab -e작업삭제 crontab -r* * * * * 수행할 명령어 ┬ ┬ ┬ ┬ ┬ │ │ │ │ └───────── 요일 (0 - 6) (0 =일요일) │ │ │ └────────── 월 (1 - 12) │ │ └─────────── 일 (1 - 31) │ └──────────── 시 (0 - 23) └───────────── 분 (0 - 59)

  • * * * * * /root/every_1min.sh                        → 매 1분마다 /root/every_1min.sh 를 수행 (하루에 1440회[2])
  • 15,45 * * * * /root/every_30min.sh             → 매시 15분, 45분에 /root/every_30min.sh 를 수행 (하루에 48회[3])
  • */10 * * * * /root/every_10min.sh                → 10분마다 /root/every_10min.sh 를 수행 (하루에 144회[4])
  • 0 2 * * * /root/backup.sh                              → 매일 02:00에/root/backup.sh 를 수행 (하루에 1회)
  • 30 */6 * * * /root/every_6hours.sh              → 매 6시간마다 수행(00:30, 06:30, 12:30, 18:30)
  • 30 1-23/6 * * * /root/every_6hours.sh        → 1시부터 매 6시간마다 수행(01:30, 07:30, 13:30, 19:30)
  • 0 8 * * 1-5 /root/weekday.sh                        → 평일(월요일~금요일) 08:00
  • 0 8 * * 0,6 /root/weekend.sh                        → 주말(일요일, 토요일) 08:00

로그: /var/log/cron에 변경/수행 이력이 기록됨

00 09 * * * /home/ibs/crawler/watch/crawler.sh restart >> /home/ibs/logs/crontab.log 2>&1

00 02 * * * /usr/bin/find /home/ibs/crawler/crawler_daily_checker/log -name "*.log.201*" -atime +7(7일지난거) -exec rm -rf {}(find로 찾은 애들가리킴) \;(exec option의 끝을 표시하기 위해 \;써줌) &> /dev/null

 


sudo: 현재 계정에서 다른 계정의 권한만 빌려서 일회성으로 명령어 실행

su: 로그아웃하지 않고 다른 계정으로 전환

su -: 로그아웃하지 않고 다른 계정으로 전환 + 그 계정의 환경변수 적용 

sdpbat 으로 계정변경: sudo su - sdpbat , su - sdpbat

반응형

'etc > linux' 카테고리의 다른 글

linux java process 찾기, java 실행  (0) 2020.01.31
리눅스 PC에 백업  (0) 2019.07.26
Ubuntu 단축키  (0) 2019.04.26
시스템 관련  (0) 2019.04.23
troubleshooting  (0) 2019.04.02

+ Recent posts