61.Linux2008. 7. 22. 09:32
반응형
- 와일드 문자
  * : 그 문자에 해당되는 모든 것
  ? : 하나의 문자를 상징

- Move a file or rename a file
  # mv /root/test.txt /root/test : move a file or rename a file

  # df -h : 사용가능한 디스크 용량 확인
  # df -T : 마운트되어 있는 시스템 확인
  # du
  # du -h /usr/bin : 해당 디렉토리에서 사용한 용량 확인

  # cat > test.txt : 간단한 텍스트 파일 생성
  # cat >> test.txt: test.txt 파일에 내용 추가
  # cat test.txt : test.txt 파일 내용 print
  # cat -b test.txt : 줄번호 표시

  # find / -name dmesg : / 디렉토리 아래에서 dmesg 이름을 갖는 파일 검색
  # ps : 프로세스 상태 확인
  # ps aux | more

- Mount
  # mkdir /mnt/dvdrom
  # mount -t iso9660 /dev/hdc /mnt/dvdrom/
  # df
  # umount /mnt/dvdrom or umount /dev/hdc

- install NTFS module (for mount windows xp partitions)
  # yum install ntfs -3g

- format the partition '/dev/hda2' as a form of linux file system
  # mkfs -t ext3 /dev/hda2 : 파일 시스템 만들기
  # fsch.ext3 /dev/hda2 : 파일 시스템 점검
  # who or w or finger : 현재 시스템에 접속하 사용자 확인

- Process
  # kill -1 2695 : 해당 프로세스를 다시 시작
  # kill -HUP 3435 : restart the process
  # kill -9 2695 : 해당 프로세스 정지

- Man page -> text file
  # man mount | col -b > mount.man.txt : transform the man page into text file

- 명령어 옵션을 자동으로 실행되게 하는 Alias
  .bashrc 파일 편집
    alias du='du -h'
    alias move='mv -i'
    

1.5
- accounts
  # su - : 루트계정으로 전환
  # su ekyulee

- uncompress (tar.gz or tar.bz2)
  # wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.gz
  # tar xvfz linux-2.6.20.tar.gz
  # wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2
  # tar xvfj linux-2.6.20.tar.bz2

- rpm uncompress, install, and confirm
  # rpm -ivh webalizer.i386.rpm : rpm 설치
  # rpm -ql webalizer : rpm 설치된 경로 확인
  # rpm -q webalizer : rpm 검색
  # rpm -e webalizer : rpm 제거

  # w or who or finger : 현재 시스템에 접속중이 사용자 확인
  # ps ax | grep syslogd : syslogd 데몬이 프로세스상에서 동작하고 있는지 확인
  # kill -l 2139 : 프로세스 재실행

- User account
  # adduser siren
  # passwd siren : 비밀번호 변경
  # passwd : root 계정의 비밀번호 변경
  # userdel -r siren : 계정 사용자 삭제
  # finger ekyulee : check the user data
  # chfn ekyulee : change the user data

  # mc : midnight commander

- background & foreground
  # top & : 시스템 상태 분석 도구인 top를 백그라운드 모드로 작동
  # fg : top 프로세스를 포그라운드로 작동 (q: top 프로세스 종료)

  # /etc/init.d/xinetd restart : xinetd 데몬 재시작

- review kernel message while booting process
  # dmesg | more

- kernel version
  # uname -a : check the system's kernel version
  # finger @finger.kernel.org : check the latest kernel version
  # /sbin/lsmod | more : check the currently working kernel modules

- check the hardware data (under /proc/)
  # cat /proc/cpuinfo
  # cat /proc/meminfo

- network
  # ping 168.126.84.2
  # traceroute www.yahoo.com
  # ifconfig
  # ifconfig eth0 192.168.1.4 netmask 255.255.255.0 broadcast 192.168.1.255
  # ifconfig eth0 down : 이더넷 네트워크를 비활성화 (제거)
  # ifconfig eth0 192.168.1.4

- 인터넷 공유
  # echo 1 > /proc/sys/net/ipv4/ip_forward
  # iptables -A FORWARD -o ppp0 -j ACCEPT (case: ADSL)
  # iptables -A FORWARD -o eth0 -j ACCEPT (case: VSDL)
  # iptables -A FORWARD -o eth1 -j ACCEPT
  # iptables -t nat -A POSTROUTING -o ppp0 (ethO) -j MASQUERADE

- IP Alias 하나의 이더넷 장치에 또 다른 IP를 할당
  # ifconfig eth0:1 192.168.1.100

- automatic IP Packet forwarding
  set 'net.ipv4.ip_forward=1' at the file '/etc/sysctl.conf'

- Nameserver
  you can add additional nameserver '192.168.2.1' at the file '/etc/resolv.conf'

- Firewall (iptables)
  # /etc/init.d/iptables restart
  '/etc/sysconfig/iptables' 설정
  'Alt+F2' -> system-config-securitylevel

- chmod
  # chmod 644 /bin/uname : read-only
  # chmod 755 /bin/uname : executable

- ssh
  # ssh localhost (access with root account)
  # ssh localhost -l ekyulee
  # sftp ekyulee@localhost

- wget download files from remote ftp server without login the ftp server
  # wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.1.tar.bz2

- Time
  # date : check the current time
  # ntpdate time.kriss.re.kr
  # rdate -p -s time.bora.net

- Yum : yum 리포티지 - rpm 패키지를 저장하고 있음
  # rpm --import /etc/pki/rpm-gpg/*
  # rpm --import http://rpm.livna.org/RPM-LIVNA-GPG-KEY (GPG키 설치)
  # rpm -ivh http://rpm.livna/org/livna-release-6.rpm

- Hard disk error
  # badblock -s /dev/hda1

- File set
  # touch test.txt
  # chattr +i test.txt (파일이 지워지지 않음)
  # chattr -i test.txt (파일이 지워짐)

- checksum
  # md5sum fedora6.x86.iso

- Flash 설치
  # wget http://macromedia.mplug.org/macromedia-i386.repo
  # cp macromedia-i386.repo /etc/yum.repos.d/
  # rpm --import http://macromedia.mplug.org/FEDORA-GPG-KEY
  # yum install flash-plugin

- Linux Kernel 설치
  # wget http://download/fedora.redhat.com/pub/fedora/linux/core/6/source/SRPMS/kernel-2.6.18-1.2798.fc6.src.rpm
  # rpm -ivh kernel-2.6.18-1.2798.fc6.src.rpm
  # rpmbuild -bp --target=$(uname -m) /usr/src/redhat/SPECS/kernel-2.6.spec
  # mv /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i386 /usr/src
  # ln -s /usr/src/linux-2.6.18.i386 /usr/src/linux : 심볼릭 링크 연결

- Linux Kernel 설치 (Update)
  # yum install yum-utils
  # yumdownloader --source kernel --enablerepo updates-source
Posted by 1010