532
483

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

シンボリックリンクの作成と削除

Last updated at Posted at 2014-02-05

作成

hoge# ln -s /hoge/fuga/watshi ./watashi
もしくは
hoge# ln -s /hoge/fuga/watshi watashi
また、もし同じ名前でいいのなら、
hoge# ln -s /hoge/fuga/watshi

すると

lrwxrwxrwx  1 hoge  hoge      24 Feb  5 16:20 watashi -> /hoge/fuga/watshi

*パスの最後にスラッシュはいりません

リンクの方にスラッシュをつけると、エラーになります。

hoge# ln -s /hoge/fuga/watshi/ ./watashi/
ln: target `./watashi/' is not a directory: No such file or directory

また、URIの方にスラッシュを付けると見辛い事になります。

hoge# ln -s /hoge/fuga/watshi/ ./watashi
hoge# ll
lrwxrwxrwx  1 hoge  hoge      24 Feb  5 16:20 watashi -> /hoge/fuga/watshi//  

削除

hog# unlink ./watashi

rmを使ってやることもできますが、、、

hoge# rm ./watashi
rm: remove symbolic link `watashi'? y

でも rm だと、↓みたいにもしスラッシュをつけちゃうとだと実体を削除しちゃうから注意

hoge# rm watashi/ 
532
483
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
532
483

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?