Connect to the console of Raspberry PI and display local IP and SD information

Overview

Displays the IP address currently distributed by DHCP when the SSH terminal is started with Raspberry PI. And the capacity of the SD card is also displayed.

Modify file ".bashrc"

Modify the file with the following command. I'm using VI, but other editing tools are fine.

vi ~/.bashrc

Add the following contents to the above file and save it.

echo "==IP Address=="
ip addr | grep "inet " | grep brd | awk '{print $2}' | awk -F/ '{print $1}'
echo ""
echo "==Disk Space=="
df -h

Launch ssh terminal

When you start the terminal, it will be displayed as shown in the screen below.

Linux raspberrypi 4.19.118-v7l+ #1311 SMP Mon Apr 27 14:26:42 BST 2020 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Jun 21 08:19:14 2020 from 192.168.1.2

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

==IP Address==
192.168.1.13

==Disk Space==
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G  5.8G  7.9G  43% /
devtmpfs        841M     0  841M   0% /dev
tmpfs           970M     0  970M   0% /dev/shm
tmpfs           970M  8.6M  962M   1% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           970M     0  970M   0% /sys/fs/cgroup
/dev/mmcblk0p1  253M   51M  202M  21% /boot

tmpfs           194M     0  194M   0% /run/user/1000

Other

If you also want to display the global IP, use the command below.

pi@raspberrypi:~ $ curl globalip.me
219.107.XXX.XXX

At the end

Today I added a command to the content where ".bashrc" is executed when connecting with SSH. Above all, I'm glad I was able to confirm the capacity of the disk I'm currently using. If you have any information you would like to see, please add it to this file.

Recommended Posts

Connect to the console of Raspberry PI and display local IP and SD information
Raspberry Pi --1 --First time (Connect a temperature sensor to display the temperature)
I sent the data of Raspberry Pi to GCP (free)
I tried to automate the watering of the planter with Raspberry Pi
Graph display of household power consumption with 3GPI and Raspberry Pi
How to display the CPU usage, pod name, and IP address of a pod created with Kubernetes
Connect two USB cameras to Raspberry Pi 4
Display the signal strength RSSI of a specific SSID (raspberry pi (linux))
[Python] How to specify the window display position and size of matplotlib
Use Raspberry Pi to solve the problem of insufficient mobile Wi-Fi connection
I connected the thermo sensor to the Raspberry Pi and measured the temperature (Python)
I made an npm package to get the ID of the IC card with Raspberry Pi and PaSoRi
Read the data of the NFC reader connected to Raspberry Pi 3 with Python and send it to openFrameworks with OSC
I tweeted the illuminance of the room with Raspberry Pi, Arduino and optical sensor
Try to display the railway data of national land numerical information in 3D
How to make a Raspberry Pi that speaks the tweets of the specified user
Get CPU information of Raspberry Pi with Python
Connect your Raspberry Pi to your smartphone using Blynk
Connect to MySQL with Python on Raspberry Pi
I want to be notified of the connection environment when the Raspberry Pi connects to the network
A story that I wanted to realize the identification of parking lot fullness information using images obtained with a Web camera and Raspberry Pi and deep learning.
Easy IoT to start with Raspberry Pi and MESH
Add information to the bottom of the figure with Matplotlib
Display images taken with the Raspberry Pi camera module
Try to visualize the room with Raspberry Pi, part 1
How to use the Raspberry Pi relay module Python
Take the value of SwitchBot thermo-hygrometer with Raspberry Pi
Log the value of SwitchBot thermo-hygrometer with Raspberry Pi
I tried to visualize the spacha information of VTuber
Installation of Docker on Raspberry Pi and L Chika
Input and output display images directly using the frame buffer (/ dev / fb0) on Raspberry Pi
Make a note of what you want to do in the future with Raspberry Pi
Control the display of RGB LED matirix electric bulletin board freely with Raspberry Pi 3B +
I tried using the Pi Console I / F of the Raspberry Pi IoT starter kit "anyPi" from Mechatrax.
I tried to move ROS (Melodic) with the first Raspberry Pi (Stretch) at the beginning of 2021
[Super easy! ] How to display the contents of dictionaries and lists including Japanese in Python
[Go language] Use OpenWeatherMap and Twitter API to regularly tweet weather information from Raspberry Pi
Easy introduction to home hack with Raspberry Pi and discord.py
Make the display of Python module exceptions easier to understand
Application to display and search local memos (diary) in Python
[Raspberry PI & Garmin GLO] Until you connect Bluetooth GPS to Raspberry Pi
I want to get the operation information of yahoo route
Production of temperature control system with Raspberry Pi and ESP32 (1)
Create a partition and then install the Raspberry Pi OS
100 language processing knock-42: Display of the phrase of the person concerned and the person concerned
I tried to display the time and today's weather w
Hook to the first import of the module and print the module path
The websocket of toio (nodejs) and python / websocket do not connect.
I want to know the features of Python and pip
Change the message displayed when logging in to Raspberry Pi
I tried to fight the Local Minimum of Goldstein-Price Function
Get the weather using the API and let the Raspberry Pi speak!
Commands and files to check the version of CentOS Linux
Is there a secret to the frequency of pi numbers?
Connect Raspberry Pi to Alibaba Cloud IoT Platform with Python
How to connect the contents of a list into a string
A program that receives the servo command of the radio control, interrupts the Raspberry Pi and logs it
Get weather information using Yahoo! Open Local Platform (YOLP) and let Raspberry Pi talk with AquesTalkPi
Send the temperature, humidity, etc. measured by SensorTag to Ambient via Raspberry Pi 3 and graph it.
I want to extract the tag information (title and artist) of a music file (flac, wav).
[Memo] Connect Raspberry Pi Zero to the Internet with a single USB cable! (Use nfs, no SD card / keyboard / mouse / monitor required)