$ find / -size +20480
찾아 지우기
$ find / -size +20480 -exec rm {} \;
(1 block = 512 byte ---> 2 block = 1024 byte = 1kbyte ---> 2048 block = 1Mbyte)
출처 : http://network.hanyang.ac.kr/data/fundamentals.htm
[root@arch root]# fdisk /dev/hdb The number of cylinders for this disk is set to 3737. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): p |
Command (m for help): p Disk /dev/hdb: 255 heads, 63 sectors, 3737 cylinders Units = cylinders of 16065 * 512 bytes Device Boot Start End Blocks Id System /dev/hdb1 * 1 383 3076416 83 Linux /dev/hdb2 384 3737 26941005 5 Extended /dev/hdb5 384 416 265041 82 Linux swap /dev/hdb6 417 3737 26675901 83 Linux Command (m for help): q [root@arch root]# |
[root@arch root]# mkdir /oldarchi [root@arch root]# mkdir /oldarchi/hdb1 [root@arch root]# mount /dev/hdb1/ /oldarchi/hdb1 [root@arch root]# cd /oldarchi/hdb1 |
이상하네 그거 좀 요즘 안했다고 다 까먹었네요..
1 tar아카이브(여러 파일을 한 파일로 묶은 것)을 생성하고 푼다.
아카이브의 확장자는 .tar 이다.
tar 는 실행시 반드시 옵션이 있어야 하기 때문에 옵션에 - 를 붙이지 않아도 된다(ps도 마찬가지 이유로 - 가 필요없다). 즉, tar xvf archive.tar 도 작동한다.
2 명령어 활용예
2.1 아카이브 풀기 tar -xvf archive.tar
archive.tar 라는 이름으로 묶인 파일과 디렉토리를 현재 디렉토리에 풀어준다. v 옵션은 파일을 푸는 과정을 화면에 출력해주라는 의미이다.
2.2 아카이브 만들기 tar -cvf archive.tar 묶을파일과디렉토리들
archive.tar 라는 이름으로 파일과 디렉토리를 묶어준다.
2.3 퍼미션을 유지하며 아카이브 만들기 tar -cvfp archive.tar 묶을파일과디렉토리들
archive.tar 라는 이름으로 퍼미션을 유지하며 파일과 디렉토리를 묶어준다.
2.4 tar+gzip 압축하기tar -czvf archive.tar.gz 묶을파일과디렉토리들
archive.tar.gz 라는 이름으로 파일과 디렉토리를 묶어준다. tar -czvfp archive.tar.gz 묶을파일과디렉토리들
archive.tar.gz 라는 이름으로 퍼미션을 유지하며 파일과 디렉토리를 묶어준다.
2.5 tar+bzip2 압축하기tar -cjvf archive.tar.bz 묶을파일과디렉토리들
archive.tar.bz 라는 이름으로 파일과 디렉토리를 묶어준다.
tar -cvjfp archive.tar.gz 묶을파일과디렉토리들
archive.tar.gz 라는 이름으로 퍼미션을 유지하며 파일과 디렉토리를 묶어준다.
2.6 gzip으로 압축된 tar 풀기 tar -xvzf archive.tar.gz
archive.tar.gz 라는 tar 로 묶인뒤 gzip 으로 압축된 파일을 먼저 압축을 푼뒤에 묶인 파일까지 풀어준다.
2.7 bzip2로 압축된 tar 풀기 tar -xvjf arhive.tar.bz
archive.tar.bz 라는 tar 로 묶인뒤 bzip2로 압축된 파일을 먼저 압축을 푼뒤에 묶인 파일까지 풀어준다.
2.8 허가권(Permission) 유지하며 풀기 tar -xpf archive.tar
파일을 묶을 당시의 각 파일의 허가권을 유지하며 풀어준다.
find . ( -name '*.mp3' -o -name '*.MP3' ) -print -exec rm -f {} ;
혹시 dir들이 link로 되어 있으면 -follow 업션 하나 더 줘야...
[root@urban tmp]# [root@urban tmp]# cp /etc/httpd/conf/httpd.conf /home/sylee/backup/ [root@urban tmp]# /etc/rc.d/init.d/httpd stop [root@urban tmp]# cp /usr/local/apache/conf/httpd.conf /home/kan [root@urban tmp]# /etc/rc.d/init.d/httpd stop httpd 를 정지함: [ 확인 ] [root@urban tmp]# /etc/rc.d/init.d/mysqld stop Killing mysqld with pid 1194 만약에 /usr/local/apache에 설치되어 있다면 [root@urban tmp]# mv /usr/local/apache /usr/local/apache_old [root@urban tmp]# cd apache_1.3.26 [root@urban apache_1.3.26]# ./configure --prefix=/usr/local/apache --enable-module=so --enable-rule=SHARED_CORE --enable-shared=max [root@urban apache_1.3.26]# make [root@urban apache_1.3.26]# make install [root@urban apache_1.3.26]# ls /usr/local/ apache apache_old doc games include libexec sbin src bin etc imap lib mysql share apache 디렉토리 생성확인 [root@urban apache_1.3.26]# cd ../php-4.2.2 [root@urban php-4.2.2]# ./configure --with-apxs=/usr/local/apache/bin/apxs --with-apache-install=/usr/local/apache --with-config-file-path=/usr/local/lib --with-mysql=/usr/local/mysql --with-pdflib=no --enable-track-vars --enable-magic-quotes --enable-modules=so [root@urban apache_1.3.26]# make [root@urban apache_1.3.26]# make install [root@urban apache_1.3.26]# cp php.ini-dist /usr/local/lib/php.ini [root@urban apache_1.3.26]# /usr/local/apache/bin/apachectl start /usr/local/apache/bin/apachectl stop: httpd started 이렇게 나오면 OK [root@urban apache_1.3.26]# /usr/local/apache/bin/apachectl stop /usr/local/apache/bin/apachectl stop: httpd stopped httpd.conf를 조절하기위해 stop [root@urban apache_1.3.26]# vi /usr/local/apache/conf/httpd.conf ServerRoot "/usr/local/apache" ServerAdmin www@urban.knu.ac.kr ServerName urban.knu.ac.kr DocumentRoot "/usr/local/apache/htdocs" Options SymLinksIfOwnerMatch MultiViews IncludesNoExec AllowOverride FileInfo AuthConfig LImit Order allow,deny Allow from all 취향에 맞게 수정 DirectoryIndex index.html BrowserMatch "RealPlayer 4.0" force-response-1.0 BrowserMatch "Java/1.0" force-response-1.0 BrowserMatch "JDK/1.0" force-response-1.0 추가 BrowserMatch "WebZIP" no_access BrowserMatch "Teleport" no_access BrowserMatch "NamoWebEditor" no_access BrowserMatch "WebTrack-HTTPP" no_access BrowserMatch "WebSymmetrix" no_access AddType application/x-tar .tgz 추가 AddType application/x-httpd-php .php .php3 .html .inc AddType application/x-httpd-php-source .phps AddHandler cgi-script .cgi NameVirtualHost 155.230.175.52:80 ServerAdmin www@urban.knu.ac.kr DocumentRoot /home/city/html ServerName city.knu.ac.kr ServerAlias city.knu.ac.kr ErrorLog logs/city.error_log TransferLog logs/city.access_log ##################################################################### /etc/rc.d/init.d/httpd ---------httpd 시작---------------------------------------------------- #!/bin/bash # # Startup script for the Apache Web Server # # chkconfig: - 85 15 # description: Apache is a World Wide Web server. It is used to serve # HTML files and CGI. # processname: httpd # pidfile: /var/run/httpd.pid # config: /etc/httpd/conf/access.conf # config: /etc/httpd/conf/httpd.conf # config: /etc/httpd/conf/srm.conf # Source function library. . /etc/rc.d/init.d/functions # This will prevent initlog from swallowing up a pass-phrase prompt if # mod_ssl needs a pass-phrase from the user. INITLOG_ARGS="" # Path to the apachectl script, server binary, and short-form for messages. apachectl=/usr/local/apache/bin/apachectl # 경로 수정 httpd=/usr/local/apache/bin/httpd # 경로 수정 prog=httpd RETVAL=0 # Find the installed modules and convert their names into arguments httpd # can use. moduleargs() { moduledir=/usr/local/apache/libexec # 경로 수정 moduleargs=` /usr/bin/find ${moduledir} -type f -perm -0100 -name "*.so" | env -i tr '[:lower:]' '[:upper:]' | awk '{ gsub(/.*//,""); gsub(/^MOD_/,""); gsub(/^LIB/,""); gsub(/.SO$/,""); print "-DHAVE_" $0}'` echo ${moduleargs} } # The semantics of these two functions differ from the way apachectl does # things -- attempting to start while running is a failure, and shutdown # when not running is also a failure. So we just do it the way init scripts # are expected to behave here. start() { echo -n $"Starting $prog: " daemon $httpd `moduleargs` $OPTIONS RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc $httpd RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $httpd ;; restart) stop start ;; condrestart) if [ -f /var/run/httpd.pid ] ; then stop start fi ;; graceful|help|configtest) $apachectl $@ RETVAL=$? ;; *) echo $"Usage: $prog {start|stop|restart|condrestart|status|fullstatus|graceful|help|configtest}" exit 1 esac exit $RETVAL ---------httpd 끝------------------------------------------------------ ##################################################################### /etc/logrotate.d/apache ---------apache 시작-------------------------------------------------- /usr/local/apache/logs/access_log /usr/local/apache/logs/error_log{ missingok sharedscripts postrotate /bin/kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true endscript } ---------apache 끝---------------------------------------------------- ##################################################################### /usr/local/lib/php.ini 적당히 수정. 끝. |