Raspberry Pi Commands: General, Networking, Internet, File & System Information

The Raspberry Pi is an easy, charge card measured PC that connects to a PC screen or TV, and utilises a standard console and mouse. It is an able little gadget that empowers individuals, all things considered, to investigate processing, and to figure out how to program in dialects like Scratch and Python.

What is Raspberry Pi?

Getting your Raspberry Pi ready for action is pretty simple—and whatever venture you’re doing, there’s presumably a guide that can walk you through the cycle. Be that as it may, a couple of devices and terminal commands you’ll use in pretty much every Pi attempt. 

Since most Pi ventures run on Linux, having some command-line hacks makes the Pi a lot simpler to work with. In any case, regardless of whether you’re not a Linux veteran, these commands can encourage you a great deal as you tinker, so it’s a smart thought to get comfortable with them now.

What are the Raspberry Pi Commands?

The Raspberry Pi is an easy, charge card measured PC that connects to a PC screen or TV, and utilises a standard console and mouse. It is an able little gadget that empowers individuals, all things considered, to investigate processing, and to figure out how to program in dialects like Scratch and Python.

How would I utilise the Raspberry Pi command line? 

Open Raspberry Pi Configuration (Menu > Preferences > Raspberry Pi Configuration). Change the Boot setting ‘To CLI’ and snap OK. Presently when you reboot, you’ll start in the command line (enter startx to boot into the work area).

General Commands

apt-get update: Updates the rundown of bundles on your framework to the rundown in the vaults. Use it before putting in new bundles to ensure you are introducing the most recent form.

apt-get upgrade: Redesigns the entirety of the product bundles you have introduced. 

startx: Opens the Graphical User Interface.

clear: Clears recently run orders and text from the terminal screen. 

date: Prints the current date.

find / -name text1.txt: Searches the whole system for the file text1.txt and outputs a list of all directories that contain the file.

reboot: To reboot immediately.

nano text.txt: Opens the file text.txt in the Linux text editor Nano.

poweroff: To shutdown immediately.

raspi-config: Opens the configuration settings menu.

shutdown -h now: To shutdown immediately.

shutdown -h 11:11: To shutdown at 11:11 AM.

File And Directory Commands

mv YYY:  Moves the file or directory named YYY to a specified location. 

rm text.txt: Deletes the file text.txt.

rmdir a_directory: Deletes(if it is empty) the directory a_directory .

cat text.txt:  Displays the contents of the file text.txt.

cd /abc/xyz: Changes the current directory to the /abc/xyz directory.

cp XXX: Copies the file or directory XXX and pastes it to a specified location

mkdir text_directory:  Creates a new directory named text_directory inside the current directory.

scp user@10.1.1.30:/some/path/ftext.txt: Copies a file over SSH. Can be used to download a file from a PC to the Raspberry Pi. user@10.1.1.30 is the username, and local IP address of the PC, and /some/path/text.txt is the path and file name of the file on the PC.

touch text.txt: Creates a new, empty file named text.txt in the current directory.

ls -l: Lists files in the current directory, along with file size, date modified, and permissions.

Networking and Internet Commands

ifconfig: To check the status of the remote association you are utilising (to check whether wlan0 has obtained an IP address). 

ping: Tests availability between two gadgets associated with an organisation. For instance, ping 10.0.0.32 will send a parcel to the gadget at IP 10.0.0.32 and sit tight for a reaction. It additionally works with site addresses. 

wget http://www.website.com/text.txt: Downloads the file text.txt from the web and saves it to the current directory.

iwconfig: To check which network the wireless adapter is using.

iwlist wlan0 scan: Prints a list of the currently available wireless networks.

iwlist wlan0 scan | grep ESSID: Use grep along with the name of a field to list only the fields you need 

Nmap: Sweeps your organisation and records associated gadgets, port number, convention, state (open or shut) working framework, MAC addresses, and other data.

Also Read: Raspberry Pi Project Ideas

System Information Commands

cat /proc/meminfo:  Shows details about your memory.

cat /proc/partitions:  Shows the size and number of partitions on your SD card or hard drive.

cat /proc/version:  Shows you which version of the Raspberry Pi you are using.

df -h:  Shows information about the available disk space.

free:  Shows how much free memory is available.

hostname -I:  Shows the IP address of your Raspberry Pi

lsusb:   Lists USB hardware connected to your Raspberry Pi

UP key: Pressing the UP key will print the last command entered into the command prompt. This is a quick way to repeat previous commands or make corrections to commands.

df /: Shows how much free disk space is available.

vcgencmd measure_temp: Shows the temperature of the CPU.

vcgencmd get_mem arm && vcgencmd get_mem gpu: Shows the memory split between the CPU and GPU.

dpkg – -get-selections | grep XXX: Shows all of the installed packages that are related to XXX.

dpkg – -get-selections: Shows all of your installed packages.

Each command can do a lot more of what I have shown here. To check out what more it can do, try “–help” after the command. 

Must Read: Raspberry Pi IoT Projects

Conclusion

For some individuals, command-line access on any stage is scary. The helpful commands recorded here are an endeavour to give the Raspberry Pi newcomer the absolute minimum, to begin with, the terminal, a little stepping stone to progress with whichever Pi venture they choose to begin.

Also, If you’re interested to learn more about Raspberry Pi, machine learning, check out IIIT-B & upGrad’s PG Diploma in Machine Learning & AI which is designed for working professionals and offers 450+ hours of rigorous training, 30+ case studies & assignments, IIIT-B Alumni status, 5+ practical hands-on capstone projects & job assistance with top firms.

Machine learning course | Learn Online, IIIT Bangalore‎

PG DIPLOMA IN MACHINE LEARNING AND AI WITH UPGRAD AND IIIT BANGALORE.
Learn More

Leave a comment

Your email address will not be published.

Accelerate Your Career with upGrad

Our Popular Machine Learning Course

×