Release 2017.12.16 / Update 2018.10.24

(日本語) Raspberry Pi ターミナルコマンドメモ

Sorry, this entry is only available in Japanese. For the sake of viewer convenience, the content is shown below in the alternative language. You may click the link to switch the active language.

ラズベリーパイを使うために覚えるターミナルコマンドまとめ。 Linuxに関する情報はNet上に山ほどありますが、とりあえず自分用として。

*注 分かり易いよう半角スペースではなく、敢えて全角スペースにしています。

キーボード ショートカット

目的 キーコンビネーション
ターミナルの起動 Ctrl + Alt + T
実行中コマンドの一時停止 Ctrl + z
実行中コマンドの完全停止 Ctrl + c
more/less等ページャーの終了 q

基本コマンド

$ sudo su
$ sudo raspi-config
$ man ls

ファイル・ディレクトリ

$ cd /
$ cd ../
$ pwd
$ ls
$ cp 元ディレクトリ 移動先ディレクトリ
$ move 元ディレクトリ 移動先ディレクトリ
$ rm ディレクトリ
$ mkdir ディレクトリ
$ mvdir ディレクトリ
$ rmdir ディレクトリ
chmode +x ファイル名.py
$ ./ファイル名.py      //現状ディレクトリにある場合
$ ~フルパス/ファイル名.py  //その他のディレクトリにある場合

内容・状態を見る

$ cat ディレクトリ
$ more ディレクトリ
$ less ディレクトリ
$ uname -a

シャットダウン・再起動

$ exit
$ sudo shutdown now
$ sudo shutdown -r now
$ reboot

更新

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
$ sudo rpi-update
$ date --set='2018/10/10 13:15:30'

パッケージ(ソフトウェア)

$ apt-chache search キーワード
$ apt-get install パッケージ名
$ apt-get remove パッケージ名
$ apt-get autoremove
$ apt-get purge パッケージ名
$ apt-get clean

テキストエディタ

$ vi ディレクトリ
$ vim ディレクトリ
$ leafpad ディレクトリ
$ Nano ディレクトリ

フォント・文字・日本語

フォントのインストール

$ sudo apt-cache search font japanese
$ sudo apt-get install fonts-ipafont fonts-ipaexfont

文字コードの変更

$ echo $LANG
$ locale
$ locale -a    //インストール済み文字コードの一覧
$ localectl set-locale LANG=ja_JP.utf8
$ less /etc/locale.conf    //確認コマンド

ハードウェア回り

$ df -f
$ lsblk
$ lsusb
$ dmesg
$ dmesg -t|grep ^usb
$ cat /etc/default/keyboard
$ tvservice -s

ネットワーク

$ sudo /etc/init/d/networking restart
$ ifconfig
$ iwconfig
$ sudo iwlist scan|less

カメラ

jun’s HomepageRaspberry Pi のカメラモジュールの使い方

$ vcgencmd get_camera

写真モード

$ raspistill -o test.jpg
$ raspistill -t 5000 -o test.jpg
$ raspistill -w 800 -h 500 -o test.jpg
$ raspistill -d
$ raspistill -e bmp

動画モード

$ raspivid -o test.h264
$ raspivid -t 5000 -o test.h264
$ omxplyer test.h264
$ raspistill -f 30 -o test.jpg

ブルートゥース

guro_chanの手帳 – Raspberry Pi 3 Model BにBluetoothキーボードを接続する

$ sudo bluetoothctl
[Bluetooth 3.0 Keyboard]# quit
[bluetooth 3.0 Keyboard]# scan on
[bluetooth 3.0 Keyboard]# pair デバイス アドレス
[bluetooth 3.0 Keyboard]# remove デバイス アドレス
[bluetooth 3.0 Keyboard]# paired-devices
[bluetooth 3.0 Keyboard]# connect デバイス アドレス
[bluetooth 3.0 Keyboard]# disconnect デバイス アドレス
[bluetooth 3.0 Keyboard]# trust デバイス アドレス
[bluetooth 3.0 Keyboard]# untrust デバイス アドレス

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA


This site uses Akismet to reduce spam. Learn how your comment data is processed.