Linux 47

[ Linux ] fallocate 명령어 (임의크기 파일 만들기 명령어)

백업 등 특정 파일을 가지고 테스트를 해볼 때, fallocate 명령어는 유용하게 사용할 수 있다. 생성된 파일내용은 없으며, 크기만 할당된다. 1. 10Byte 크기의 파일을 생성하기 $ fallocate -l 10 file # -l : 지정한 크기만큼의 용량의 파일 만들기 (Byte) $ ls -l file .... .... 10 Feb 27 15:30 file $ fallocate -l 10k file # 10 kilo Bytes $ fallocate -l 10m file # 10 Mega Bytes $ fallocate -l 10g file # 10 Giga Bytes

[ CentOS 7 ] freetds를 이용하여 MSSQL에 연결

freetds : MSSQL과 통신을 할 수 있는 리눅스 라이브러리 패키지 설치 # yum install freetds unixODBC /etc/freetds.conf 수정 [mssql] host = x.x.x.x Port = 1433 tds version = 8.0 tsql을 이용하여 접속 테스트 # tsql -S 'x.x.x.x' -U sa Password: locale is "en_US.UTF-8" locale charset is "UTF-8" using default charset "UTF-8" 1> select @@version 2> go Microsoft SQL Server 2012 .....

[ CentOS ] python3로 변경 후 YUM 실행시 SyntaxError: invalid syntax 원인과 해결 방법

python3로 업그레이드 한 후 YUM을 실행했을 때, 에러가 발생하였다. 원인 /usr/bin/yum의 파일을 열어보니, import yum을 하였을시 예외처리가 되어 있었다. python3에는 모듈이 없나보다. #!/usr/bin/python import sys try: import yum except ImportError: print >> sys.stderr, """\ There was a problem importing one of the Python modules required to run yum. The error leading to this problem was: %s Please install a package which provides this module, or verify that..

CentOS 7 포트를 사용하는 데몬(프로세스)명 확인하기

예를 들어 서버에서 631포트가 LISTEN 상태로 되어 있고, 어떤 데몬(프로세스)가 사용하고 있는지 확인 netstat 명령어로 포트와 사용하는 프로세스 확인 # netstat -tnlp | egrep ':631' tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1382/cupsd tcp6 0 0 ::1:631 :::* LISTEN 1382/cupsd - cupsd : Common UNIX Printing System (프린터 서버) pstree 명령어로 프로세스 상관관계 확인 (pstree가 설치되어 있지 않으면, yum -y install psmisc으로 설치) # pstree systemd─┬─ModemManager───2*[{ModemManager}] ├─NetworkMa..

Linux/Security 2019.12.11

[리눅스 명령어] tee 표준입력으로부터 표준출력과 파일로 저장

어떤 명령어의 결과를 표준출력과 파일 저장을 같이 하고 싶을 때, 사용하는 명령어의 결과를 로깅파일로 만들 때, 유용하다. 실행결과를 표준출력과 파일로 저장 $ echo 'this is tee command' | tee tee.log this is tee command $ cat tee.log this is tee command 실행결과를 표준출력과 파일로 저장. ( -a 옵션을 사용하여 append(추가하기)) $ echo 'this is tee command1' | tee -a tee.log this is tee command1 $ echo 'this is tee command2' | tee -a tee.log this is tee command2 $ cat tee.log this is tee com..