Unix.Linux

Linux 사용하기 위한 필수 명령어

누피짱 2009. 9. 11. 17:07
이번에는 명령어 사용법에 대해 소개해 드리도록 하겠습니다.

기본적으로 사용가능한 명령어는 다음과 같습니다.

 chmod  cp  gzip  ls  mkdir  mv  pwd  rm  tar lftp svn unzip wget cd

모든 명령어는 [명령어 --help]  라고 치시면 사용법을 확인하실수가 있습니다.

  [~]$ ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all                  do not ignore entries starting with .
  -A, --almost-all           do not list implied . and ..
      --author               with -l, print the author of each file
  -b, --escape               print octal escapes for nongraphic characters

----------이하 생략 --------



1. pwd
 - 현재 위치를 확인하실수 있습니다.

 [public_html]$ pwd
/ssh/public_html

2. ls
- 디렉토리의 파일 리스트를 확인하실수 있습니다.
 [public_html]$ ls
365managed  index.html

[public_html]$ ls -al
total 16
drwxr-xr-x 3 660 100 4096 Apr 11 08:52 .
drwx-----x 5 660 100 4096 Apr 11 08:59 ..
drwxr-xr-x 4   0   0 4096 Apr 11 08:52 365managed
-rw-r--r-- 1 660 100  399 Apr 11 08:52 index.html

3. cd
 - 작업디렉토리를 이동합니다.
 [public_html]$ cd ..
[~]$ ls
365backup  public_html
[~]$ cd public_html/
[public_html]$ ls
365managed  index.html
[public_html]$

4. mv
 - 디렉토리 혹은 파일을 이동합니다.

 [~]$ mv xe_full.1.2.1.zip public_html/
[~]$ cd public_html/
[public_html]$ ls
365managed  index.html  xe_full.1.2.1.zip

5. unzip
 - zip 파일 압축을 해제 합니다.

 [public_html]$ unzip xe_full.1.2.1.zip
 inflating: xe/widgetstyles/memo/img/widgetBoxIyellow.png
  inflating: xe/widgetstyles/memo/img/widgetBoxIgreen.gif
  inflating: xe/widgetstyles/memo/img/widgetBoxIgreen.png
  inflating: xe/widgetstyles/memo/img/widgetBoxIred.png
  inflating: xe/widgetstyles/memo/img/widgetBoxIyellow.gif
  inflating: xe/widgetstyles/memo/img/widgetBoxIblue.gif
  inflating: xe/widgetstyles/memo/img/widgetBoxIblue.png
-- 이하 생략 --
[public_html]$ ls
365managed  index.html  xe  xe_full.1.2.1.zip
[public_html]$ ls xe/
LICENSE  classes  config     layouts  modules  widgetstyles
addons   common   index.php  libs     widgets

6. cp
 - 파일 또는 디렉토리를 복사합니다.

[public_html]$ ls
365managed  index.html  xe  xe_full.1.2.1.zip
[public_html]$ cp -arpf xe xe.ori
[public_html]$ ls
365managed  index.html  xe  xe.ori  xe_full.1.2.1.zip
[public_html]$ ls xe
LICENSE  classes  config     layouts  modules  widgetstyles
addons   common   index.php  libs     widgets
[public_html]$ ls xe.ori/
LICENSE  classes  config     layouts  modules  widgetstyles
addons   common   index.php  libs     widgets

7. rm
 - 원하는 파일 또는 디렉토리를 삭제합니다.

[public_html]$ ls
365managed  index.html  xe  xe.ori  xe_full.1.2.1.zip
[public_html]$ rm -rf xe
[public_html]$ ls
365managed  index.html  xe.ori  xe_full.1.2.1.zip

8. tar
 - 압축파일을 만들거나 압축을 해제합니다.

 [~]$ ls
365backup           public_html        xe_full.1.2.1.zip
gnuboard4.utf8.tgz  xe_full.1.2.1.tgz
[~]$ ls public_html/
365managed  index.html

[~]$ tar zxvf gnuboard4.utf8.tgz -C public_html/
gnuboard4.utf8/cheditor/insert_image.php
gnuboard4.utf8/cheditor/patterns/
gnuboard4.utf8/cheditor/patterns/thumbnail/
gnuboard4.utf8/cheditor/patterns/thumbnail/flowers.gif
gnuboard4.utf8/cheditor/patterns/thumbnail/gray.jpg
gnuboard4.utf8/cheditor/patterns/flowers.gif
gnuboard4.utf8/cheditor/patterns/gray.jpg
gnuboard4.utf8/cheditor/insert_hlink.php
-- 이하 생략 --

[~]$ ls public_html/
365managed  gnuboard4.utf8  index.html

9. chmod
 - 퍼미션을 변경을 위해 사용합니다.
 [public_html]$ ls -al
total 20
drwxr-xr-x  4 660 100 4096 Apr 11 09:49 .
drwx-----x  5 660 100 4096 Apr 11 09:39 ..
drwxr-xr-x  4   0   0 4096 Apr 11 08:52 365managed
drwx---r-x 14 660 100 4096 Feb  3 05:38 gnuboard4.utf8
-rw-r--r--  1 660 100  399 Apr 11 08:52 index.html
[public_html]$ chmod 707 gnuboard4.utf8/
[public_html]$ ls -al
total 20
drwxr-xr-x  4 660 100 4096 Apr 11 09:49 .
drwx-----x  5 660 100 4096 Apr 11 09:39 ..
drwxr-xr-x  4   0   0 4096 Apr 11 08:52 365managed
drwx---rwx 14 660 100 4096 Feb  3 05:38 gnuboard4.utf8
-rw-r--r--  1 660 100  399 Apr 11 08:52 index.html

10. svn
 - xe 파일다운로드 및 업로드를 위해 사용합니다.

 [public_html]$ ls
365managed  index.html

[public_html]$ svn checkout http://svn.xpressengine.com/XpressEngine/trunk xe
-- 이전 생략 --
A    xe/classes/page/PageHandler.class.php
A    xe/classes/handler
A    xe/classes/handler/Handler.class.php
A    xe/index.php
 U   xe
Checked out revision 6088.

[public_html]$ ls
365managed  index.html  xe
[public_html]$ ls xe/
LICENSE  classes  config     layouts  modules  widgets
addons   common   index.php  libs     tests    widgetstyles

11. lftp
 - 외부 ftp 접근시 사용합니다.
 [public_html]$ lftp -u ssh ssh.365managed.net
Password:
lftp ssh@ssh.365managed.net:~> ls
drwxr-xr-x    2 0        0            4096 Apr 11 17:52 365backup
-rw-r--r--    1 660      100       2140876 Apr 11 18:28 gnuboard4.utf8.tgz
drwxr-xr-x    4 660      100          4096 Apr 11 18:56 public_html
-rw-r--r--    1 660      100       5506810 Apr 11 18:28 xe_full.1.2.1.tgz
-rw-r--r--    1 660      100       7564072 Apr 11 18:39 xe_full.1.2.1.zip
lftp ssh@ssh.365managed.net:/> exit

-- 수 고 하 셨 습 니 다 --