Raspberry Pi Commands
Basic Commands
Finding available devices
This command lists all devices connected to the same network as your Raspberry Pi. It helps you identify the IP addresses and MAC addresses of the devices.
Connecting to the Raspberry Pi via SSH using the device name:
This command establishes an SSH connection to your Raspberry Pi using its device name. By default, the username is "pi" and the device name is "raspberrypi".
Connecting to the Raspberry Pi via SSH using the IP address:
This command establishes an SSH connection to your Raspberry Pi using its IP address. Replace "192.168.64.xxx" with the actual IP address of your Raspberry Pi.
User Management
Adding a new user with a home directory
This command creates a new user named "sven" and assigns them to the "sudo" group, granting them administrative privileges. The "-m" flag creates a home directory for the user. User information is stored in the "/etc/passwd" file.
Setting a password for a user
This command sets a password for the user "sven". The password is stored in an encrypted format in the "/etc/shadow" file.
System Information
Getting system information (e.g., IP address):
This command displays information about the network interfaces, including the IP address assigned to each interface.
Getting network information
This command provides information about the wireless network interfaces, including the connected Wi-Fi network and signal strength.
Getting the hostname
This command displays the hostname of your Raspberry Pi.
Getting the IP address associated with the hostname:
This command shows the IP address assigned to the hostname of your Raspberry Pi.
Checking for all connected USB devices
This command lists all the USB devices currently connected to your Raspberry Pi.
System Configuration
Accessing the Raspberry Pi configuration tool:
This command opens the Raspberry Pi configuration tool, which allows you to modify various system settings, such as enabling SSH, changing the password, and configuring the locale.
Starting the graphical user interface (GUI):
This command starts the graphical user interface on your Raspberry Pi, if one is installed.
Rebooting the system
This command reboots your Raspberry Pi.
Shutting down the system
This command shuts down your Raspberry Pi immediately.
Web Server Setup
Updating the system
This command updates the package list and upgrades the installed packages to their latest versions.
Installing the Apache web server and PHP:
This command installs the Apache web server and PHP on your Raspberry Pi. It allows you to host web pages and run PHP scripts.
Installing MySQL
This command installs the MySQL database server, client, and the necessary PHP extension for interacting with MySQL databases.
Restarting the Apache web server
This command restarts the Apache web server to apply any configuration changes.
Audio Playback
Playing an audio file
This command plays an audio file named "audio.mp3" using the omxplayer, which is a command-line media player for the Raspberry Pi.
Adjusting the volume:
Press
+
to increase the volume.Press
-
to decrease the volume.
Remote Control
Installing XRDP for remote desktop access
This command installs the XRDP server, which allows you to access your Raspberry Pi's desktop environment remotely using the Remote Desktop Protocol (RDP).
Installing VNC server for remote access
This command installs the VNC server, which enables remote access to your Raspberry Pi's desktop environment.
Starting the VNC server
This command starts the VNC server on your Raspberry Pi.
The Ethernet port for VNC is
5900
.The WLAN (Wi-Fi) port for VNC is
5901
.
File Sharing
Installing file sharing support
This command installs the Netatalk package, which provides file sharing capabilities using the Apple Filing Protocol (AFP).
Connecting to the Raspberry Pi's file share from macOS:
Open the "Connect to Server" dialog using the shortcut
⌘K
.Enter the following address:
afp://192.168.64.xxx
, replacing "192.168.64.xxx" with the actual IP address of your Raspberry Pi.
These are just a few examples of the many commands and configurations available on the Raspberry Pi.
The Raspberry Pi offers a wide range of possibilities, and exploring the official documentation and community resources can help you discover more commands and features specific to your needs.
Remember to use commands with caution, especially those that require sudo privileges, as they can have significant impact on your system.
It's always a good practice to understand the purpose and potential consequences of a command before executing it.
Last updated
Was this helpful?