LECTURE - 2 (AIOT) Essential Linux Commands
LECTURE - 2 (AIOT) Essential Linux Commands
LECTURE - 2 (AIOT) Essential Linux Commands
(CSE 2198)
(LECTURE – 2)
What Is Outcome-Based Education? OBE Vs
Traditional Education System
Outcome-based education is a system where all the parts and aspects of
education are focused on the outcomes of the course. The students take up
courses with a certain goal of developing skills or gaining knowledge and
they have to complete the goal by end of the course.
There is no specific style or time limit of learning. The student can learn as
per their choice. The faculty members, moderators, and instructors guide
the students based on the target outcomes.
Benefits Of Outcome-Based Education (OBE)
For Students
Grading Pattern : 1
Credit : 4
TextBook: • 1) Practical Python Programming
for IoT: Build advanced IoT projects using a
Raspberry Pi 4, MQTT, RESTful APIs,
WebSockets, and Python 3 by Gary Smart, Packt
Publishing
2) Raspberry Pi Cookbook by Simon Monk,
shroff/O’Reilly
Evaluation Scheme
ATTENDANCE : 5
WEEKLY ASSIGNMENTS / QUIZZES : 20 MID-TERM
MID TERM : 15
TOTAL INTERNAL : 40
END TERM: 45
LAB BASED PROJECT : 15 END-TERM
TOTAL EXTERNAL : 60
Course Outcomes
Course Outcomes
Apply foundational principles of Python programming and configure
CO1 Raspberry Pi to develop IoT solutions.
Design IoT networking solutions employing RESTful APIs, Web Sockets, and
CO2 MQTT protocol.
CO3 Integrate sensors and actuators with Raspberry Pi to acquire and process
real-world data.
Develop IoT applications for environmental monitoring, control, and
CO4 automation.
Implement multithreading and asynchronous programming methodologies
CO5 for efficient IoT applications.
CO6 Analyze end-to-end IoT solutions for performance, scalability, and security.
What Students will learn?
1.Programming with Python and Raspberry Pi: Students will gain proficiency in Python programming language
and learn how to use it in conjunction with the Raspberry Pi platform for IoT applications.
2.Setting Up Development Environment: They will learn how to set up their development environment on the
Raspberry Pi, including necessary software and configurations.
3.Understanding IoT Concepts: Students will understand the fundamental concepts of the Internet of Things (IoT),
including its applications, architecture, and potential impact.
4.Networking with RESTful APIs and Web Sockets: They will learn how to implement networking functionalities
using RESTful APIs and Web Sockets, enabling communication between IoT devices and other systems.
5.Networking with MQTT Protocol: Students will understand the MQTT protocol and its application in IoT
communication, including setting up and using the Mosquitto MQTT broker.
6.Connecting Raspberry Pi to the Physical World: They will learn how to connect Raspberry Pi to various sensors,
actuators, and other physical components to interact with the real world.
7.Electronics Fundamentals: Students will gain a basic understanding of electronics principles, including GPIO pins,
sensors, motors, and actuators.
8.IoT Visualization and Automation Platforms: They will explore different IoT visualization and automation
platforms, learning how to visualize data and automate processes in IoT applications.
9.Integration and Tying It All Together: Finally, students will learn how to integrate various components, concepts,
and platforms to develop comprehensive IoT solutions, tying together their knowledge and skills acquired
throughout the course.
Install the latest packages
ADD/REMOVE Panel items
ADD/REMOVE Panel items
Change the
Background and
Foreground like this
Learning Basic Linux Commands
Linux is an open operating system based on Unix and has been developed collaboratively by many companies
and universities since 1991.
In general, Linux is harder to manage than some other operating systems like Windows, but offers more flexibility
and wider configuration options.
There are several popular versions of the Linux operating system such as Debian, Ubuntu, Red Hat, Fedora and
so on.
You also don’t need to know all these commands by heart; you can always access this PPT LECTURE - 2 as a
reference to remind you how to do something.
When you first open the terminal, it will open up in your home folder (as you’ve seen with the pwd command). You
can display exactly what kind of files or folders are in the working directory with ls:
pi@raspberry:~ $ ls
Right now your directory is empty, so you won’t see anything when you try to list your files and folders.
Navigating the file system
Navigating the file system
Want to create a new folder? Usemkdir followed by the name you want to give the
folder:
To navigate, we’ll be using the cd command, followed by the location you want to
move to. This can be done like so:
pi@raspberry:~ $ cd NewFolder
pi@raspberry:~/NewFolder $
This moved you to the NewFolder directory that you just created.
pi@raspberry:~/NewFolder $ cd ..
pi@raspberry:~ $ ls
NewFolder
Now start writing your cd command again…
pi@raspberry:~ $ cd NewF
… by pressing Tab when you’ve only written ‘NewF’ It will autocomplete the file path:
pi@raspberry:~ $ cd NewFolder
Finally, there are some quick commands you can use to manipulate files. Create a new file with the touch command:
pi@raspberry:~/NewFolder $ rm NewFile.txt
pi@raspberry:~/NewFolder $ ls
OtherFile.txt
pi@raspberry:~ $ cd
pi@raspberry:~ $ nano OtherFile.txt
Nano will follow the path and open that file if it exists.
If it does not exist, it’ll start a new buffer with that file
name in that directory.
The software comes in what are called packages — software programs that can be downloaded from the Internet
and installed simply by typing a command in the prompt.
To download and install these packages, you normally use a package manager, which downloads and installs not
only the software you requested but also all other required software, known as dependencies.
To manage your software, you need the authorization of the administrator, whom you already know as the
superuser. To do so, type sudo (superuser do) before a command.
Updating and Upgrading
Updating and Upgrading
Updating and Upgrading
Upgrade Raspbian To The Latest Version
Upgrade Raspbian To The Latest Version
Upgrade Raspbian To The Latest Version
Upgrade Raspbian To The Latest Version
Update Python on Raspberry Pi
First and foremost, you have to update the list of available package versions that your package manager is aware
of. (The package manager keeps such a list in the Raspberry’s file system.) Type the following command:
Next, you should update the software, which you can achieve by commanding apt to upgrade. This command
upgrades all the packages you’ve installed to their most recent versions:
In terms of wording, the difference between updating and upgrading is subtle, but what they do is quite different
(even though they’re usually done together).
sudo apt-get update updates the list of available package versions but doesn’t install or upgrade any of them,
whereas sudo apt-get upgrade updates the packages themselves, checking the list to do so. For that reason, you
should always run update before upgrade.
Installing , Running and Removing software
To install a package for which you already know the name, you have to type the following command:
pi@raspberry:~ $ python
This opens the Python interpreter we will explore in the next Module.
To remove software from your RPi, you resort to the apt package manager once more. Here’s an example:
This command, however, leaves behind files that are somehow related to the software, such as configuration files
and logs. If you don’t intend to use those files in any way, you can remove everything by using purge:
Do not remove any package that you didn’t install yourself unless you’re absolutely certain that you know what it’s
for. It may be a necessary package that comes with the Linux OS, and removing it may lead to a system crash.
Changing the Raspberry Pi Default Settings
To change the Raspberry Pi configurations you can use a tool written by Alex Bradbury. To open the configuration
tool, simplRaspberry Pi configurations,y run the following from the command line:
The sudo is required, because you will be changing files that you do not own as the pi user.
You should see a blue screen with options in a grey box in the center:
raspi-config aims to provide the functionality to make the most common configuration changes. keep in mind that
some options require a reboot to take effect. If you changed any of those, raspi-config will ask if you wish to reboot
now when you select the<Finish> button.
Changing the Raspberry Pi Default Settings
It has the following options available:
1.Expand Filesystem
3.Boot Options
5.Internationalisation Options
6.Enable Camera
7.Add to Rastrack
8.Overclock
9.Advanced Options
10.About raspi-config
Expanding your file system
I recommend expanding your file system.
To shut down your Raspberry Pi, simply type this command on the command line:
You see the following information after you use the shutdown command:
Shutting Down and Rebooting
To reboot, type this:
/: root directory
Exploring the Linux File System
../: go to one up
directory
Exploring the Linux File System
Remove Putty
Exploring the Linux File System
Creating another
directory “Scratch” to
move files
Exploring the Linux File System
Exploring the Linux File System
Copy a File
Exploring the Linux File System
In Linux we just
“Keeping Track of Paths”
Exploring the Linux File System
Remove a File
Exploring the Linux File System
Remove a Directory
Exploring the Linux File System
Exploring the Linux File System
Ctrl + O : Save
Ctrl + X : Exit
Exploring the Linux File System
Ctrl + O : Save
Ctrl + X : Exit
Exploring the Linux File System
Ctrl + O : Save
Ctrl + X : Exit
mkdir Make directory mkdir my_folder ssh Secure Shell, remote login ssh username@hostname
scp file.txt
rm file.txt or rm -r Securely copy files between
rm Remove files or directories scp username@hostname:/destin
my_folder machines
ation
cp file.txt
cp Copy files or directories df Display disk space usage df -h
/destination_folder
mv file.txt
mv Move or rename files or directories new_location or mv free Display system memory usage free -m
old_name new_name
METHOD - 1
Use apt command to fix broken packages
Use apt command to fix broken packages on Raspberry Pi OS
The apt command is a terminal-based package management tool used for installing, updating
or upgrading the packages on Raspberry Pi OS. Along with these features, it also has the
potential to fix those broken packages that prevent you from installing any package onto your
Raspberry Pi OS.
If at any stage, you will encounter a broken packages error while installing a package onto
your Raspberry Pi, then you should run the following command in the terminal which might
fix the issue.
Now, when you perform the following command, you will need to choose an option
between “y” or “n” and you should press “y” key on the three requests which appears
on your terminal window. This will prepare the installation of the required packages for
your Raspberry Pi.
Use apt command to fix broken packages
Once it is done, you will need to provide a force for the installation of required
packages which are ready to be upgraded and for that you will be required to execute
the below given command in the terminal.
Once it is done, you can repeat the installation process again to check whether your
package installs without any error.
How to fix broken packages
on Raspberry Pi OS
METHOD - 2
Use apt command to fix broken packages
To encounter the error of “broken install”, you should execute the below mentioned
command the terminal.
$ sudo apt --fix-broken install
Once you execute the above command, you can then go on to install the package again
and hope it works.
How to fix broken packages
on Raspberry Pi OS
METHOD - 3
Use apt command to fix broken packages
If the problem still won’t be solved while trying everything possible then you should
provide a full-upgrade of your Raspberry Pi OS as it might install the required packages
needed to install an application and also it will remove the older packages on your
Raspberry Pi OS that prevents your OS from installing a package.
METHOD - 4
Configure dpkg to fix broken packages
If you are still experiencing the broken packages error while attempting every apt
command then there might be some issue in the setup process which is handled by
Debian package manager(dpkg). So, instead of selecting to go with the apt command,
you will have to fix the problem through dpkg configuration. The following command will
need to be executed in the terminal first which will force the dpkg to reconfigure the
broken packages which have not yet been installed on the Raspberry Pi device.
Once it is done, you can then use the apt command to cleanup the system.
Installing packages on Raspberry Pi is quite a basic operation until you encounter broken
package errors. You are suggested to stay with installing those programs which are useful
as installing unnecessary packages would create a mess and problems that would be
hard to figure out. In case the broken packages problem occurs, you might need help
sorting them out and the above methods will be handy in that case, providing you with
some commands to correct such errors.