'OS/linux'에 해당되는 글 22건

  1. 2024.04.03 crontab 에서 사용하는 값 정리
  2. 2023.11.30 Ubuntu 설치시 프로그램 및 환경 정리
  3. 2023.11.30 repo 명령으로 mirror repository 생성 후 repo sync 실패 할때
  4. 2023.09.22 repo mirror 만들기
  5. 2023.04.21 ubuntu kernel 낮은 버전으로 바꾸기
  6. 2023.03.21 subversion 수정 사항 지우기
  7. 2022.10.11 ubuntu 개발 환경
  8. 2022.05.23 외장 저장소 fstab 등록시 옵션 설정
  9. 2022.05.19 ubuntu 22.04 업데이트 후 git "sign_and_send_pubkey: no mutual signature supported" 에러 발생시
  10. 2022.05.06 linux 에서의 파일 타입

crontab 에서 사용하는 값 정리

OS/linux 2024. 4. 3. 23:39
반응형

cron 은 주기적으로 특정 작업을 스케쥴링하기 위해 리눅스에세 제공해 주는 명령으로

contab 을 통해 작업들을 설정한다.

 

editor 설정

crontab -e 실행시 select-editor 명령이 호출되어 editor 설정된다.

editor를 바꾸고 싶을때는 select-editor 를 실행 하거나 ~/.selected_editor 의 SELECTED_EDITOR 의 값을 바꾼다.

select-editor 명령 실행시 원하는 editor가 없을 경우에는 SELECTED_EDITOR 값을 변경하자.

 

crontab -e 명령을 실행하면 다음과 같은 형식으로 값을 사용하면 된다.

m h  dom mon dow   command

field          allowed values
-----          --------------
minute         0–59
hour           0–23
day of month   1–31
month          1–12 (or names, see below)
day of week    0–7 (0 or 7 is Sun, or use names)

(Manual page crontab(5))

 

사용 예는 다음과 같다

The following lists an example of a user crontab file.    
    
# use /bin/bash to run commands, instead of the default /bin/sh    
SHELL=/bin/bash    
# mail any output to `paul', no matter whose crontab this is    
MAILTO=paul    
#    
# run five minutes after midnight, every day    
5 0 * * *       $HOME/bin/daily.job >> $HOME/tmp/out 2>&1    
# run at 2:15pm on the first of every month — output mailed to paul    
15 14 1 * *     $HOME/bin/monthly    
# run at 10 pm on weekdays, annoy Joe    
0 22 * * 1-5    mail -s "It's 10pm" joe%Joe,%%Where are your kids?%    
23 0-23/2 * * * echo "run 23 minutes after midn, 2am, 4am ..., everyday"    
5 4 * * sun     echo "run at 5 after 4 every Sunday"    
0 */4 1 * mon   echo "run every 4th hour on the 1st and on every Monday"    
0 0 */2 * sun   echo "run at midn on every Sunday that's an uneven date"    
# Run on every second Saturday of the month    
0 4 8-14 * *    test $(date +\%u) -eq 6 && echo "2nd Saturday"    
    
All the above examples run non-interactive programs.  If you wish to run a program that interacts with  the    
user's desktop you have to make sure the proper environment variable DISPLAY is set.    
    
# Execute a program and run a notification every day at 10:00 am    
0 10 * * *  $HOME/bin/program | DISPLAY=:0 notify-send "Program run" "$(cat)"

(Manual page crontab(5))

 

예약어도 사용할수 있다

string         meaning
------         -------
@reboot        Run once, at startup.
@yearly        Run once a year, "0 0 1 1 *".
@annually      (same as @yearly)
@monthly       Run once a month, "0 0 1 * *".
@weekly        Run once a week, "0 0 * * 0".
@daily         Run once a day, "0 0 * * *".
@midnight      (same as @daily)
@hourly        Run once an hour, "0 * * * *".

(Manual page crontab(5))

 

반응형
:

Ubuntu 설치시 프로그램 및 환경 정리

OS/linux 2023. 11. 30. 23:08
반응형

Ubuntu를 새로 깔면 기본적으로 해주는 것들

 

기본 프로그램

터미널 프로그램 - 창분할이 되어 탭보기 보다 편하다

sudo apt install terminator

원격 연결을 위한 ssh 서버 설치
sudo apt install openssh-server

sh가 dash 로 심볼릭 되어 있어 bash 로 바꿔줌
sudo ln -sf bash sh

시스템 리소스 모니터링용으로 설치
sudo snap install htop

ifconfig 쓸려고 설치
sudo apt install net-tools

ZSH 설치 - 터미널 작업을 할때 엄청난 효율 상승

zsh 을 설치한 후 oh-my-zsh 을 설치한다
sudo apt install zsh

깔린게 없어서 curl도 깔아주고
sudo snap install curl

curl 로 설치 파일 다운로드 후 설치

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

prompt 테마 설치 - 보기 좋은게 쓰기도 편하다

cd .oh-my-zsh/custom/themes
git clone https://github.com/romkatv/powerlevel10k.git

플러그인 설치하기

타이핑 조금 하면 이전에 실행한 명령을 보여준다

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

입력한 내용에 대한 색깔 입히기
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting

cd 명령 실행시 보다 편리한 사용, fzf 를 통해 리스트를 뿌려주고 이동할 디렉토리로 이동
git clone https://github.com/b4b4r07/enhancd.git $ZSH_CUSTOM/plugins/enhancd
cd .oh-my-zsh/custom/plugins
git clone https://github.com/arzzen/calc.plugin.zsh.git
sudo apt install fzf

cat 명령에 컬러를 입힌 명령
sudo apt install bat

ls 명령에 아이콘 출력 등 보기 좋게 바꾼 명령
sudo apt install ./lsd-musl_1.0.0_amd64.deb

폰트 설치

zsh을 사용하면서 결과를 정상적으로 보려면 nerd 폰치 설치가 필요함
git clone https://github.com/ryanoasis/nerd-fonts.git
cd nerd-fonts
./install.sh

D2Coding 폰트 설치 - 보기에 좋아서
.local/share/fonts/D2Coding-Ver1.3.2-20180524-all.ttc .

설치된 폰트 시스템에 적용 명령
fc-cache -fv

이모지가 보이도록 폰트 설치
sudo apt install fonts-emojione
sudo apt install fonts-noto-color-emoji

snippet 유틸(기존 설정 등)

massCode - 이런저런 메모들 저장, 최신 버전(다른 저장소에서 릴리즈) 보다 이 버전이 편한 느낌

https://github.com/antonreshetov/massCode/releases
chmod 755 massCode-1.3.1.AppImage

기존 저장 메모 유지
scp -r 백업서버IP:~/massCode .

브라우저 설치
sudo apt install ./google-chrome-stable_current_amd64.deb

개발툴 설치

neovim 설치(플러그인 따로 정리)

tar xvfz nvim-linux64.tar.gz
cd nvim-linux64/bin
cd .vim
mkdir bundle
cd bundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

소스 관리 툴 - git, repo
sudo apt install repo
sudo apt install python
sudo apt install python3
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
sudo apt install git

vscode 설치 - c++, java 를 주로 사용하는데 이거만한게 없다
sudo apt-get install wget gpg\nwget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg\nsudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg\nsudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'\nrm -f packages.microsoft.gpg
sudo apt install apt-transport-https

sudo apt update

sudo apt install code

리눅스 배포판, 버전에 따라 빌드 환경이 영향을 받는 걸 피하고 싶을때 docker 설치
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
sudo apt-get update

sudo apt-get install ca-certificates curl gnupg\nsudo install -m 0755 -d /etc/apt/keyrings\ncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg\nsudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \\n  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \\n  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \\n  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo docker run hello-world
sudo usermod -aG docker $USER

git diff 예쁘게 보기
chmod 755 diff-so-fancy

비교툴
sudo apt install ./bcompare-4.3.6.25063_amd64.deb

vim 플러그인에서 c 언어 참조용
sudo apt install libclang-dev

kotlin, java 개발용
tar xvfz ideaIC-2023.2.5.tar.gz

그외 유틸들

grep 개선 버전
sudo apt install ripgrep

find 개선 버전
sudo apt install fd-find

언제든 터미널 즉시 실행
sudo apt install guake

teams 설치
sudo snap install teams-for-linux

원격 데스크탑 설치
sudo apt install remmina

그놈 설정용 툴
sudo apt install gnome-tweaks

sudo apt install dconf-editor
sudo apt install gnome-shell-extension-manager
가상머신 - 가끔식 윈도우가 필요할때가 있다
sudo apt install ./virtualbox-7.0_7.0.12-159484\~Ubuntu\~jammy_amd64.deb

ssh를 통한 원격 파일시스템 마운트
sudo apt install sshfs

화면에서 gif 캡쳐 만들기
sudo apt install peek

온도 확인하기
sudo apt install lm-sensors

sudo apt install psensor

그림 그리기

sudo apt install gimp

반응형
:

repo 명령으로 mirror repository 생성 후 repo sync 실패 할때

OS/linux 2023. 11. 30. 22:33
반응형

repo init -u ssh://.... --mirror 으로 mirror 저장소 생성후 업데이트 실패 발생하였고

❯ repo sync -cj8
Fetching: 100% (988/988), done in 8.358s
info: A new version of repo is available
warning: repo is not tracking a remote branch, so it will not receive updates
fatal: GitCommandError: git command failure
    Project: repo
    Args: reset --keep v2.39^0
    Stdout:
None
    Stderr:
error: Entry '.github/workflows/test-ci.yml' not uptodate. Cannot merge.

 

.repo/repo 업데이트로 에러 해결함

❯ cd .repo/repo   
❯ git pull  
remote: Finding sources: 100% (68/68)
remote: Total 68 (delta 41), reused 68 (delta 41)
Unpacking objects: 100% (68/68), 78.81 KiB | 568.00 KiB/s, done.
From https://gerrit.googlesource.com/git-repo
   aadd12c..9f0ef5d  main       -> origin/main
Updating 1e9f7b9..b99272c
반응형
:

repo mirror 만들기

OS/linux 2023. 9. 22. 11:40
반응형

mkdir mirror
cd mirror
repo init -u REPO_ADDR -b BRANCH --mirror
repo sync -c

 

mirror 참조
repo init -u REPO_ADDR -b BRANCH --reference=MIRROR_DIR

반응형
:

ubuntu kernel 낮은 버전으로 바꾸기

OS/linux 2023. 4. 21. 22:44
반응형

ubuntu 에서 커널 버전을 바꿀때는 다음 순서로 진행한다.

 

변경할 커널 설치

sudo apt install linux-image-5.15.0-70-generic

 

grub 순서 변경

/etc/default/grub 파일에서 GRUB_DEFAULT="1>4" 로 변경

"1>4" 의 의미는 grub 메뉴에서 1(advanced, 두번째) 이동 후 4(5번째 항목) 선택으로

커널이 설치된 상황에 따라 값이 바뀔수 있다.(/boot/grub/grub.cfg)

 

grub 변경 사항 적용

sudo update-grub

 

부팅 후 드라이버가 정상적으로 동작하지 않는 현상 발생할 경우 아래 두 패키지를 추가로 설치

이미 설치된 경우 install 대신 reinstall 로 재설치함

sudo apt install linux-headers-5.15.0-70-generic
sudo apt install linux-modules-extra-5.15.0-70-generic

반응형
:

subversion 수정 사항 지우기

OS/linux 2023. 3. 21. 22:32
반응형

수정 사항 정리

svn revert -R .

 

새 파일 지우기

svn cleanup . --remove-unversioned

 

 

반응형
:

ubuntu 개발 환경

OS/linux 2022. 10. 11. 12:37
반응형

font - D2Coding 개발용으로 깔끔

mkdir ~/.local/share/fonts/Unknown\ Vendor/TrueType/D2Coding -p

cp D2Coding-Ver1.3.2-20180524-all.ttc ~/.local/share/fonts/Unknown\ Vendor/TrueType/D2Coding/D2Coding_Regular.ttc

 

cinnamon desktop 윈도우 환경과 비슷한 느낌으로 편함

 

chrome 브라우저

 

zshell 기본 shell을 zshell 로 변경 - 자동 완성 등 명령 치는 시간 엄청 단축

 

neovim 기존 vim 대신 사용

 

git

 

ssh

 

remmina 윈도우 remote desktop

 

docker 빌드용으로 ubuntu 버전과 상관 없이 동일 개발 환경 제공

 

pet 자주쓰는 명령어 저장 및 불러오기

 

terminator 창분할을 지원 하는 터미널

 

guake F11 키를 입력하면 터미널 즉시 실행

 

virtualbox 다른 os 테스트 용

 

android studio

 

cherrytree 노트용

 

startup command /etc/rc.local 파일에 있는 명령을 부팅 시 자동 실행함

cat /etc/rc.local

#! /bin/bash

 

diff-so-fancy

https://github.com/so-fancy/diff-so-fancy

sudo npm -g install diff-so-fancy

반응형
:

외장 저장소 fstab 등록시 옵션 설정

OS/linux 2022. 5. 23. 22:10
반응형

defaults로 적용시 외장 저장소 연결이 되어 있지 않을 경우 mount  실패로 부팅 지연 또는 실패 발생함

$ man mount
		defaults
           Use the default options: rw, suid, dev, exec, auto, nouser, and async.

           Note that the real set of all default mount options depends on the kernel and filesystem type. See the
           beginning of this section for more details.

auto 옵션에 의해 발생하는 현상으로 연결이 바뀌는 외장 저장소의 경우에는 noauto로 설정하면 부팅시 영향 받지 않음

$ man mount
		noauto
           Can only be mounted explicitly (i.e., the -a option will not cause the filesystem to be mounted).

예제(fstab)


UUID=aaaaa-bbbb /home/testuser/hdd_home           ext4    rw,suid,dev,exec,noauto,nouser,async        0       2

부팅 후 sudo mount ~/hdd_home

반응형
:

ubuntu 22.04 업데이트 후 git "sign_and_send_pubkey: no mutual signature supported" 에러 발생시

OS/linux 2022. 5. 19. 22:20
반응형

 

git pull
sign_and_send_pubkey: no mutual signature supported

 

~/.ssh/config 파일에 "PubkeyAcceptedKeyTypes +ssh-rsa" 추가

host test.test.com
 HostName test.test.com
 IdentityFile ~/.ssh/id_rsa_git
 PubkeyAcceptedKeyTypes +ssh-rsa
 User git
반응형
:

linux 에서의 파일 타입

OS/linux 2022. 5. 6. 15:36
반응형
#define S_IFMT  00170000    
#define S_IFSOCK 0140000    
#define S_IFLNK  0120000    
#define S_IFREG  0100000    
#define S_IFBLK  0060000    
#define S_IFDIR  0040000    
#define S_IFCHR  0020000    
#define S_IFIFO  0010000    
#define S_ISUID  0004000    
#define S_ISGID  0002000    
#define S_ISVTX  0001000    
    
#define S_ISLNK(m)  (((m) & S_IFMT) == S_IFLNK)    
#define S_ISREG(m)  (((m) & S_IFMT) == S_IFREG)    
#define S_ISDIR(m)  (((m) & S_IFMT) == S_IFDIR)    
#define S_ISCHR(m)  (((m) & S_IFMT) == S_IFCHR)    
#define S_ISBLK(m)  (((m) & S_IFMT) == S_IFBLK)    
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)    
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)

/usr/include/linux/stat.h

반응형
: