Commonly used fundamental Linux Commands in Raspberry Pi

by Dec 3, 2019IoT Programming, Raspberry Pi

When you open the Raspberry Pi terminal, the first thing to start with is to grab the upgrade of the OS. Then the update begins. Or, somehow you will need to install some packages. For these purposes, you will use Linux commands more often.

After reading this article, you may feel that Linux is not that tough and you may get well versed in the usage. I have updated the list restricted to the use of Raspberry Pi, but remember that Linux has a huge base of commands.

General Commands

apt-get

Installs, upgrades and uninstalls packages.

First, we will learn to install a package or a language maybe.

1. For example, Pylint is a package for the Python and for installing the package you have to give the above command.

sudo apt-get install pylint

2. This will list the packages it wants to install, tell you how much space it needs for the download, and then get on with it when you tell it to.  Sometimes, it asks for Yes/No for upgrading the system. You have to press either Y or N to continue the upgrade.

sudo apt-get upgrade

3. To make sure the system is updated.

sudo apt-get update

4. To clear the previous commands and start over from the beginning

clear

5. To Shutdown the system

poweroff

6. To open the configuration in the Raspberry Pi

raspi-config

7. To reboot the Raspberry Pi

sudo reboot

How do I use sudo last command?

  1. Simply enter the command again adding sudo before the command.
  2. Press Up arrow to get the last command and put sudo in front of it.
  3. Enter sudo !!

8. To shutdown the Pi immediately

shutdown -h now

9. To shutdown the Pi at a specific time period at 11:20 AM

shutdown –h 11:20 

10. Opens the Linux text Editor with the new file name file.txt

nano file.txt

11. To find out who you are logged is as

whoami

12. To take a screenshot, that saves in the pi folder.

scrot

13. Lists the currently logged in users

w

14. Obtain information on the Linux computer with the kernel details.

uname -a
uname -r
uname -v
uname -s
  • -a an option to see everything
  • -s to see the kernal name
  • -r to view the release of the kernel
  • -v to view the kernel version

15. To set a password for the other user and self. for other user, just use sudo in front of the command.

sudo passwd iot

Here “iot” is the other user

File System

1. To list the files and folders in the current directory

ls

To list the files and folders in the current directory with a detailed listing (long)

ls -l

To include hidden files use the -a (all files) option

ls -lha

2. echo

The echo command prints (echoes) a string of text to the terminal window.

echo iot4beginners

The echo command can show the value of environment variables, for example, the $USER, $HOME, and $PATH environment variables.

echo $PATH
echo $USER
echo $HOME
echo iot4beginners >> out.txt

“iot4beginners” is written and saved as a file named out.txt

3. Creates a new directory named iot4beginners inside the current directory.

mkdir iot4beginners

4. To display the contents of the file

cat out.txt

5. To change the current directory of the some other directory

cd /home/pi

6. To remove or delete the file

rm out.txt

7. To create a new file in the current directory

touch man.txt

8. Removes the entire directory

rmdir iot4beginners

9. To copy the file or the entire directory

cp /home/pi/out.txt /home/pi/Magenta/

Networking Commands

1. To check the status or the ip address of the wired and wireless connection

ifconfig 

2. To check the status of the wireless adapter

iwconfig

3. To create a static IP address for the Ethernet adapter

sudo ip a add 192.168.88.xx/24 dev eth0

Creating a multiplication Skill in Alexa using python

Written By Monisha Macharla

Hi, I'm Monisha. I am a tech blogger and a hobbyist. I am eager to learn and explore tech related stuff! also, I wanted to deliver you the same as much as the simpler way with more informative content. I generally appreciate learning by doing, rather than only learning. Thank you for reading my blog! Happy learning!

RELATED POSTS

Advanced Generics: Higher-Order Functions

Advanced Generics: Higher-Order Functions

In our journey through TypeScript generics, we've covered the basics, interfaces, and classes. Now, it's time to explore advanced concepts by combining generics with higher-order functions. These functions, which take other functions as arguments or return them,...

Basic Usage of Generics in Typescript

Basic Usage of Generics in Typescript

Keypoints Show how to declare generic functions and classes in TypeScript. Provide examples of generic functions that work with different data types. Demonstrate the use of built-in generics like Array<T> and Promise<T>. Here's the content...

Getting Started with Bash Script : A Simple Guide

Getting Started with Bash Script : A Simple Guide

Introduction In this tutorial, we will be looking into Bash Script - a tool used by developers to increase productivity and manage tasks. A lot of professionals use it for tasks such as system administration, data crunching, web app development, automated backups,...

How to Extract REST API Data using Python

How to Extract REST API Data using Python

Introduction In this tutorial, we will be discussing in detail on how to extract REST API data using Python. It is one of the most popular APIs and is used by a majority of applications. We will be using VS code editor for executing the python code. The extracted API...

Create a Simple ReactJs Application – Part 1

Create a Simple ReactJs Application – Part 1

ReactJs is one of the famous front-end open-source libraries of JavaScript developed by Facebook. It aims to allow developers to quickly create fast user interfaces for websites and applications. In this blog, we will create a simple and basic ReactJs...

Create a Simple ReactJs Application – Part 2

Create a Simple ReactJs Application – Part 2

In the tutorial's last part, we discussed about ReactJs and how to run a simple react app on a web browser. In this part, we will dig more into some interesting stuff, such as creating a home, about us, and contact pages. Click here for the first part - Create a...

VIDEOS – FOLLOW US ON YOUTUBE

EXPLORE OUR IOT PROJECTS

IoT Smart Gardening System – ESP8266, MQTT, Adafruit IO

Gardening is always a very calming pastime. However, our gardens' plants may not always receive the care they require due to our active lifestyles. What if we could remotely keep an eye on their health and provide them with the attention they require? In this article,...

How to Simulate IoT projects using Cisco Packet Tracer

In this tutorial, let's learn how to simulate the IoT project using the Cisco packet tracer. As an example, we shall build a simple Home Automation project to control and monitor devices. Introduction Firstly, let's quickly look at the overview of the software. Packet...

All you need to know about integrating NodeMCU with Ubidots over MQTT

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

All you need to know about integrating NodeMCU with Ubidots over Https

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

How to design a Wireless Blind Stick using nRF24L01 Module?

Introduction Let's learn to design a low-cost wireless blind stick using the nRF24L01 transceiver module. So the complete project is divided into the transmitter part and receiver part. Thus, the Transmitter part consists of an Arduino Nano microcontroller, ultrasonic...

Sending Temperature data to ThingSpeak Cloud and Visualize

In this article, we are going to learn “How to send temperature data to ThingSpeak Cloud?”. We can then visualize the temperature data uploaded to ThingSpeak Cloud anywhere in the world. But "What is ThingSpeak?” ThingSpeak is an open-source IoT platform that allows...

Amaze your friend with latest tricks of Raspberry Pi and Firebase

Introduction to our Raspberry Pi and Firebase trick Let me introduce you to the latest trick of Raspberry Pi and Firebase we'll be using to fool them. It begins with a small circuit to connect a temperature sensor and an Infrared sensor with Raspberry Pi. The circuit...

How to implement Machine Learning on IoT based Data?

Introduction The industrial scope for the convergence of the Internet of Things(IoT) and Machine learning(ML) is wide and informative. IoT renders an enormous amount of data from various sensors. On the other hand, ML opens up insight hidden in the acquired data....

Smart Display Board based on IoT and Google Firebase

Introduction In this tutorial, we are going to build a Smart Display Board based on IoT and Google Firebase by using NodeMCU8266 (or you can even use NodeMCU32) and LCD. Generally, in shops, hotels, offices, railway stations, notice/ display boards are used. They are...

Smart Gardening System – GO GREEN Project

Automation of farm activities can transform agricultural domain from being manual into a dynamic field to yield higher production with less human intervention. The project Green is developed to manage farms using modern information and communication technologies....