which (명령어의 경로를 확인한다.)




which

명령어의 경로를 확인하는 명령어이다.
리눅스에서 명령어의 경로와 도움말에 대한 명령어는 which, whereis, whatis, man, find등이 있다. 이중에서 명령어의 경로를 확인하는 가장 일반적인 명령어가 which이다.
흔히 호스팅서버등에서 perl의 경로를 찾는 방법으로 "which perl"과 같은 형태로 사용한다.

사용형식

which [options] [--] programname [...]

사용예 #1

간단히 perl의 경로를 확인하고자 한다면 다음과 같이 한다.

[root@host1 commmand]# which perl
/usr/bin/perl
[root@host1 commmand]#

즉, perl의 경로를 확인코자한다면 "which perl"이라고만 하면 된다.

다음은 netstat이라는 명령어의 명령어 경로를 확인한 것이다.

[root@host1 commmand]# which netstat
/bin/netstat
[root@host1 commmand]#


사용예 #2

이번에는 웹서버나 호스팅서버에서 사용자들이 자주 찾는 명령어 경로를 확인하는 예이다.

[root@host1 commmand]# which sendmail
/usr/sbin/sendmail
[root@host1 commmand]#
[root@host1 commmand]# which find
/usr/bin/find
[root@host1 commmand]#
[root@host1 commmand]# which telnet
/usr/bin/telnet
[root@host1 commmand]#
[root@host1 commmand]# which ssh
/usr/bin/ssh
[root@host1 commmand]#
[root@host1 commmand]# which ftp
/usr/bin/ftp
[root@host1 commmand]#

위의 예는 차례대로 sendmail, find, telnet, ssh, ftp의 명령어 경로를 확인한 예이다.

which 명령어에도 다른 명령어들과 마찬가지로 여러가지 옵션들이 있으나 실무에서는 거의 사용하지 않는 것들이다. 따라서 which 명령어의 설명에서 옵션 사용의 예는 생략하도록 하겠다.


크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2004/03/24 11:25 2004/03/24 11:25
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/190

whereis

명령어의 실행파일위치, 소스위치, man페이지파일위치를 찾아주는 명령어이다.
명령어의 위치만을 찾아주는 which에 비해 명령어와 관련된 파일들을 모두 찾아주므로 보다 포괄적인 명령어위치 탐색명령어라고 이해하면 좋겠다.

그리고 whereis는 특별히 지정된 경로가 없다면 기본적으로 다음의 경로를 바탕으로 탐색한다.

/bin
/usr/bin
/etc
/usr/etc
/sbin
/usr/sbin
/usr/games
/usr/games/bin
/usr/emacs/etc
/usr/lib/emacs/19.22/etc
/usr/lib/emacs/19.23/etc
/usr/lib/emacs/19.24/etc
/usr/lib/emacs/19.25/etc
/usr/lib/emacs/19.26/etc
/usr/lib/emacs/19.27/etc
/usr/lib/emacs/19.28/etc
/usr/lib/emacs/19.29/etc
/usr/lib/emacs/19.30/etc
/usr/TeX/bin
/usr/tex/bin
/usr/interviews/bin/LINUX
/usr/bin/X11
/usr/X11/bin
/usr/X11R5/bin
/usr/X11R6/bin
/usr/X386/bin
/usr/local/bin
/usr/local/etc
/usr/local/sbin
/usr/local/games
/usr/local/games/bin
/usr/local/emacs/etc
/usr/local/TeX/bin
/usr/local/tex/bin
/usr/local/bin/X11
/usr/contrib",
/usr/hosts",
/usr/include",
/usr/g++-include",


사용형식

whereis [ -bmsu ] [ -BMS directory... -f ] filename ...

사용예 #1

whereis의 간단한 사용법으로서 "whereis 명령어" 또는 "whereis 파일이름"으로 탐색할 수 있다.

다음은 find명령어와 관련된 파일을 찾은 예이다.

[root@host3 command]# whereis find
find: /usr/bin/find /usr/share/man/man1/find.1.gz
[root@host3 command]#

다음은 perl명령어와 관련된 파일을 찾은 예이다.

[root@host3 command]# whereis perl
perl: /usr/bin/perl /usr/share/man/man1/perl.1.gz
[root@host3 command]#


사용예 #2

whereis 명령어로 실행파일의 경로만을 확인하고자 할 때에는 -b옵션을 사용한다.
다음은 find 명령어의 실행파일 경로만을 확인하는 예이다.

[root@host3 command]# whereis -b find
find: /usr/bin/find
[root@host3 command]#

-b옵션을 사용하여 실행파일의 경로만을 확인할 때에는 which명령어와 거의 유사하다고 볼 수 있다.


사용예 #3

whereis 명령어로 명령어의 man페이지만을 확인하고자 할때에는 -m옵션을 사용한다.
다음은 find명령어의 man페이지위치를 확인하는 예이다.

[root@host3 command]# whereis -m find
find: /usr/share/man/man1/find.1.gz
[root@host3 command]#


이외에도 잘 사용하지는 않지만 whereis의 옵션에는 다음과 같은 것들이 있다.


-s 명령어의 소스만 찾는다.

-B 명령어의 실행파일을 찾을 경로를 지정하여 탐색한다.

-M 명령어의 매뉴얼 페이지를 찾을 경로를 지정하여 탐색한다.

-S 명령어의 소스파일을 찾을 경로를 지정하여 탐색한다.



크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2004/03/24 11:25 2004/03/24 11:25
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/189

w

서버에 접속한 사용자의 접속정보 및 작업정보확인하는 명령어이다.

w명령어는 일반사용자보다는 서버관리자가 주로 사용하는 명령어이다.
물론 일반사용자들도 누가 시스템에 접속해 있는가를 확인하기 위해서 w명령어를 사용하는 경우도 종종 있으나 서버관리차원에서 관리자가 주로 사용한다.


사용형식

w - [husfV] [user]

사용예 #1

다음은 간단히 w를 실행한 예이다.
위에서 설명한 것과 같이 여러가지 정보들을 확인할 수 있다.

[root@host3 root]# w
11:46pm up 10:17, 5 users, load average: 0.04, 0.09, 0.08
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 192.168.0.2 6:39pm 0.00s 0.38s 0.01s w
root :0 - 2:41pm ? 0.00s ? -
root pts/1 - 2:42pm 9:04m 0.00s ? -
bible1 pts/2 192.168.0.202 11:46pm 46.00s 0.05s 0.05s -bash
bible2 pts/3 192.168.0.111 11:46pm 1.00s 0.05s 0.05s -bash
[root@host3 root]#

위의 결과를 보면 현재 5명의 사용자가 로그인해 있으며 외부에서 로그인한 사용자는 3명이다.
즉, 192.168.0.2에서 root가 로그인하여 w명령어를 실행하였으며,
192.168.0.202에서 bible1이라는 사용자가 로그인하여 쉘명령어 상태이며,
192.168.0.111에서 bible2라는 사용자가 로그인하여 쉘명령어 상태에 있다.

이렇게 w 명령어는 로컬또는 원격지에서 접속한 사용자정보를 확인할때에 주로 사용한다.


사용예 #2

-h 옵션을 사용하면 head정보를 출력하지 않는 좀 더 간단한 정보를 보여준다.
즉, 앞의 예에서 보았던 head정보(uptime정보와 필드제목정보)를 보여주지 않는다.

[root@host3 root]# w -h
root pts/0 192.168.0.2 6:39pm 0.00s 0.39s 0.02s w -h
root :0 - 2:41pm ? 0.00s ? -
root pts/1 - 2:42pm 9:14m 0.00s ? -
bible1 pts/2 192.168.0.202 11:46pm 10:45 0.05s 0.05s -bash
bible2 pts/3 192.168.0.111 11:46pm 10:00 0.05s 0.05s -bash
[root@host3 root]#

사용예 #3

위의 "사용예 #2"은 head정보를 생략하였으나 출력되는 필드정보(login time정보, JCPU, PCPU정보를 생략함)를 생략하여 간략히 보여주는 옵션은 다음 예와 같이 -s이다.

[root@host3 root]# w -s
11:59pm up 10:29, 5 users, load average: 0.06, 0.11, 0.09
USER TTY FROM IDLE WHAT
root pts/0 192.168.0.2 0.00s w -s
root :0 - ? -
root pts/1 - 9:16m -
bible1 pts/2 192.168.0.202 13:04 -bash
bible2 pts/3 192.168.0.111 12:19 -bash
[root@host3 root]#

위의 결과 -s옵션을 사용하면 login정보, JCPU, PCPU정보를 생략하여 결과를 표시한다.


사용예 #4

이번에는 -f옵션을 사용하여 FROM필드의 값(접속 IP주소정보)을 생략하여 표시하는 예를 보도록 하자.

[root@host3 root]# w -f
12:02am up 10:32, 5 users, load average: 0.14, 0.10, 0.09
USER TTY LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 6:39pm 0.00s 0.42s 0.02s w -f
root :0 2:41pm ? 0.00s ? -
root pts/1 2:42pm 9:19m 0.00s ? -
bible1 pts/2 11:46pm 15:53 0.05s 0.05s -bash
bible2 pts/3 11:46pm 15:08 0.05s 0.05s -bash
[root@host3 root]#

위의 결과를 보다시피 -f옵션을 사용하면 FROM필드의 정보가 생략되어 보여진다.

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2004/03/24 11:23 2004/03/24 11:23
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/188

locate, slocate

다양한 패턴의 파일들을 찾고자 할때 사용하는 명령어입니다. 특정명령어를 찾고자할때에는 find나 which, whereis등을 사용하면 됩니다.

사용형식

slocate [-qi] [-d ] [--database=]
slocate [-i] [-r ] [--regexp=]
slocate [-qv] [-o ] [--output=]
slocate [-e ] [-f ] <[-l ] [-c] <[-U ] [-u]>
slocate [-Vh] [--version] [--help]


사용예 #1

현재 시스템에 존재하는 *.bak에 해당하는 파일을 찾은 예입니다.
*.bak파일을 찾아서 불필요한 파일을 삭제하고자 할때에 사용한 예입니다.

[root@host3 root]# locate *.bak
/var/lib/nfs/statd/sm.bak
/root/.mozilla/default/zlm8ufid.slt/prefs.bak
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Filter/cpp.pm.bak
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Filter/exec.pm.bak
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Filter/sh.pm.bak
/usr/local/lib/php.ini-zend_optimizer.bak
[root@host3 root]#


사용예 #2

다음은 10개의 *.conf파일만을 찾은 예입니다.
실제로 시스템에는 *.conf파일이 수없이 많이 존재하므로 한 페이지에 모두 볼 수가 없는 까닭으로 갯수를 지정한 것입니다.

[root@host3 root]# locate -n 10 *.conf
/boot/grub/grub.conf
/var/ftp/etc/ld.so.conf
/etc/X11/gdm/factory-gdm.conf
/etc/X11/gdm/gdm.conf
/etc/modules.conf
/etc/host.conf
/etc/nsswitch.conf
/etc/ld.so.conf
/etc/fonts/fonts.conf
/etc/esd.conf
[root@host3 root]#



크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2004/03/24 11:20 2004/03/24 11:20
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/187

ab

ab는 “Apache HTTP server Benchmarking tool”의 약어로서 아파치서버의 응답속도를 측정하는 밴치마킹툴입니다.

ab라는 툴을 이용하여 아파치의 응답속도를 테스트하고 그 결과를 다양한 방면으로 확인할 수 있습니다.



사용형식

ab [ -k ] [ -i ] [ -n 요청수 ] [ -t 시간제한 ] [ -c 동시접속 ] [ -p POST file ] [ -A 인증 유저이름:패스워드 ] [ -P 프락시인증 유저이름:패스워드 ] [ -H Custom header ] [ -C Cookie name=value ] [ -T content-type ] [ -v verbosity ] ] [ -w HTML 출력 ] ] [ -x 속성 ] ] [ -y 속성 ] ] [ -z 속성 ] [http://]서버이름[:port]/path

ab [ -V ] [ -h ]



사용예 #1

–V를 사용하시면 설치되어 있는 ab의 버전을 확인하실 수있습니다. 아래 결과는 현재 필자가 사용하고 있는 ab의 버전이 2.0.40이라는 것을 표시하고 있습니다.

[root@host3 bin]# ab -V
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.116 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

[root@host3 bin]#



사용예 #2

수퍼유저코리아(www.superuser.co.kr)의 응답속도를 측정한 것입니다. 참고로 사이트URL의 마지막에는 반드시 "/"가 들어가야함에 주의하시기 바랍니다. 여기서 사용한 옵션 -n은 측정을 위한 웹페이지 요청수를 의미합니다. 즉 "-n 1"이라고 한 것은 지정한 URL을 한번의 요청만으로 결과를 표시한다는 의미입니다.

[root@host3 bin]# ab -n 1 http://www.superuser.co.kr/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.116 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking www.superuser.co.kr (be patient).....done


Server Software: Apache/2.0
Server Hostname: www.superuser.co.kr
Server Port: 80

Document Path: /
Document Length: 458 bytes

Concurrency Level: 1
Time taken for tests: 1.499567 seconds
Complete requests: 1
Failed requests: 0
Write errors: 0
Total transferred: 700 bytes
HTML transferred: 458 bytes
Requests per second: 0.67 [#/sec] (mean)
Time per request: 1499.567 [ms] (mean)
Time per request: 1499.567 [ms] (mean, across all concurrent requests)
Transfer rate: 0.00 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 17 17 0.0 17 17
Processing: 1482 1482 0.0 1482 1482
Waiting: 1481 1481 0.0 1481 1481
Total: 1499 1499 0.0 1499 1499
[root@host3 bin]#



사용예 #3

다음과 같이 -c옵션을 사용하면 한번에 수행할 다중 요구수를 지정할 수 있습니다. 지정하지 않는다면 기본값은 1이 됩니다. 테스트시에 –c 30이라고 주었으며, 결과를 보시면 “concurrency Level 30”이라는 것을 보실 수 있을 것입니다. 즉, 동시에 다중세션을 테스트한 것이며 그 결과를 확인 할 수 있습니다. 결과값의 분석은 앞에 설명된 내용과 비교하면서 보시기 바랍니다.

[root@host3 bin]# ab -c 30 http://www.yahoo.com/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.116 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking www.yahoo.com (be patient).....done


Server Software:
Server Hostname: www.yahoo.com
Server Port: 80

Document Path: /
Document Length: 32247 bytes

Concurrency Level: 30
Time taken for tests: 1.75287 seconds
Complete requests: 1
Failed requests: 0
Write errors: 0
Total transferred: 32600 bytes
HTML transferred: 32247 bytes
Requests per second: 0.93 [#/sec] (mean)
Time per request: 32258.610 [ms] (mean)
Time per request: 1075.287 [ms] (mean, across all concurrent requests)
Transfer rate: 28.83 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 208 208 0.0 208 208
Processing: 866 866 0.0 866 866
Waiting: 219 219 0.0 219 219
Total: 1074 1074 0.0 1074 1074
root@host3 bin]#


크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2004/03/24 11:02 2004/03/24 11:02
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/186

참회보다 어려운 것

신 앞에서 참회하는 것보다
나 자신과 사람들 앞에서 자신을 공개하는 일이
더 어렵다. 자신이 가지고 있는 나약함과 허점, 실수 등을
스스로 공개하고 인정하기 위해서는
대단한 용기가 필요하다.



- 다닐 알렉산드로비치 그라닌의
《시간을 정복한 남자 류비셰프》중에서 -



* 누구나 처음 드러내는 것에 대한 두려움이 있습니다.
사랑하는 사람 앞에서 자신의 맨 몸을 처음 드러낼 때,
사랑과 믿음의 눈으로 지켜봐 주는 다수의 사람 앞에서
자기 마음을 처음 열어 보일 때, 떨림과 두려움이 큽니다.
그러나 그 떨림과 두려움의 강을 넘어서야 비로소
지속 가능한 사랑과 믿음을 오래
이어갈 수 있습니다.
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2004/03/24 09:13 2004/03/24 09:13
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/606

홈페이지 백업 방법(웹호스팅)

퍼미션 재설정할 필요없이 한꺼번에 압축하고 풀기...

웹호스팅을 받다보면 개인 서버가 아니기 때문에 백업 하고 복구가 쉽지가
않은데 이 방법을 다들 아시겠지만.....

텔넷 접속하면 html 폴더가 있을 겁니다. 여기서 html을 통째로 압축해 보겠습니다.

[압축]
# tar cvfzp nanum.tar.gz html
[풀기]
# tar xvfzp nanum.tar.gz
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2004/03/24 09:08 2004/03/24 09:08
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/185


블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2004/03   »
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Statistics Graph

Site Stats

Total hits:
181110
Today:
198
Yesterday:
186