Linux コマンド:フォルダ移動

公開:2026.05.10(日) 20:14

Linuxでのフォルダ移動コマンド

以下のようにフォルダを移動したい。
移動元:~/docker/php/www/html/prophp_sample
移動先:~/docker/php/

"mv 移動元パス "移動先パス/" を使う。

実行結果:
xxx@xxx:~/docker/php/www/html$ mv ~/docker/php/www/html/prophp_sample ~/docker/php/
mv: cannot move '/home/xxx/docker/php/www/html/prophp_sample' to '/home/xxx/docker/php/prophp_sample': Permission denied

"Permission denied"で移動できなかった。
移動元フォルダの所有者が "root" になっていた。
所有者をログインユーザーへ変更
→ 「Linux コマンド:フォルダへの権限付与方法

これで移動できた。

実行結果:
xxxxxxxx@xxxx:~/docker/php/www/html$ mv ~/docker/php/www/html/prophp_sample ~/docker/php/
xxxxxxxx@xxxx:~/docker/php/www/html$


"Linux コマンド"

0 件のコメント:

その他の記事