画面操作
全画面表示
command + return
画面分割
command + d
画面切り替え
command + [
基本操作
ディレクトリ移動
cd
※自動補完機能について
cd Des のように途中まで入力してから tab キーを押すと残りの文字を補完してくれる。
画面のクリーンアップ
control + L
ディレクトリ操作
現在のディレクトリのフルパス表示
pwd
新規ディレクトリ作成
mkdir (dirname)
空のディレクトリを削除
rmdir (dirname)
ディレクトリを強制削除
rm -rf (dir名)
中のファイルごと強制的に削除する
ディレクトリAをディレクトリBにコピー
cp -r (dirA) (dirB)
現在ディレクトリのファイル一覧表示
ls
ファイル操作
ファイル
cat (file名) -n
ファイルをディレクトリに移動
mv (file名) (dir名)
ファイルを新規作成
touch (file名)
ファイルの検索
find / -name aaaaa.txt
aaaaa.txt をルートディレクトリ以下から探すという事。もしファイル名の一部から検索したい場合は以下を利用する
- 「?」一文字のワイルドカード ex)Photo???.jpg のように文字数がわかっているときにつかう。
- 「*」0文字以上の文字列をあらわsうワイルドカード
#その他
パーミッションの変更
chmod -R 755 dirname
-Rをつける事でディレクトリ配下のファイルやディレクトリ全てのパーミッションを変更する。-Rを付けなければ指定のディレクトリだけ。
リンクファイルを作成する
ln
- -s でシンボリックファイルを作成する
- -f で強制的に上書きする。
ex) ln -fs /vagrant /var/www/html
これで/vagrantへのシンボリックリンク「/var/www/html」を作成。
リンクファイルはWindowsのショートカットやMacOSのエイリアスのようなもの。ハードリンクとシンボリックリンクの2種類ある。