分享

Linux console 的“資源回收筒”...

 农夫子oice 2007-04-28

Linux console 的“資源回收筒”

safedelete 能暫存刪除的檔案, 讓 safedelete 取代 rm, 就能讓 Linux console 擁有 "資源回收筒" 的功能.

safedelete 下載點: http://linux./sec/safedelete.html

vi ~/.bashrc

export SAFEDAYS=30 刪除的檔案保存 30 天
alias rm=‘/usr/bin/safedelete‘ 使用 safedelete 取代 rm 刪檔, 將刪除的檔案保存至資源回收筒 (~/.trash)
alias purge=‘/bin/rm -i‘ 真正要刪除檔案時以 purge 取代 rm 指令

指令備忘

  • undelete -l (小寫 L) 顯示資源回收筒裡所有的檔案
  • undelete -i 顯示資源回收筒裡所有的檔案 (詳細資料)
  • safedelchk 清除在資源回收筒裡超過保存天數 (SAFEDAYS) 的檔案.

應用實例 (以下 rm 為 alias rm=‘/usr/bin/safedelete‘ 的 rm)

cd /tmp
echo "test" > test.txt
rm test.txt

undelete test.txt (救回當前目錄底下的指定檔案)

cd ~
echo "test" > test.txt
cd /tmp

echo "abc" > abc.txt
rm ~/test.txt test.txt

undelete -p *.txt -a (救回所有符合條件的檔案)

cd /tmp
mkdir test
cd test
touch a b c
cd ..
rm -rf test
undelete -p /tmp/test/* -a (救回指定目錄)

補充: 救回在 ext2 檔案系統被 rm 刪除的檔案

telinit S
debugfs /dev/hda5

lsdel
stat 123456
dump 123456 /path/to/savefile
quit

延伸閱讀:

Posted by Jamyy at 2006年01月23日 14:04

from:  http://cha./blog/archives/2006/01/linux_console.html#more

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多