目次 [ Contents ]
ラズベリーパイを使うために覚えるターミナルコマンドまとめ。 Linuxに関する情報はNet上に山ほどありますが、とりあえず自分用として。
*注 分かり易いよう半角スペースではなく、敢えて全角スペースにしています。
キーボード ショートカット
目的 | キーコンビネーション |
---|---|
ターミナルの起動 | Ctrl + Alt + T |
実行中コマンドの一時停止 | Ctrl + z |
実行中コマンドの完全停止 | Ctrl + c |
more/less等ページャーの終了 | q |
基本コマンド
1 |
$ sudo su |
1 |
$ sudo raspi-config |
1 |
$ man ls |
ファイル・ディレクトリ
1 |
$ cd / |
1 |
$ cd ../ |
1 |
$ pwd |
1 |
$ ls |
1 |
$ cp 元ディレクトリ 移動先ディレクトリ |
1 |
$ move 元ディレクトリ 移動先ディレクトリ |
1 |
$ rm ディレクトリ |
1 |
$ mkdir ディレクトリ |
1 |
$ mvdir ディレクトリ |
1 |
$ rmdir ディレクトリ |
1 |
chmode +x ファイル名.py |
1 2 |
$ ./ファイル名.py //現状ディレクトリにある場合 $ ~フルパス/ファイル名.py //その他のディレクトリにある場合 |
内容・状態を見る
1 |
$ cat ディレクトリ |
1 |
$ more ディレクトリ |
1 |
$ less ディレクトリ |
1 |
$ uname -a |
シャットダウン・再起動
1 |
$ exit |
1 |
$ sudo shutdown now |
1 |
$ sudo shutdown -r now |
1 |
$ reboot |
更新
1 |
$ sudo apt-get update |
1 |
$ sudo apt-get upgrade |
1 |
$ sudo apt-get dist-upgrade |
1 |
$ sudo rpi-update |
1 |
$ date --set='2018/10/10 13:15:30' |
パッケージ(ソフトウェア)
1 |
$ apt-chache search キーワード |
1 |
$ apt-get install パッケージ名 |
1 |
$ apt-get remove パッケージ名 |
1 |
$ apt-get autoremove |
1 |
$ apt-get purge パッケージ名 |
1 |
$ apt-get clean |
テキストエディタ
1 |
$ vi ディレクトリ |
1 |
$ vim ディレクトリ |
1 |
$ leafpad ディレクトリ |
1 |
$ Nano ディレクトリ |
フォント・文字・日本語
フォントのインストール
1 |
$ sudo apt-cache search font japanese |
1 |
$ sudo apt-get install fonts-ipafont fonts-ipaexfont |
文字コードの変更
- widesnow.com – Raspberry Pi 2の文字コードを変更する(日本語の設定)
- eng-entrance.com – Linuxのローカライゼーション系LANG変数:langについて
1 |
$ echo $LANG |
1 |
$ locale |
1 |
$ locale -a //インストール済み文字コードの一覧 |
1 2 |
$ localectl set-locale LANG=ja_JP.utf8 $ less /etc/locale.conf //確認コマンド |
ハードウェア回り
1 |
$ df -f |
1 |
$ lsblk |
1 |
$ lsusb |
1 |
$ dmesg |
1 |
$ dmesg -t|grep ^usb |
1 |
$ cat /etc/default/keyboard |
1 |
$ tvservice -s |
ネットワーク
1 |
$ sudo /etc/init/d/networking restart |
1 |
$ ifconfig |
1 |
$ iwconfig |
1 |
$ sudo iwlist scan|less |
カメラ
jun’s Homepage – Raspberry Pi のカメラモジュールの使い方
1 |
$ vcgencmd get_camera |
写真モード
1 |
$ raspistill -o test.jpg |
1 |
$ raspistill -t 5000 -o test.jpg |
1 |
$ raspistill -w 800 -h 500 -o test.jpg |
1 |
$ raspistill -d |
1 |
$ raspistill -e bmp |
動画モード
1 |
$ raspivid -o test.h264 |
1 |
$ raspivid -t 5000 -o test.h264 |
1 |
$ omxplyer test.h264 |
1 |
$ raspistill -f 30 -o test.jpg |
ブルートゥース
guro_chanの手帳 – Raspberry Pi 3 Model BにBluetoothキーボードを接続する
1 |
$ sudo bluetoothctl |
1 |
[Bluetooth 3.0 Keyboard]# quit |
1 |
[bluetooth 3.0 Keyboard]# scan on |
1 |
[bluetooth 3.0 Keyboard]# pair デバイス アドレス |
1 |
[bluetooth 3.0 Keyboard]# remove デバイス アドレス |
1 |
[bluetooth 3.0 Keyboard]# paired-devices |
1 |
[bluetooth 3.0 Keyboard]# connect デバイス アドレス |
1 |
[bluetooth 3.0 Keyboard]# disconnect デバイス アドレス |
1 |
[bluetooth 3.0 Keyboard]# trust デバイス アドレス |
1 |
[bluetooth 3.0 Keyboard]# untrust デバイス アドレス |