Raspberry Pi commands allow us to work on a wide range of applications. From building a prototype to developing an existing software, Raspberry Pi can provide the support.
In this blog, you will learn 5 really useful commandline tools to use your Raspberry Pi or Raspberry PLC in a safe environment.
Let's see the most basic and commonly used Raspberry Pi Commands
Vcgencmd is a command line utility that can get various pieces of information from the VideoCore GPU on the Raspberry Pi.
It is important to know the raspberry temperature, because excessive heat can lead you to unwanted situations. In fact, those who overclocked the processor of the Raspberry, must check the temperature frequently, because all the Raspberry pi models perform a degree of thermal management to avoid overheating under heavy load. The SoCs have an internal temperature sensor, which software on the GPU polls to ensure that temperatures do not exceed a predefined limit.
When the core temperature is between 80ºC and 85ºC, a warning icon showing a red half-filled thermometer will be displayed, and the ARM cores will be progressively throttled back.
So, use measure_temp option, to get the temperature of the SoC (System on Chip) as measured by the on-board temperature sensor, to help you with the temperature control of your device.
Check out the next URL to know more about vcgencmd:
Htop is a really powerful command line utility that allows you to interactively monitor your system's vital resources or server processes in real-time.
It is quite similar to the top command. However, since htop is a newer program compared to top, it offers many improvements.
Htop also supports mouse operations, uses colors in its outputs and gives visual indications about processor, memory and swap usage.
It also prints full command lines for processes and allows one to scholl both vertically and horizontally for processes and commandlines respectively.
You can install it by doing:
sudo apt update
sudo apt install htop
So, if you run htop in the command line, you will get something like this:
Finally, if you click on F1, you will get some help about the possibilities and you will see how it works.
The linux kernel is the core of the operating system that controls access to the system resources, such as CPU, I/O devices, physical memory, and file systems. The kernel writes several messages to the kernel ring buffer during the boot process and when the system is running.
The kernel ring buffer is a portion of the physical memory that holds the kernel's log messages. It has a fixed size, which means that once the buffer is full, the older logs records are overwritten.
Dmsg is used to examine or control the kernel ring buffer. It is really useful for examining kernel boot messages and debugging hardware related issues. The default action is to display all messages from the kernel ring buffer.
So, just execute it like:
If you see that the dmesg command shows too many messages that you are not able to read, then find the words you really want to find using | grep:
dmesg | grep eth0
To know more about this command and its options, just type:
Comma and braces operators
We can do lot with comma and braces operations, to make out life easier, let's see few usages:
Rename and backup operations with comma & braces operators
Pattern matching with comma & braces operator
Rename and backup (prefixing name) operations on long file names
To copy files from a parent directory without typing two times the long path
1.- To backup hello.txt to hello.txt.bak:
2.- To revert the file from hello.txt.bak to hello.txt:
3.- To rename the file with prefix "1-":
cp hello.txt 1-!#^
4.- To copy files from a parent directory without typing two times the long path
Ctrl + R
Can you image that you could autocomplete your commands with the ones that you typed before? Something like Google Autocomplete. Would be really useful, right? That is possible opening up a terminal windows and just trying the following:
Ctrl + R
2. Start typing your command and some suggestion will appear:
3. If you want to type the suggested command, then click on the Tab, or the right arrow of your keyboard, and that suggested command will be set on your commandline ready to use. In case you want to see more suggested commands, then try Ctrl + R again until you see the command you want to execute.
Finally, some tricky commands
1. Type "rev" to reverse the message to type:
2. Type "factor <number>" to factor any number:
3. Finally, just type the following, and see what happens:
apt-get --help | grep -i cow