0
1

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 3 years have passed since last update.

Raspberry Pi用個人的コマンドリスト

Last updated at Posted at 2021-09-19

Raspberry piのコマンドプロンプトで個人的に頻繁に使用するコマンドをまとめる。

SDカードをアンマウントする

diskutil list

listで出てきた該当のディスク番号に変更する

disk4とは限らない

diskutil umountDisk /dev/disk4 

SDカードにimgファイルを書き込む

imgファイルがあるディレクトリを指定

sudo dd if=/Users/ディレクトリ/ほにゃらら.img of=/dev/rdisk4 bs=32m 

SDカードバックアップ

rdisk4のように"r"とつけると速くなる

sudo dd bs=32m if=/dev/rdisk4 of=~raspi.img

config.txtの設定

sudo nano /boot/config.txt

接続先設定

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

固定IPアドレス設定

sudo nano /etc/dhcpcd.conf

AP化したサーバーのSSIDとPASSの設定

sudo nano /etc/hostapd/hostapd.conf

Pythonを起動時に実行するための保存設定

cd ../ 
cd ../ 
sudo cp home/pi/Desktop/test.py opt/test.py
sudo reboot 

起動中のサービスの状態

sudo systemctl status a.service

時間の設定

sudo nano /etc/chrony/chrony.conf
sudo systemctl restart chrony.service
chronyc sources
sudo chronyc -a makestep
sudo systemctl status chronyd -l

現在のCPUクロックを表示


vcgencmd measure_clock arm

現在の温度を表示

vcgencmd measure_temp

各種設定確認

vcgencmd get_config int 

スロットル情報の表示

vcgencmd get_throttled

書き込み許可

# !/bin/sh

if [ -e /mnt/boot-ro/config.txt ]; then
    sudo mount -o remount,rw /dev/mmcblk0p1
    sudo grep -v initramfs /mnt/boot-ro/config.txt >/tmp/config.txt
    sudo cp /tmp/config.txt /mnt/boot-ro/config.txt
    sudo reboot
else
    echo Already write enabled
fi

書き込み禁止

# !/bin/sh

if [ -e /mnt/boot-ro/config.txt ]; then
    echo Already write protected
else
    sudo grep -v initramfs /boot/config.txt >/tmp/config.txt
    sudo echo initramfs initrd.gz >> /tmp/config.txt
    sudo cp /tmp/config.txt /boot/config.txt
    sudo reboot
fi

日付設定

sudo date --set "2021-09-19 10:40:00"
0
1
0

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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?