Data Base/Linux

231201 Linux 명령어2

잇꼬 2023. 12. 1. 17:22
728x90
반응형
SMALL
명령어 해석 코드
timedatectl 현재 date, timezone 확인 [root@centos ~]# timedatectl
timezone timezone 정보확인 [root@centos ~]# timedatectl list-timezones
[root@centos ~]# timedatectl list-timezones | more
set-timezone timezone 정보 변경 [root@centos ~]# timedatectl set-timezones "Asia/Seou"
cal 달력 확인 [user1@centos ~]$ cal                → 현재 달력
[user1@centos ~]$ cal 2023       → 2023년 달력 
[user1@centos ~]$ cal 12 2023  → 2023년 12월 달력 
redirection
>>
파일 없음→파일생성
파일 존재→뒤에 붙이기

파일 생성
파일 존재→ 덮어쓰기
화면에 출력되는 결과를
파일로 저장
[user1@centos ~]$ ls -al > output_ls
[user1@centos ~]$ ls -l > output_ls
[user1@centos ~]$ cat output_ls
[user1@centos ~]$ cat .bash_profile >> output_ls
[user1@centos ~]$ cat output_ls
wc 파일 안의 단어의 갯수 또는
라인 수를 출력
[user1@centos ~]$ wc output_ls
 23 119 722 output_ls
--- --- ----------------
  1   2    3
라인 단어  문자 의 수
wc -l 라인수 출력 [user1@centos ~]$ wc -l output_ls
23 output_ls
wc -w 단어수를 출력 [user1@centos ~]$ wc -w output_ls
119 output_ls
wc -c 문자수를 출력 [user1@centos ~]$ wc -c output_ls
722 output_ls
grep 파일 안에 포함된 특정 단어나 구문을 검색 [user1@centos ~]$ grep 'Asia' timezone_name 
grep -i 대소문자를 구분하지 않음 [user1@centos ~]$ grep 'seoul' timezone_name : 확인불가
[user1@centos ~]$ grep -i 'seoul' timezone_name
Asia/Seoul
cp 파일 복사 [user1@centos test1]$ cp ex2.txt ~/test2
[user1@centos test1]$ ls ~/test2
ex1.txt ex2.txt
cp ~/상대경로/* 전체 파일 복사 [user1@centos ~]$ cp ~/test1/* ~/test3 <- 전체 복사
[user1@centos ~]$ ls ~/test3
ex1.txt  ex2.txt ex3.txt
cp -v 복사하는 내용을 화면 출력 [user1@centos ~]$ cp -v /etc/bashrc ~/test2
‘/etc/bashrc’ -> ‘/home/user1/test2/bashrc’
cp -r 기존 디렉터리를 새로운 디렉터리로 복사 [user1@centos ~]$ cp -rv ~/test1 ~/test4
‘/home/user1/test1’ -> ‘/home/user1/test4’
‘/home/user1/test1/exl.txt’ -> ‘/home/user1/test4/exl.txt’
‘/home/user1/test1/ex2.txt’ -> ‘/home/user1/test4/ex2.txt’
‘/home/user1/test1/ex3.txt’ -> ‘/home/user1/test4/ex3.txt’
cp -i 복사될 파일 이름이 이미 존재하는 경우, 사용자에게 덮어 쓰기 여부를 묻는 옵션  [user1@centos ~]$ cp -iv ~/test1/ex1.txt ~/test2
cp: overwrite ‘/home/user1/test2/ex1.txt’? y
‘/home/user1/test1/ex1.txt’ -> ‘/home/user1/test2/ex1.tx
cp -b 복사될 파일 이름이 이미 존재하는 경우, 백업파일을 생성 [user1@centos ~]$ cp -bv ~/test1/ex1.txt ~/test2
‘/home/user1/test1/ex1.txt’ -> ‘/home/user1/test2/ex1.txt’ (backup: ‘/home/user1/test2/ex1.txt~’)
[user1@centos ~]$ ls ~/test2
bashrc  ex1.txt  ex1.txt~  ex2.txt
cp -f 복사될 파일 이름이 이미 존재하는 경우, 덮어쓰기 [user1@centos ~]$ cp -fv ~/test1/ex1.txt ~/test2
‘/home/user1/test1/ex1.txt’ -> ‘/home/user1/test2/ex1.txt’

 

728x90
반응형
LIST

'Data Base > Linux' 카테고리의 다른 글

231205 Linux JAVA 설정  (1) 2023.12.05
231204 Linux 사용자 계정 관리  (2) 2023.12.04
231201 Linux vi(visual editor), 커서 이동  (0) 2023.12.01
231130 Linux 명령어1  (7) 2023.11.30
231130 Linux 설치  (2) 2023.11.30