Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
今いるディレクトリを消すとどうなる
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Osumi, Yusuke
March 13, 2021
Technology
400
1
Share
今いるディレクトリを消すとどうなる
「新しいLinuxの教科書」を読む会 オンライン #11 での発表資料です。
https://linuxbook.connpass.com/event/204816/
Osumi, Yusuke
March 13, 2021
More Decks by Osumi, Yusuke
See All by Osumi, Yusuke
本の紹介の補足
ozuma
1
400
gitサービス3兄弟
ozuma
0
410
簡体字は楽
ozuma
0
480
ソフトウェアは固定資産
ozuma
0
440
ASCIIコードの小話
ozuma
0
450
名前付きパイプ FIFO
ozuma
0
560
文章、作文技法 リモートワーク
ozuma
1
930
CentOSの今後のリリース(簡易説明)
ozuma
0
410
AndroidでもLinux動いてるよ
ozuma
0
450
Other Decks in Technology
See All in Technology
EMから幅を広げるために最近挑戦していること / Recent challenges I'm undertaking to expand my horizons beyond EM
hiro_torii
1
180
データ定義の混乱と戦う 〜 管理会計と財務会計 〜
wonohe
0
230
生成AIはソフトウェア開発の革命か、ソフトウェア工学の宿題再提出なのか -ソフトウェア品質特性の追加提案-
kyonmm
PRO
2
830
Building Production-Ready Agents Microsoft Agent Framework
_mertmetin
0
150
ServiceNow Knowledge 26 の歩き方
manarobot
0
340
雑談は、センサーだった
bitkey
PRO
2
200
大学職員のための生成AI最前線 :最前線を、AIガバナンスとして読み直すためのTips
gmoriki
2
3.5k
AI時代に越境し、 組織を変えるQAスキルの正体 / QA Skills for Transforming an Organization
mii3king
5
3.7k
サービスの信頼性を高めるため、形骸化した「プロダクションミーティング」を立て直すまでの取り組み
stefafafan
1
230
[Scram Fest Niigata2026]Quality as Code〜AIにQAの思考を再現させる試み〜
masamiyajiri
1
220
20年前の「OSS革命」に学ぶ AI時代の生存戦略
samakada
0
530
ハーネスエンジニアリング入門
knishioka
0
110
Featured
See All Featured
The SEO identity crisis: Don't let AI make you average
varn
0
460
Designing Powerful Visuals for Engaging Learning
tmiket
1
360
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
380
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
510
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
170
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.5k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
220
So, you think you're a good person
axbom
PRO
2
2k
Transcript
今いるディレクトリを 消すとどうなる @ozuma5119 1 「新しいLinuxの教科書」を読む会 オンライン #11 2021/03/13
Windowsの場合 - できない 2
Linuxの場合 - できる 3 $ ls book1.csv secret.txt $ pwd
/home/book/Documents $ rm -v -r /home/book/Documents `/home/book/Documents/secret.txt' を削除しました `/home/book/Documents/book1.csv' を削除しました ディレクトリを削除しました: `/home/book/Documents' $ pwd /home/book/Documents
4 "Documents" フォルダは消えたのにいる! *いしのなかにいる*
いるけど何もできません 5 [book@cent7 Documents]$ pwd /home/book/Documents [book@cent7 Documents]$ rm -v
-rf /home/book/Documents ディレクトリを削除しました: `/home/book/Documents' [book@cent7 Documents]$ [book@cent7 Documents]$ echo "AAA" > a.txt bash: a.txt: そのようなファイルやディレクトリはありません [book@cent7 Documents]$ ls -al 合計 0 [book@cent7 Documents]$ . と .. も無いことに注意
Linuxでファイル・ディレクトリを削除するとは 6 /home/book iノード番号 ファイル名 82490 Documents 33795498 Desktop 51812769
Downloads Documents Desktop Downloads
Linuxでファイル・ディレクトリを削除するとは 7 /home/book iノード番号 ファイル名 82490 Documents 33795498 Desktop 51812769
Downloads Documents Desktop Downloads ディレクトリエントリ(台帳)から消すだけ そのため「迷子」になる
応用編 - 消しちまった! でも別のアプリで開いてる シナリオ 1. Documents/secrets.txt をlessで見ていた 2. [Documents]
フォルダごと消してしまった $ rm -rf Documents 3. lessがopenしているFD(File Discriptor)を/procから探してコピーする 4. 復旧! 参考: https://mag.osdn.jp/06/11/23/0451251 8
9 1. ~/Documents/secrets.txt を 開いている状態で…… 2. Documentsフォルダごと消します
10 1. lessコマンドのプロセスIDを調べて 2. lsofコマンドでファイルを開いている FD(File Descriptor)を探します
11 1. プロセスID=11523, FD=4 をコピーします 2. ファイル復旧できた!
12 lessコマンドを終了させてしまうと、ファイルは 完全に見えなくなります (ただし直後は台帳から消えただけでディスク上に 残っているので、復旧できる可能性は高いです)