2011년 10월 25일 화요일

Linux-base command(ubuntu)


LinuxBase Command
 - ls : show the directory list
 - cd : move the directory
 - pwd : print working directory
 - rm :  file delete
 - cp : file copy
 - touch : make the 0 size file
 - mv : file move
 - mkdir : make the directory
 - rmdir : delete the directory
 - cat : text file print the screen
 - head & tail : front or end
 - more : page단위 print
 - file : 파일의 종류를 표시
 - clear :clear the screen


SystemOff
- shutdown -h now
- init 0
- halt
SystemReboot
- shutdown -r now
- reboot
- init 6


Init command(Runlevel)
    - /etc/initab(redhat)
    - debian(from package 'upstart')
- 0 : systemoff
- 1 : singlemode(recovery)
- 2 : No NFS multi user
- 3 : multi user(textmode)
- 4 : not used
- 5 : Xwindow(multi user)
- 6 : reboot

virtual console
 : '가상의 모니터'개념이며 6개의 가상 콘솔을 제공한다 Ctrl+Alt [F1]~[F6]까지 사용가능하며, 다시 Xwindow로 돌아오려면 Ctrl+Alt+[F7]을 누르면 된다.

Mount
: 리눅스의 경우 하드디스크 파티션, cd/dvd, usb메모리등 특정한 위치에 연결해 줘야 하는데 이것을 마운트라 한다. 하지만 ubuntu의 경우 자동으로 마운트가 너무 잘되며, 특별히 관리 하고 싶을 경우 mountmanager를 이용하면 편리하다.



user & group
: 리눅스는 multi-user system이며, 사용자와 그룹을 관리하는 파일이 있다.
/etc/passwd파일이 그것이다.


각 행의 의미는 다음과 같다. [사용자:암호:ID:Group:전체이름:홈디렉토리경로:기본셀]
cf) passwd 관리 파일 /etc/shadow




useradd or adduser // 사용자 추가
passwd [username] // 비밀번호 변경
usermod // 사용자 속성 변경
userdel // 사용자 삭제
chage // 사용자 암호 변경 주기 설정
groups // 사용자가 속한 그룹 표시
groupadd // 새로운 그룹 생성
groupmod // 그룹 속성을 변경
groupdel // 그룹을 삭제
gpasswd // 그룹암호 설정 및 그룹의 관리 수행


Link
: 리눅스에서 파일링크는 Symbolic link(Soft Link)와 Hard Link가 있다.
Hard Link의 경우 원본파일과 동일한 inode를 사용하여, 원본데이터에 직접 접근하며,
Soft Link의 경우 원본파일을 가르키는 포인터 값이 inode에 저장되어 있다.

cf) Hard Link : 원본파일 연결 | Soft Link : 바로가기

command >
 - touch linktest
 - ln linktest hardlink
 - ln -s linktest softlink

management command
 : 리눅스 시스템 관리 명령어는 PRM(Redhat Package Manager)과 YUM(Yellowdog Updater Modified)이 있다. yum의 경우rpm의 패키지 의존성 문제를 완전히 해결해 준다. 특정 패키지를 설치하고, 의존성이 있는 다른 패키지 파일도 자동으로 설치해주는 툴이다.

rpm -Uvh [package file.rpm]
yum install [package file]
cf) etc/yum/

File Search
find [경로] [옵션] [조건] [action]
 - 옵션 : -name, -user(소유자), -newer(전,후), -perm(허가권), -size(크기)
 - action : -print(default), -exec(외부명령 실행)

Firewall (UFW:Uncomplicated Firewall)
sudo ufw deny <port>/<optional: protocol>
sudo ufw deny from <ip address>
sudo ufw delete <rule type> from <ip address> to any port <port number>

 cron
 : 주기적으로 반복되는 일을 자동적으로 실행되도록 설정하는 것
/etc/cron.[d|daily|hourly|...]

at
  : 일회성 작업을 예약하는 것

cf) How do I restart Linux network service?  
http://theos.in/desktop-linux/tip-that-matters/how-do-i-restart-linux-network-service/

댓글 없음:

댓글 쓰기