본문 바로가기

명령어12

Unix Wildcards Gone Wild Back To The Future: Unix Wildcards Gone Wild============================================ - Leon Juranic - Creation Date: 04/20/2013 - Release Date: 06/25/2014 Table Of Content: ===[ 1. Introduction ===[ 2. Unix Wildcards For Dummies ===[ 3. Wildcard Wilderness ===[ 4. Something more useful... 4.1 Chown file reference trick (file owner hijacking) 4.2 Chmod file reference trick 4.3 Tar arbitrary c.. 2014. 8. 28.
lsof , fuser, pgrep 명령어 정리 lsof 정리일반적으로 시스템에서 동작하고 있는 모든 프로세스에 의해서 열리어진 파일들에 관한 정보를 보여주는 시스템 관리 명령어 1. lsof 파일명지정한 파일을 엑세스 하고 있는 프로세스의 정보를 보여준다.# lsof /usr/sbin/proftpd COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME proftpd 647 nobody txt REG 8,2 433516 209221 /usr/sbin/proftpd 2. lsof /tmp지정한 디렉토리를 엑세스 하고 있는 프로세스의 정보를 보여준다.# lsof /tmp COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME libhttpd. 27187 root 3u REG 7,0 0 13 /tm.. 2014. 5. 29.
AWK 명령어 기초 (두개 텍스트 파일 조건 합치기) AWKawk는 직접 사용자로부터 입력을 받거나 아니면 지정한 파일을 가공하여 표준 출력한다 표준 출력을 리다이렉션할 수 있다 사용법awk [옵션] '스크립트' [-v 변수=값] [파일(들)]awk [옵션] -f 스크립트 파일 [-v 변수=값] [파일(들)]cf) 편집 스크립트 파일의 사용법ed : ed -s(script) sourcefile outputfileawk : awk -f(file) scriptfile sourcefile > outputfile옵션-Fc : field separator 지정c는 필드 사이를 구분하는 구분자이다 직접 지정하지 않으면 공백을 기준으로 한다 시스템 변수 FS를 지정하는 것.. 2012. 10. 15.
Bash: Pass Shell Variables To awk How do I pass shell variables to awk command or script under UNIX like operating systems? The -v option can be used to pass shell variables to awk command. Consider the following simple example, root="/webroot" echo | awk -v r=$root '{ print "shell root value - " r}' In this example search file using awk as follows: #!/bin/bash # Usage : Search word using awk for given file. # Syntax: ./script ".. 2012. 7. 18.
awk 명령어 필드구분 및 필드수 1. awk 필드를 구분하는 방법은 두가지이다. 하나는 FS를 세팅해주는 방법이고, 하나는 -F옵션을 통해 주는 방법이다. 주로 FS로는 여러가지 seperator를 설정하고 -F로는 하나의 seperator를 설정한다. FS를 세팅할땐, awk 'BEGIN { FS = ", \t" } ; { print $2 }' -> makes every area of an input line that consists of a comma followed by a space and a TAB into a field separator. 이렇게 설정이 가능하나, -F로 설정할 땐 quoting없이 -F\t 로 세팅하면 안된다, \가 쉘에서 다음 라인으로 이어진다는걸 의미하기 때문에 escape character 이기 때문에.. 2012. 6. 29.