Getting started with setting up embedded platform requires audience to understand some of the key aspects of Linux. Starting with basics of Linux this presentation talks about basic commands, vi editor, shell scripting and advanced commands
Linux has become integral part of Embedded systems. This three part presentation gives deeper perspective of Linux from system programming perspective. Stating with basics of Linux it goes on till advanced aspects like thread and IPC programming.
This document provides an overview of Linux internals and networking concepts covered in 3 sentences or less:
It introduces Linux internals topics like processes, memory management, and virtual file systems. It also discusses networking concepts and provides a brief history of operating systems development. The document contains various sections on Linux components, kernel subsystems, virtual file systems, and transitioning to systems programming.
Linux is an operating system or a kernel. It is distributed under an open source license. Its functionality list is quite like UNIX. Linux is an operating system or a kernel which germinated as an idea in the mind of young and bright Linus Torvalds when he was a computer science student. The main advantage of Linux was that programmers were able to use the Linux Kernel to design their own custom operating systems. With time, a new range of user-friendly OS's stormed the computer world. Now, Linux is one of the most popular and widely used Kernel, and it is the backbone of popular operating systems like Debian, Knoppix, Ubuntu, and Fedora.
Embedded Linux provides a standardized operating system solution for embedded systems through the Linux kernel. The Linux kernel abstracts the underlying hardware and provides drivers to interface with hardware peripherals. This allows application developers to focus on their code without needing to manage low-level hardware interactions. A bootloader initializes the hardware and loads the Linux kernel from memory. The kernel then loads and runs programs stored in the filesystem. Cross-compilers allow the same source code to target different processor architectures. Libraries and drivers help share code and resources across applications and hardware.
This document provides an introduction to key concepts in embedded systems including embedded system components, requirements, trends, common design metrics, development tools, communication protocols like I2C and SPI, and real-time operating systems (RTOS). It defines embedded systems and how they differ from general purpose systems. It also discusses RTOS features like multitasking, task priority, inter-task communication, and how they help achieve real-time capabilities. Key sections of the RTOS are identified including task management, scheduling, synchronization, and interrupt handling.
- Shell scripting allows users to automate repetitive tasks by writing scripts of shell commands that can be executed automatically. The shell acts as an interface between the user and the operating system kernel, accepting commands and passing them to the kernel for execution. Common shells used for scripting include Bash, C Shell, and Korn Shell. Shell scripts use shell commands, control structures, and functions to perform automated tasks like backups and system monitoring.
In Embedded system a set of applications used to perform a complex task or to create a product, which is typically another computer program or a system of programs. Tools are linked (or chained) together by specific stages. Output or resulting environment state of the tool becomes input or starting environment for the next one. By default the host contains some development tools which are called native tool-chain. Here is the presentation that shares mode details on components of tool-chain and how to build them for your own embedded distribution.
Buildroot is a tool that generates embedded Linux systems by automating the configuration, compilation, and packaging of the system. It produces a root filesystem image ready to deploy on the target architecture. The build process compiles packages and a cross-compilation toolchain, then generates images containing the root filesystem, kernel, and other files needed by the target system. The output of Buildroot is organized into subdirectories containing the built images, toolchain, target and host files, and a staging area simulating the target filesystem.
An unique module combining various previous modules you have learnt by combing Linux administration, Hardware knowledge, Linux as OS, C/Computer programming areas. This is a complete module on Embedded OS, as of now no books are written on this with such practical aspects. Here is a consolidated material to get real hands-on perspective about building custom Embedded Linux distribution in ARM.
A Linux device driver summary:
1. Device drivers are implemented as kernel modules that can be dynamically loaded and unloaded. They provide access to hardware devices through the file system.
2. There are three main types of device drivers: character, block, and network. Character drivers provide a stream of bytes interface, block drivers handle block-based storage, and network drivers manage network interfaces.
3. The file_operations structure contains function pointers that drivers implement to handle operations like open, close, read, and write on character devices. This structure associates the driver with a major/minor number range allocated using functions like alloc_chrdev_region.
Embedded Systems are basically Single Board Computers (SBCs) with limited and specific functional capabilities. All the components that make up a computer like the Microprocessor, Memory Unit, I/O Unit etc. are hosted on a single board. Their functionality is subject to constraints, and is embedded as a part of the complete device including the hardware, in contrast to the Desktop and Laptop computers which are essentially general purpose (Read more about what is embedded system). The software part of embedded systems used to be vendor specific instruction sets built in as firmware. However, drastic changes have been brought about in the last decade driven by the spurt in technology, and thankfully, the Moore’s Law. New, smaller, smarter, elegant but more powerful and resource hungry devices like Smart-phones, PDAs and cell-phones have forced the vendors to make a decision between hosting System Firmware or full-featured Operating Systems embedded with devices. The choice is often crucial and is decided by parameters like scope, future expansion plans, molecularity, scalability, cost etc. Most of these features being inbuilt into Operating Systems, hosting operating systems more than compensates the slightly higher cost overhead associated with them. Among various Embedded System Operating Systems like VxWorks, pSOS, QNX, Integrity, VRTX, Symbian OS, Windows CE and many other commercial and open-source varieties, Linux has exploded into the computing scene. Owing to its popularity and open source nature, Linux is evolving as an architecturally neutral OS, with reliable support for popular standards and features
Often called as the Swiss Army Knife of Embedded Linux, BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. It is written with size-optimization
and limited resources in mind. Here is a presentation that details about BusyBox.
The second part of Linux Internals covers system calls, process subsystem and inter process communication mechanisms. Understanding these services provided by Linux are essential for embedded systems engineer.
Android Things is the latest attempt from Google to connect the dots between the cloud and devices by introducing an OS that is exclusively built for IoT devices. Initially announced as project Brillo, Android Things helps developers to build devices faster and enable them integrate with cloud services. This presentation traces the architectural aspects of Android Things by connecting it back with Embedded Linux, Embedded Android and Brillo.
This course gets you started with writing device drivers in Linux by providing real time hardware exposure. Equip you with real-time tools, debugging techniques and industry usage in a hands-on manner. Dedicated hardware by Emertxe's device driver learning kit. Special focus on character and USB device drivers.
Understanding the Android System ServerOpersys inc.
This document discusses the Android system server. It provides an overview of the bootup sequence where the system server is started. It then describes some of the key services run by the system server, such as the activity manager, package manager, window manager, and others. It also discusses how to observe the system server in action using logcat and how applications interface with system services via Binder.
The U-Boot is an "Universal Bootloader" ("Das U-Boot") is a monitor program that is under GPL. This production quality boot-loader is used as default boot loader by several board vendors. It is easily portable and easy to port and to debug by supporting PPC, ARM, MIPS, x86,m68k, NIOS, Microblaze architectures. Here is a presentation that introduces U-Boot.
The embedded Linux boot process involves multiple stages beginning with ROM code that initializes hardware and loads the first stage bootloader, X-Loader. The X-Loader further initializes hardware and loads the second stage bootloader, U-Boot, which performs additional initialization and loads the Linux kernel. The kernel then initializes drivers and mounts the root filesystem to launch userspace processes. Booting can occur from flash memory, an eMMC/SD card, over a network using TFTP/NFS, or locally via UART/USB depending on the boot configuration and available devices.
The document summarizes the 6 main steps of the Linux booting process:
1) BIOS performs initial checks and loads the master boot record (MBR) from the hard drive.
2) The MBR loads the GRUB boot loader.
3) GRUB loads and executes the Linux kernel and initrd images.
4) The kernel initializes hardware and mounts the initrd, then loads modules and root partition.
5) The init process reads /etc/inittab to determine the default runlevel and loads appropriate programs.
6) Runlevel programs like sendmail start based on the runlevel and sequence numbers in their names.
Facing interviews is both science and an art. Typically for freshers, it becomes very challenging to face interviews. Here is a presentation that gives you practical tips and inputs to crack interviews.
C has been the most commonly used language. This slideshare is all about the introduction to Advanced C. You will learn the fundamentals and the problem solving skills. You will also get an idea on building algorithms and the conditions regarding it. There are also slides which will give knowledge about operators and their types. As a whole you will gain knowledge on three important fundamentals of C.
Embedded Android system development workshop is focused on integrating new device with Android framework. Our hands-on approach makes Emertxe as the best institute to learn android system development training. This workshop deep dives into Android porting, Android Hardware Abstraction Layer (HAL), Android Services and Linux device driver ecosystem. This workshop based training program will enable you to efficiently integrate new hardware with Android HAL / Framework.
In order to understand HAL layers of Android Framework, having Linux device driver knowledge is important. Hence Day-2 of the workshop focuses on the same.
The document discusses the architecture of the Linux kernel. It describes the user space and kernel space components. In user space are the user applications, glibc library, and each process's virtual address space. In kernel space are the system call interface, architecture-independent kernel code, and architecture-dependent code. It then covers several kernel subsystems like process management, memory management, virtual file system, network stack, and device drivers.
The document summarizes how to write a character device driver in Linux. It covers the anatomy of a device driver including the user interface via device files, and kernel interfaces via file operations and major/minor numbers. It describes registering a character driver by defining file operations, reserving major/minor numbers, and associating them. Open and release functions handle initialization and cleanup. Read/write functions transfer data between userspace and hardware. Ioctl allows extending functionality.
The document provides an introduction to the C programming language and algorithms. It begins with an overview of C and its history. It then defines key concepts like keywords, data types, qualifiers, loops, storage classes, decision statements, and jumps. Examples of algorithms are provided for common problems like adding two numbers. Pattern printing algorithms are given as homework exercises. The document discusses where C is used and explains what a programming language and algorithms are. It emphasizes the importance of understanding requirements before implementation.
Data Structures, which is also called as Abstract Data Types (ADT) provide powerful options for programmer. Here is a tutorial which talks about various ADTs - Linked Lists, Stacks, Queues and Sorting Algorithms
Communication protocols (like UART, SPI, I2C) play an very important role in Micro-controlled based embedded systems development. These protocols helps the main board to communicate with different peripherals by interfacing mechanism. Here is a presentation that talks about how these protocols actually work.
Buildroot is a tool that generates embedded Linux systems by automating the configuration, compilation, and packaging of the system. It produces a root filesystem image ready to deploy on the target architecture. The build process compiles packages and a cross-compilation toolchain, then generates images containing the root filesystem, kernel, and other files needed by the target system. The output of Buildroot is organized into subdirectories containing the built images, toolchain, target and host files, and a staging area simulating the target filesystem.
An unique module combining various previous modules you have learnt by combing Linux administration, Hardware knowledge, Linux as OS, C/Computer programming areas. This is a complete module on Embedded OS, as of now no books are written on this with such practical aspects. Here is a consolidated material to get real hands-on perspective about building custom Embedded Linux distribution in ARM.
A Linux device driver summary:
1. Device drivers are implemented as kernel modules that can be dynamically loaded and unloaded. They provide access to hardware devices through the file system.
2. There are three main types of device drivers: character, block, and network. Character drivers provide a stream of bytes interface, block drivers handle block-based storage, and network drivers manage network interfaces.
3. The file_operations structure contains function pointers that drivers implement to handle operations like open, close, read, and write on character devices. This structure associates the driver with a major/minor number range allocated using functions like alloc_chrdev_region.
Embedded Systems are basically Single Board Computers (SBCs) with limited and specific functional capabilities. All the components that make up a computer like the Microprocessor, Memory Unit, I/O Unit etc. are hosted on a single board. Their functionality is subject to constraints, and is embedded as a part of the complete device including the hardware, in contrast to the Desktop and Laptop computers which are essentially general purpose (Read more about what is embedded system). The software part of embedded systems used to be vendor specific instruction sets built in as firmware. However, drastic changes have been brought about in the last decade driven by the spurt in technology, and thankfully, the Moore’s Law. New, smaller, smarter, elegant but more powerful and resource hungry devices like Smart-phones, PDAs and cell-phones have forced the vendors to make a decision between hosting System Firmware or full-featured Operating Systems embedded with devices. The choice is often crucial and is decided by parameters like scope, future expansion plans, molecularity, scalability, cost etc. Most of these features being inbuilt into Operating Systems, hosting operating systems more than compensates the slightly higher cost overhead associated with them. Among various Embedded System Operating Systems like VxWorks, pSOS, QNX, Integrity, VRTX, Symbian OS, Windows CE and many other commercial and open-source varieties, Linux has exploded into the computing scene. Owing to its popularity and open source nature, Linux is evolving as an architecturally neutral OS, with reliable support for popular standards and features
Often called as the Swiss Army Knife of Embedded Linux, BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. It is written with size-optimization
and limited resources in mind. Here is a presentation that details about BusyBox.
The second part of Linux Internals covers system calls, process subsystem and inter process communication mechanisms. Understanding these services provided by Linux are essential for embedded systems engineer.
Android Things is the latest attempt from Google to connect the dots between the cloud and devices by introducing an OS that is exclusively built for IoT devices. Initially announced as project Brillo, Android Things helps developers to build devices faster and enable them integrate with cloud services. This presentation traces the architectural aspects of Android Things by connecting it back with Embedded Linux, Embedded Android and Brillo.
This course gets you started with writing device drivers in Linux by providing real time hardware exposure. Equip you with real-time tools, debugging techniques and industry usage in a hands-on manner. Dedicated hardware by Emertxe's device driver learning kit. Special focus on character and USB device drivers.
Understanding the Android System ServerOpersys inc.
This document discusses the Android system server. It provides an overview of the bootup sequence where the system server is started. It then describes some of the key services run by the system server, such as the activity manager, package manager, window manager, and others. It also discusses how to observe the system server in action using logcat and how applications interface with system services via Binder.
The U-Boot is an "Universal Bootloader" ("Das U-Boot") is a monitor program that is under GPL. This production quality boot-loader is used as default boot loader by several board vendors. It is easily portable and easy to port and to debug by supporting PPC, ARM, MIPS, x86,m68k, NIOS, Microblaze architectures. Here is a presentation that introduces U-Boot.
The embedded Linux boot process involves multiple stages beginning with ROM code that initializes hardware and loads the first stage bootloader, X-Loader. The X-Loader further initializes hardware and loads the second stage bootloader, U-Boot, which performs additional initialization and loads the Linux kernel. The kernel then initializes drivers and mounts the root filesystem to launch userspace processes. Booting can occur from flash memory, an eMMC/SD card, over a network using TFTP/NFS, or locally via UART/USB depending on the boot configuration and available devices.
The document summarizes the 6 main steps of the Linux booting process:
1) BIOS performs initial checks and loads the master boot record (MBR) from the hard drive.
2) The MBR loads the GRUB boot loader.
3) GRUB loads and executes the Linux kernel and initrd images.
4) The kernel initializes hardware and mounts the initrd, then loads modules and root partition.
5) The init process reads /etc/inittab to determine the default runlevel and loads appropriate programs.
6) Runlevel programs like sendmail start based on the runlevel and sequence numbers in their names.
Facing interviews is both science and an art. Typically for freshers, it becomes very challenging to face interviews. Here is a presentation that gives you practical tips and inputs to crack interviews.
C has been the most commonly used language. This slideshare is all about the introduction to Advanced C. You will learn the fundamentals and the problem solving skills. You will also get an idea on building algorithms and the conditions regarding it. There are also slides which will give knowledge about operators and their types. As a whole you will gain knowledge on three important fundamentals of C.
Embedded Android system development workshop is focused on integrating new device with Android framework. Our hands-on approach makes Emertxe as the best institute to learn android system development training. This workshop deep dives into Android porting, Android Hardware Abstraction Layer (HAL), Android Services and Linux device driver ecosystem. This workshop based training program will enable you to efficiently integrate new hardware with Android HAL / Framework.
In order to understand HAL layers of Android Framework, having Linux device driver knowledge is important. Hence Day-2 of the workshop focuses on the same.
The document discusses the architecture of the Linux kernel. It describes the user space and kernel space components. In user space are the user applications, glibc library, and each process's virtual address space. In kernel space are the system call interface, architecture-independent kernel code, and architecture-dependent code. It then covers several kernel subsystems like process management, memory management, virtual file system, network stack, and device drivers.
The document summarizes how to write a character device driver in Linux. It covers the anatomy of a device driver including the user interface via device files, and kernel interfaces via file operations and major/minor numbers. It describes registering a character driver by defining file operations, reserving major/minor numbers, and associating them. Open and release functions handle initialization and cleanup. Read/write functions transfer data between userspace and hardware. Ioctl allows extending functionality.
The document provides an introduction to the C programming language and algorithms. It begins with an overview of C and its history. It then defines key concepts like keywords, data types, qualifiers, loops, storage classes, decision statements, and jumps. Examples of algorithms are provided for common problems like adding two numbers. Pattern printing algorithms are given as homework exercises. The document discusses where C is used and explains what a programming language and algorithms are. It emphasizes the importance of understanding requirements before implementation.
Data Structures, which is also called as Abstract Data Types (ADT) provide powerful options for programmer. Here is a tutorial which talks about various ADTs - Linked Lists, Stacks, Queues and Sorting Algorithms
Communication protocols (like UART, SPI, I2C) play an very important role in Micro-controlled based embedded systems development. These protocols helps the main board to communicate with different peripherals by interfacing mechanism. Here is a presentation that talks about how these protocols actually work.
There is a surge in number of sensors / devices that are getting connected under the umbrella of Internet-Of-Things (IoT). These devices need to be integrated into the Android system and accessed via applications, which is covered in the course. Our Android system development course curriculum over weekends with practicals ensures you learn all critical components to get started.
Coming up with optimized C program for Embedded Systems consist of multiple challenges. This presentation talks about various methods about optimizing C programs in Embedded environment. It also has some interesting tips, Do's and Dont's that will offer practical help for an Embedded programmer.
The document discusses process management in Linux, including scheduling, context switching, and real-time systems. It defines process scheduling as determining which ready process moves to the running state, with the goal of keeping the CPU busy and minimizing response times. Context switching is described as storing the state of a process when it stops running so the CPU can restore another process's state when it starts running. CPU scheduling decisions occur when a process changes state, such as from running to waiting. Real-time systems must meet strict deadlines, and the document discusses soft and hard real-time systems as well as differences between general purpose, real-time, and embedded operating systems.
Emertxe Information Technologies (http://www.emertxe.com) is a pioneer IT finishing school based out of Bangalore India. We offer best-in-class trainings (instructor lead, workshops, online) for making individuals business ready. Our portfolio consist of Embedded systems, Cloud computing, Mobile Application, Software Engineering.
In the Embedded side, Linux is been our center of everything we do. Our Linux portfolio consist of four major areas: Linux Systems, Embedded Linux, Linux Internals & Networking, Device drivers. Each area has multiple topics that can be targeted for students, corporate and universities. For any queries please feel free to write to us at [email protected]
File systems provide an organized way to store and access data on storage devices like hard drives. The Linux file system hierarchy standard defines a common structure across Linux distributions with directories like /bin, /etc, /home, /usr, and /var. Common Linux file system types include ext2, ext3, ext4 for disks, initramfs for RAM, and JFFS2 for flash storage. File systems can also be distributed across a network using NFS or optimized for specific purposes like squashfs for read-only files. Partitions divide available storage space to better manage files, users, and data security.
Embedded systems is a special purpose device that does a particular functionality in a most optimized way. Designed as a combination of custom HW & SW, programming Embedded systems require some special considerations to be taken care. Here is a presentation that gives introduction to embedded systems.
For new age touch-based embedded devices, Android is becoming a popular OS going beyond mobile phones. With its roots from Embedded Linux, Android framework offers benefits in terms of rich libraries, open-source and multi-device support. Emertxe’s hands-on Embedded Android Training Course is designed to customize, build and deploy custom Embedded OS on ARM target. Rich set of projects will make your learning complete.
This third part of Linux internals talks about Thread programming and using various synchronization mechanisms like mutex and semaphores. These constructs helps users to write efficient programs in Linux environment
Emertxe Certified Embedded Professional (ECEP) is a flagship job-oriented training program offered by Emertxe. This slide deck has induction detail about course structure and delivery.
The document discusses memory management concepts in Linux systems. It covers the role of the memory management unit (MMU) in hardware memory management, OS memory management, and application memory management. It describes the differences between logical (virtual) addresses generated by the CPU and physical addresses available in memory. It also discusses the differences between volatile, non-volatile, and hybrid memory. Key concepts like virtual memory, paging, page tables, translation lookaside buffers (TLBs), direct memory access (DMA), memory mapped I/O, port mapped I/O, CPU caches, and swapping are also explained.
Emertxe provides training programs to address the skills gap between industry needs and graduates. They offer three partnership models: 1) Providing skilled engineers through longer training programs. Graduates are trained and can be hired at no cost. 2) Taking ownership of corporate onboarding programs to quickly align new hires. 3) Delivering continuous learning programs on technical topics to help experienced employees enhance skills. The goal is to partner with companies to develop talent and meet their business needs through customized training solutions.
Preparing impressive resume is key in getting jobs. As entry level engineer is really important to build it by taking a step-by-step approach. Here are the set of slides that will help you to build resume in a practical way.
Embedded C is a subset of standard C used for programming embedded systems. It uses a cross compiler to convert source code into machine-level instructions for the target processor. Key aspects of Embedded C include data types, storage classes, arithmetic and logical operations, relational operations, and conditional branching instructions like if-else statements to direct program flow.
Embedded C programming based on 8051 microcontrollerGaurav Verma
This lecture note covers the embedded 'c' programming constructs based on 8051 microcontroller. Although the same concepts can be used for other advanced microcontrollers with some modifications.
This document provides an overview of Linux networking concepts relevant for interviews, including TCP/IP and socket programming. It begins with definitions of LAN, MAN, and WAN networks. It then covers the OSI and TCP/IP models, differences between hub/switch/router, TCP/IP addressing concepts like MAC addresses, IP addresses, ports, and IPv4 vs IPv6. Next it explains TCP/IP protocols like SNMP, ICMP, ARP/RARP, DNS, and DHCP. Finally it discusses socket programming concepts like sockets, client-server programming, and synchronous I/O using select().
The document provides an overview of Linux interview essentials related to operating system concepts, system calls, inter-process communication, and threads. It discusses topics such as the role and components of an operating system, multi-tasking and scheduling policies, differences between function calls and system calls, static and dynamic linking, common code and stack errors, memory leaks, kernel modes, monolithic and micro kernels, interrupts, exceptions, system calls implementation in Linux, and synchronous vs asynchronous communication methods.
Getting started with setting up embedded platform requires audience to understand some of the key aspects of Linux. This presentation deals with basics of Linux as an OS, Linux commands, vi editor, Shell features like redirection, pipes and shell scripting
Linux is a family of open-source operating systems used widely today. It originated from Linus Torvalds' development of the Linux kernel in 1991. There are many Linux distributions that package the kernel along with other software, and each has its own philosophy and uses. The document discusses key aspects of Linux including common commands, desktop environments, shells, files systems, users and permissions, package managers and more. It provides a high-level overview of the basics of using and working with the Linux operating system.
The document provides an outline for an introduction to Linux DevOps essentials training. It covers topics such as what Linux is, the Linux shell and file system structure, common Linux commands, changing file permissions and ownerships, installing packages, and writing shell scripts. Key points include that Linux was created by Linus Torvalds in 1991 as an open source operating system kernel, the shell is the interface used to communicate with the kernel via commands, and the Linux file system has a tree structure with directories like root, home, bin, etc.
This document provides an introduction to Linux and summarizes key topics including:
1. The history and development of Linux including influences from Multics and Unix as well as contributions from developers like Ken Thompson, Dennis Ritchie, and others.
2. Important related operating systems and distributions like BSD, Debian, Ubuntu, and others that helped shape Linux.
3. Core Linux concepts like the Unix philosophy, shells, files/file systems, users/permissions, and commands.
The document provides information about Linux OS and shell programming. It discusses the history and evolution of Linux from being a student project to a robust OS. Key people involved in its development like Richard Stallman, Linus Torvalds, and Andy Tanenbaum are mentioned. The architecture of Linux including kernel, system libraries, system utilities etc. is explained. Important commands, file system structure, file permissions and text editors in Linux are also summarized.
The document provides an introduction to operating systems, kernels, shells, Linux, and the differences between Linux and Windows. It discusses that an operating system consists of system software that acts as an intermediary between the user and computer hardware. The kernel is the core of the operating system and constantly runs, while the shell provides an interface between the user and kernel. It then covers Linux features such as being open source, modular, offering choices of desktop environments, and being portable. It also compares Linux and Windows in areas such as licensing, market share, filesystems, installation, and configuration.
Network and System Administration Power Pointkemal678348
System and network administration involves managing systems, hardware, software, user accounts, security, and more. The key tasks of a system administrator include user management, hardware/software management, monitoring systems, backups, troubleshooting, and ensuring smooth operations. They must also address security through practices like access controls, authentication, and maintaining privacy and integrity. Managing these complex systems requires skills in areas like networking, operating systems, scripting, and problem-solving.
This document provides an overview of the history and architecture of the Linux operating system. It discusses how Linux originated as a free alternative to proprietary operating systems like DOS, Mac OS, and UNIX. Key individuals in the development of Linux include Linus Torvalds and Richard Stallman. The document also outlines the core components of Linux like the kernel, shell, and system utilities, as well as common uses of Linux as a desktop, server, and firewall platform.
The document provides information about the Linux operating system, including its structure, components, history, and features. It discusses the kernel as the core component that manages devices, memory, processes, and system calls. It also describes system libraries, tools, and end user tools. The document outlines the history of Linux from its creation in 1991 to recent developments. It explains the architecture including the kernel, system libraries, hardware layer, and shells. Finally, it lists some key Linux commands like sudo, man, echo, and passwd.
This document provides an introduction to Linux, including an overview of Linux and its history, the Linux shell, popular Linux distributions, Linux accounts and access, and how to connect to a Linux server using SSH. It outlines the topics that will be covered in the DevOps Essentials training, such as Linux commands, file permissions, services, environment variables, processes, package installation, and shell scripts.
- Free and open source software began as a social movement promoting software freedom and sharing. Linux was developed as a free UNIX-like operating system to provide an alternative to proprietary systems like DOS, Mac OS, and UNIX.
- In 1991, Linus Torvalds began developing the Linux kernel, releasing it under the GNU General Public License to ensure it remained freely available. Thousands of developers soon contributed to the growing Linux system.
- Today Linux powers everything from supercomputers to smartphones. It is distributed both in its raw form and compiled into commercial distributions by vendors like Red Hat who offer support packages. The operating system's flexibility and widespread development community have led to its success.
Basic Information About Linux. This helps you to know about the basic details of linux, such as architecture, kernel design, process management, file management and etc.
This document provides an introduction to Linux and open source operating systems. It discusses what Linux is, how it was developed as an alternative to Unix, and some popular Linux distributions like Ubuntu, Fedora, and their desktop environments. It also covers installing and using Linux, installing software, programming on Linux, and using the Linux shell.
- Linux is an open-source operating system whose source code can be modified and redistributed under the GNU GPL license. It is commonly used for servers due to its low setup cost.
- Richard Stallman founded the Free Software Foundation in 1985 in response to companies restricting the sharing and redistribution of software code. He began developing GNU, an open-source OS compatible with Unix.
- In 1990, Linus Torvalds developed the Linux kernel, based on Andy Tanenbaum's Minix OS. When combined with the GNU operating system, this formed a complete open-source operating system now known as Linux.
This document provides an introduction to Linux, including its history and architecture. It describes Linux's origins from Unix in the 1960s and the development of the Linux kernel by Linus Torvalds in 1991. It outlines the key components of a Linux system, including the kernel, shell, file system, processes, networking, and desktop environments. It also discusses booting a Linux system and provides resources for learning more about Linux distributions and building your own operating system.
The document discusses implementing a function to check if a character is a hexadecimal digit. It explains that a hexadecimal digit ranges from 0-9, A-F, a-f in the ASCII table. It provides examples of inputting different characters and checking if they are hexadecimal digits or not. The sample execution section is empty. It lists functions as the prerequisite for understanding how to create a custom function to check for hexadecimal digits.
The document provides an example program to implement a student record system using an array of structures. It involves reading the number of students and subjects, student names and marks for each subject, calculating averages and grades. The program displays menus to view all student details or a particular student's details based on roll number or name. It demonstrates declaring a structure for student records, reading input into an array of structures, calculating averages and grades, and printing the student records with options to search by roll number or name.
This document discusses writing a macro called swap(t,x,y) that swaps two arguments of any data type t. It asks the user to input a data type and two values of that type, then swaps the values and displays the output. It explains how to swap two integers by using a temporary variable and applying the same concept to arguments of any type t by using macros. The objective is to understand macro preprocessing in C.
This document discusses defining a macro called SIZEOF to return the size of a data type without using the sizeof operator. It explains that by taking the difference of the addresses of a variable and the variable plus one, cast to char pointers, you can get the size in bytes. An example is provided using an integer variable x, showing how taking the difference of (&x+1) and &x after casting to char pointers returns the size of an int, which is 4 bytes. Background on macros and pointers is provided. The objective is stated as understanding macro usage in preprocessing.
The document describes a C program to multiply two matrices. It explains that the program takes input of rows and columns for Matrix A and B, reads in the element values, and checks that the column of the first matrix equals the row of the second before calculating the product. An example is provided where the matrices can be multiplied, producing the output matrix, and another where they cannot due to mismatched dimensions. Requirements for the program include pointers, 2D arrays, and dynamic memory allocation.
The document describes an assignment to read in an unspecified number (n) of names of up to 20 characters each, sort the names alphabetically, and print the sorted list. It provides examples of reading in 3 names ("Arunachal", "Bengaluru", "Agra"), sorting them using a custom string comparison function, and printing the sorted list ("Agra", "Arunachal", "Bengaluru"). Pre-requisites for the assignment include functions, dynamic arrays, and pointers. The objective is to understand how to use functions, arrays and pointers to complete the task.
This document provides instructions for an assignment to implement fragments using an array of pointers. It asks the student to write a program that reads the number of rows and columns for each row, reads the elements for each row, calculates the average for each row, sorts the rows based on average, and prints the results. It includes examples that show reading input values, storing them in an array using pointers, calculating averages, sorting rows, and sample output. The prerequisites are listed as pointers, functions, and dynamic memory allocation, and the objective is stated as understanding dynamic memory allocation and arrays of pointers.
The document describes an algorithm to generate a magic square of size n×n. It takes the integer n as input from the user and outputs the n×n magic square. A magic square is an arrangement of distinct numbers in a square grid where the sum of each row, column and diagonal is equal. The algorithm uses steps like starting from the middle of the grid and moving element by element in a pattern, wrapping around when reaching the boundaries.
This document discusses endianness and provides an example program to convert between little endian and big endian formats. It defines endianness as the order of bytes in memory, and describes little endian as having the least significant byte at the lowest memory address and big endian as the opposite. An example shows inputting a 2-byte number in little endian format and outputting it in big endian. Pre-requisites of pointers and the objective of understanding endianness representations are also stated.
The document provides steps to calculate variance of an array using dynamic memory allocation in C. It explains what variance is, shows an example to calculate variance of a sample array by finding the mean, deviations from mean, squaring the deviations and calculating the average of squared deviations. The key steps are: 1) Read array size and elements, 2) Calculate mean, 3) Find deviations from mean, 4) Square the deviations and store in another array, 5) Calculate average of squared deviations to get variance.
This document provides examples for an assignment to create a menu-driven program that stores and manipulates different data types (char, int, float, double) in dynamically allocated memory. It allocates 8 consecutive bytes to store the variables and uses flags to track which data types are stored. The menu allows the user to add, display, and remove elements as well as exit the program. Examples demonstrate initializing the flags, adding/removing elements, updating the flags, and displaying only elements whose flags are set. The objective is to understand dynamic memory allocation using pointers.
The document discusses generating non-repetitive pattern strings (NRPS) of length n using k distinct characters. It explains that an NRPS has a pattern that is not repeated consecutively. It provides steps to check if a string is an NRPS, including comparing characters and resetting a count if characters do not match. It also describes how to create an NRPS by starting with an ordered pattern and then copying subsequent characters to generate new patterns without repetition until the string reaches the desired length n. Sample inputs and outputs are provided.
The document discusses how to check if a string is a pangram, which is a sentence containing all 26 letters of the English alphabet. It provides an example of implementing the algorithm to check for a pangram by initializing an array to track letter occurrences, iterating through the input string to mark letters in the array, and checking if all letters are marked to determine if it is a pangram.
The document explains how to print all possible combinations of a given string by swapping characters. It provides an example of generating all six combinations of the string "ABC" through a step-by-step process of swapping characters. It also lists the prerequisites as strings, arrays, and pointers and the objective as understanding string manipulations.
The document describes an assignment to write a program that squeezes characters from one string (s1) that match characters in a second string (s2). It provides examples of input/output and step-by-step demonstrations of the program removing matching characters from s1. It also lists prerequisites of functions, arrays, and pointers and the objective of understanding these concepts as they relate to strings.
The document discusses implementing the strtok() string tokenization function. It explains that strtok() breaks a string into tokens based on delimiters. The document then provides pseudocode to implement a custom strtok() function by iterating through the string, overwriting delimiter characters with null terminators to create tokens, and returning a pointer to each token. Sample input/output is provided. The objective is stated as understanding string functions, with prerequisites of strings, storage classes, and pointers.
The document provides details on an assignment to write a program that recursively reverses a given string without using static variables, global variables, or loops. It includes the input, output, and examples of reversing the strings "Extreme" and "hello world". It also provides sample execution and pre-requisites of strings and recursive functions, with the objective being to understand reversing a string recursively.
The document provides code and examples for reversing a string using an iterative method in C++. It explains taking in a string as input, declaring output and input strings of the same length, and swapping the first and last characters, second and second to last, and so on through multiple iterations until the string is reversed. Examples show reversing the strings "Extreme" to "emertxE" and "hello world" to "dlrow olleh" through this iterative swap process. Pre-requisites of strings and loops are noted, with the objective stated as understanding string reversal using an iterative approach.
Floods in Valencia: Two FME-Powered Stories of Data ResilienceSafe Software
In October 2024, the Spanish region of Valencia faced severe flooding that underscored the critical need for accessible and actionable data. This presentation will explore two innovative use cases where FME facilitated data integration and availability during the crisis. The first case demonstrates how FME was used to process and convert satellite imagery and other geospatial data into formats tailored for rapid analysis by emergency teams. The second case delves into making human mobility data—collected from mobile phone signals—accessible as source-destination matrices, offering key insights into population movements during and after the flooding. These stories highlight how FME's powerful capabilities can bridge the gap between raw data and decision-making, fostering resilience and preparedness in the face of natural disasters. Attendees will gain practical insights into how FME can support crisis management and urban planning in a changing climate.
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2025/06/addressing-evolving-ai-model-challenges-through-memory-and-storage-a-presentation-from-micron/
Wil Florentino, Senior Segment Marketing Manager at Micron, presents the “Addressing Evolving AI Model Challenges Through Memory and Storage” tutorial at the May 2025 Embedded Vision Summit.
In the fast-changing world of artificial intelligence, the industry is deploying more AI compute at the edge. But the growing diversity and data footprint of transformers and models such as large language models and large multimodal models puts a spotlight on memory performance and data storage capacity as key bottlenecks. Enabling the full potential of AI in industries such as manufacturing, automotive, robotics and transportation will require us to find efficient ways to deploy this new generation of complex models.
In this presentation, Florentino explores how memory and storage are responding to this need and solving complex issues in the AI market. He examines the storage capacity and memory bandwidth requirements of edge AI use cases ranging from tiny devices with severe cost and power constraints to edge servers, and he explains how new memory technologies such as LPDDR5, LPCAMM2 and multi-port SSDs are helping system developers to meet these challenges.
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...Safe Software
In partnership with the Belgian Province of East-Flanders this project aimed to reduce conflicts and increase safety along a cycling route between the cities of Oudenaarde and Ghent. To achieve this goal, the current cycling network data needed some extra key information, including: Speed limits for segments, Access restrictions for different users (pedestrians, cyclists, motor vehicles, etc.), Priority rules at intersections. Using a 360° camera and GPS mounted on a measuring bicycle, we collected images of traffic signs and ground markings along the cycling lanes building up mobile mapping data. Image recognition technologies identified the road signs, creating a dataset with their locations and codes. The data processing entailed three FME workspaces. These included identifying valid intersections with other networks (e.g., roads, railways), creating a topological network between segments and intersections and linking road signs to segments and intersections based on proximity and orientation. Additional features, such as speed zones, inheritance of speed and access to neighbouring segments were also implemented to further enhance the data. The final results were visualized in ArcGIS, enabling analysis for the end users. The project provided them with key insights, including statistics on accessible road segments, speed limits, and intersection priorities. These will make the cycling paths more safe and uniform, by reducing conflicts between users.
Providing an OGC API Processes REST Interface for FME FlowSafe Software
This presentation will showcase an adapter for FME Flow that provides REST endpoints for FME Workspaces following the OGC API Processes specification. The implementation delivers robust, user-friendly API endpoints, including standardized methods for parameter provision. Additionally, it enhances security and user management by supporting OAuth2 authentication. Join us to discover how these advancements can elevate your enterprise integration workflows and ensure seamless, secure interactions with FME Flow.
Kubernetes Security Act Now Before It’s Too LateMichael Furman
In today's cloud-native landscape, Kubernetes has become the de facto standard for orchestrating containerized applications, but its inherent complexity introduces unique security challenges. Are you one YAML away from disaster?
This presentation, "Kubernetes Security: Act Now Before It’s Too Late," is your essential guide to understanding and mitigating the critical security risks within your Kubernetes environments. This presentation dives deep into the OWASP Kubernetes Top Ten, providing actionable insights to harden your clusters.
We will cover:
The fundamental architecture of Kubernetes and why its security is paramount.
In-depth strategies for protecting your Kubernetes Control Plane, including kube-apiserver and etcd.
Crucial best practices for securing your workloads and nodes, covering topics like privileged containers, root filesystem security, and the essential role of Pod Security Admission.
Don't wait for a breach. Learn how to identify, prevent, and respond to Kubernetes security threats effectively.
It's time to act now before it's too late!
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2025/06/from-enterprise-to-makers-driving-vision-ai-innovation-at-the-extreme-edge-a-presentation-from-sony-semiconductor-solutions/
Amir Servi, Edge Deep Learning Product Manager at Sony Semiconductor Solutions, presents the “From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge” tutorial at the May 2025 Embedded Vision Summit.
Sony’s unique integrated sensor-processor technology is enabling ultra-efficient intelligence directly at the image source, transforming vision AI for enterprises and developers alike. In this presentation, Servi showcases how the AITRIOS platform simplifies vision AI for enterprises with tools for large-scale deployments and model management.
Servi also highlights his company’s collaboration with Ultralytics and Raspberry Pi, which brings YOLO models to the developer community, empowering grassroots innovation. Whether you’re scaling vision AI for industry or experimenting with cutting-edge tools, this presentation will demonstrate how Sony is accelerating high-performance, energy-efficient vision AI for all.
Your startup on AWS - How to architect and maintain a Lean and Mean accountangelo60207
Prevent infrastructure costs from becoming a significant line item on your startup’s budget! Serial entrepreneur and software architect Angelo Mandato will share his experience with AWS Activate (startup credits from AWS) and knowledge on how to architect a lean and mean AWS account ideal for budget minded and bootstrapped startups. In this session you will learn how to manage a production ready AWS account capable of scaling as your startup grows for less than $100/month before credits. We will discuss AWS Budgets, Cost Explorer, architect priorities, and the importance of having flexible, optimized Infrastructure as Code. We will wrap everything up discussing opportunities where to save with AWS services such as S3, EC2, Load Balancers, Lambda Functions, RDS, and many others.
Mastering AI Workflows with FME - Peak of Data & AI 2025Safe Software
Harness the full potential of AI with FME: From creating high-quality training data to optimizing models and utilizing results, FME supports every step of your AI workflow. Seamlessly integrate a wide range of models, including those for data enhancement, forecasting, image and object recognition, and large language models. Customize AI models to meet your exact needs with FME’s powerful tools for training, optimization, and seamless integration
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureSafe Software
When projects depend on fast, reliable spatial data, every minute counts.
AI Clearing needed a faster way to handle complex spatial data from drone surveys, CAD designs and 3D project models across construction sites. With FME Form, they built no-code workflows to clean, convert, integrate, and validate dozens of data formats – cutting analysis time from 5 hours to just 30 minutes.
Join us, our partner Globema, and customer AI Clearing to see how they:
-Automate processing of 2D, 3D, drone, spatial, and non-spatial data
-Analyze construction progress 10x faster and with fewer errors
-Handle diverse formats like DWG, KML, SHP, and PDF with ease
-Scale their workflows for international projects in solar, roads, and pipelines
If you work with complex data, join us to learn how to optimize your own processes and transform your results with FME.
מכונת קנטים המתאימה לנגריות קטנות או גדולות (כמכונת גיבוי).
מדביקה קנטים מגליל או פסים, עד עובי קנט – 3 מ"מ ועובי חומר עד 40 מ"מ. בקר ממוחשב המתריע על תקלות, ומנועים מאסיביים תעשייתיים כמו במכונות הגדולות.
Supporting the NextGen 911 Digital Transformation with FMESafe Software
Next Generation 911 involves the transformation of our 911 system from an old analog one to the new digital internet based architecture. The evolution of NG911 opens up a host of new opportunities to improve the system. This includes everything from device based location, to real time text. This can improve location accuracy dramatically as well as provide live updates from the citizen in need along with real time sensor updates. There is also the opportunity to provide multi-media attachments and medical records if the end user approves. This digital transformation and enhancements all require the support of new NENA and CRTC standards, along with integration across a variety of data streams.
This presentation will focus on how FME has supported NG911 transformations to date, and how we are positioning FME to support the enhanced capabilities to come. This session will be of interest to emergency services, municipalities and anyone who may be interested to know more about how emergency services are being improved to provide more accurate, localized information in order to improve the speed and relevance of emergency response and ultimately save more lives and provide better outcomes for those in need.
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Safe Software
Jacobs has developed a 3D utility solids modelling workflow to improve the integration of utility data into 3D Building Information Modeling (BIM) environments. This workflow, a collaborative effort between the New Zealand Geospatial Team and the Australian Data Capture Team, employs FME to convert 2D utility data into detailed 3D representations, supporting enhanced spatial analysis and clash detection.
To enable the automation of this process, Jacobs has also developed a survey data standard that standardizes the capture of existing utilities. This standard ensures consistency in data collection, forming the foundation for the subsequent automated validation and modelling steps. The workflow begins with the acquisition of utility survey data, including attributes such as location, depth, diameter, and material of utility assets like pipes and manholes. This data is validated through a custom-built tool that ensures completeness and logical consistency, including checks for proper connectivity between network components. Following validation, the data is processed using an automated modelling tool to generate 3D solids from 2D geometric representations. These solids are then integrated into BIM models to facilitate compatibility with 3D workflows and enable detailed spatial analyses.
The workflow contributes to improved spatial understanding by visualizing the relationships between utilities and other infrastructure elements. The automation of validation and modeling processes ensures consistent and accurate outputs, minimizing errors and increasing workflow efficiency.
This methodology highlights the application of FME in addressing challenges associated with geospatial data transformation and demonstrates its utility in enhancing data integration within BIM frameworks. By enabling accurate 3D representation of utility networks, the workflow supports improved design collaboration and decision-making in complex infrastructure projects
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc
How does your privacy program compare to your peers? What challenges are privacy teams tackling and prioritizing in 2025?
In the sixth annual Global Privacy Benchmarks Survey, we asked global privacy professionals and business executives to share their perspectives on privacy inside and outside their organizations. The annual report provides a 360-degree view of various industries' priorities, attitudes, and trends. See how organizational priorities and strategic approaches to data security and privacy are evolving around the globe.
This webinar features an expert panel discussion and data-driven insights to help you navigate the shifting privacy landscape. Whether you are a privacy officer, legal professional, compliance specialist, or security expert, this session will provide actionable takeaways to strengthen your privacy strategy.
This webinar will review:
- The emerging trends in data protection, compliance, and risk
- The top challenges for privacy leaders, practitioners, and organizations in 2025
- The impact of evolving regulations and the crossroads with new technology, like AI
Predictions for the future of privacy in 2025 and beyond
This OrionX's 14th semi-annual report on the state of the cryptocurrency mining market. The report focuses on Proof-of-Work cryptocurrencies since those use substantial supercomputer power to mint new coins and encode transactions on their blockchains. Only two make the cut this time, Bitcoin with $18 billion of annual economic value produced and Dogecoin with $1 billion. Bitcoin has now reached the Zettascale with typical hash rates of 0.9 Zettahashes per second. Bitcoin is powered by the world's largest decentralized supercomputer in a continuous winner take all lottery incentive network.
Ivanti’s Patch Tuesday breakdown goes beyond patching your applications and brings you the intelligence and guidance needed to prioritize where to focus your attention first. Catch early analysis on our Ivanti blog, then join industry expert Chris Goettl for the Patch Tuesday Webinar Event. There we’ll do a deep dive into each of the bulletins and give guidance on the risks associated with the newly-identified vulnerabilities.
3. Introduction
Let us ponder ...
●
What exactly is an Operating System (OS)?
●
Why do we need OS?
●
How would the OS would look like?
● Is it possible for a team of us (in the room) to create an
OS of our own?
●
Is it necessary to have an OS running in a Embedded
System?
●
Will the OS ever stop at all?
4. Introduction
Operating System
Compiler Assembler Text Editor Database
System and Application Programs
Operating System
Humans
Program
Interface
User
Programs
Operating
System
OS
Interface
HW
Interface/
Privileged
Instr
Hardware
5. Introduction
What is Linux?
●
Linux is a free and open source operating system that is
causing a revolution in the computer world
● Originally created by Linus Torvalds with the assistance of
developers called community
● This operating system in only a few short years is
beginning to dominate markets worldwide
●
Today right from hand-held devices (ex: Android)
to high end systems (ex: Stock exchange servers)
use Linux
6. Introduction
Why use Linux?
●
Free & Open Source –GPL license, no cost
●
Reliability –Build systems with 99.999% upstream
●
Secure –Monolithic kernel offering high security
● Scalability –From mobile phone to stock market servers
The word 'Free' in Open Source should be interpreted as in
'Freedom' not as 'Free Beer'. This also explains the spirit of
creating Open Source software.
7. Introduction
What is Open Source?
Freedom of
software
Freedom of
redistribute
Freedom of
copy
Freedom of
modify
Freedom of
use
8. Introduction
Open Source - How it all started?
●
With GNU (GNU is not UNIX)
●
Richard Stallman made the initial announcement in 1983, Free
Software Foundation (FSF) got formed during 1984
●
Volunteer driven GNU started developing multiple projects,
but making it as an operating system was always a challenge
●
During 1991 a Finnish Engineer Linus Torvalds developed core
OS functionality, called it as “Linux Kernel”
●
Linux Kernel got licensed under GPL, which laid strong
platform for the success of Open Source
●
Rest is history!
9. Introduction
Open Source - How it evolved?
● Multiple Linux distributions started emerging around the Kernel
● Some applications became platform independent
●
Community driven software development started picking up
● Initially seen as a “geek-phenomenon”, eventually turned out to be
an engineering marvel
●
Centered around Internet
● Building a business around open source started becoming viable
●
Redhat set the initial trend in the OS business
Customization
Applications
Kernel
10. Introduction
Open Source - Where it stands now?
OS Databases Server/Cloud Enterprise
Consumer Education CMS eCommerce
11. Introduction
Open Source vs Freeware
OSS Freeware
Users have the right to access &
modify the source codes
In case original programmer
disappeared, users & developer
group of the S/W usually keep its
support to the S/W.
OSS usually has the strong users &
developers group that manage and
maintain the project
Freeware is usually distributed in a
form of binary at ‘Free of Charge’,
but does not open source codes
itself.
Developer of freeware could
abandon development at any time
and then final version will be the
last version of the freeware. No
enhancements will be made by
others.
Possibility of changing its licensing
policy
12. Introduction
GPL
●
Basic rights under the GPL – access to source code, right
to make derivative works
● Reciprocity/Copy-left
●
Purpose is to increase amount of publicly available
software and ensure compatibility
●
Licensees have right to modify, use or distribute
software, and to access the source code
13. Introduction
GPL - Issues
●
Linking to GPL programs
●
No explicit patent grant
●
Does no discuss trademark rights
● Does not discuss duration
●
Silent on sub-licensing
● Relies exclusively on license law, not contract
14. Introduction
Linux Properties
What has made Linux so popular to scale from mobile devices to
powering 90% of world’s super computer? Here are the key
properties of Linux
●
Multitasking
– Ability to handle multiple tasks across single / multiple processors
●
Multi-user
– Have got users with different level of privileges for secured access
●
Protected Memory
– Clear distinction called ‘user-space’ and ‘kernel’ space thereby having protected memory
access. This makes Linux Super secure comparing with other operating systems
●
Hierarchical File System
– Well organized file system that handles various types of files. This also makes handling
various inputs very simple
15. Introduction
Linux Components
●
Hardware Controllers: This subsystem is
comprised of all the possible physical
devices in a Linux installation - CPU,
memory hardware, hard disks
●
Linux Kernel: The kernel abstracts and
mediates access to the hardware
resources, including the CPU. A kernel is
the core of the operating system
●
O/S Services: These are services that are
typically considered part of the operating
system (e.g. windowing system, command
shell)
●
User Applications: The set of applications
in use on a particular Linux system (e.g.
web browser)
User
Application
GNU
C
Library
System Call Interface
Kernel
Architecture Dependent
Kernel Code
Hardware Platform
Linux
UserSpaceKernelSpace
16. Introduction
Linux Directory Structure
/
/boot
/dev
/bin
/etc
/lib
/media
/mnt
/opt
/sbin
/tmp
/usr
/root
/home
/var
/proc
User home directories
Root user's home directory
Essential user command binaries
Essential super user command binaries
Essential shared libraries and kernel modules
Multi user utilities and application
Add-on application software packages
Host specific configuration
Device files
Mount point for removable media
Mount point for temporarily mounted file systems
Static boot-able images
Temporary files
Variable files (Logs)
Virtual FS documenting kernel and process status
18. User Interfaces
GUI
●
In graphical mode the user will be given a GUI using which he / she will be
able to use the system using mouse
●
Similar to windows based system that exist in other operating systems like
MS Windows & Apple MAC OS
19. User Interfaces
CLI
●
Textual mode used to execute requested commands
Our focus is to be in the CLI mode by executing various commands by invoking shells.
We will also create programs using this environment called ‘Shell scripts’
20. User Interfaces
The Shell - Introduction
● Shell is an application, works as a command interpreter
● Gets a command from user, gets it executed from OS
● Gives a programming environment to write scripts using
interpreted language
●
It has been inherited from UNIX operating system, which was
predecessor to Linux
21. User Interfaces
The Shel - Types
●
Login
– Starts after a successful login
– It is executed under user ID during login process
– It picks up user specific configuration and loads them
●
Non Login
– A Non login shell is started by a program without a login
– In this case, the program just passes the name of the shell executable
– For example, for a Bash shell it will be simply bash
– Following are examples of Non-login shells:
● sh
●
bash
● ksh
●
csh
22. User Interfaces
The Shel - Types
●
Try the following on your command prompt
$ cat /etc/shells
$ echo $0
23. User Interfaces
The Shell - Invocation
●
The main task of a shell is providing a user environment
shell
Input
(ls)
List all
the
files
Error
report
24. User Interfaces
The Shell - bash
●
Bash – The command interpreter
– .bash_profile (Login Shell, During login)
– .bashrc (Non Login Shell, New instance)
– .bash_logout (Login Shell, Logout)
– .bash_history (Non Login Shell, Command history)
25. User Interfaces
The Shell - bash
●
Hands on:
– Enter ls -a in your home directory
– Display contents of all files mentioned above
26. User Interfaces
The Shell – Environmental Variables
●
Login-shell's responsibility is to set the non-login shell and
it will set the environment variables
● Environment variables are set for every shell and
generally at login time
● Environmental variables are set by the system.
●
Environmental variables hold special values. For instance
$ echo $SHELL
●
Environmental variables are defined in /etc/profile,
/etc/profile.d/ and ~/.bash_profile.
●
When a login shell exits, bash reads ~/.bash_logout
27. User Interfaces
The Shell – Environmental Variables
●
env - lists shell environment variable/value pairs
Variable Description
SHELL Describes the shell that will be interpreting user commands
TERM This specifies the type of terminal to emulate when running
the shell
USER The current logged in user
PWD The current working directory
OLDPWD The previous working directory
MAIL The path to the current user's mailbox
PATH A list of directories that the system will check when looking for
commands
HOME The current user's home directory
HOSTNAME The hostname of the computer
PS1 The primary command prompt definition
29. Basic Shell Commands
Types
●
An executable program like all those files can have in
/usr/bin.
●
A command built into the shell itself. bash provides a
number of commands internally called shell built-ins The
cd command, for example, is a shell built-in
●
A shell function. These are miniature shell scripts
incorporated into the environment.
●
An alias. Commands that you can define yourselves, built
from other commands.
●
To know the type, try
$ type <command>
30. Basic Shell Commands
Command Meaning
ls List's all the files
pwd Gives present working directory
cd Change directory
man Gives information about command
df Disk free
du Disk usage
which Shows full path of command
31. Path
●
Path is the location where a particular file is located in the
directory (tree) structure
●
It starts with the root (‘/’) directory and goes into
appropriate directory
●
The path depends on the reference point from where you
take it up:
– Absolute Path : Specifies the location with reference from
root directory
– Relative Path : Specifies the location with reference to
present working directory (pwd)
●
As the name says relative path will vary depending on your
pwd
33. Visual Editor - vi
●
Screen-oriented text editor originally created for the
Unix operating system
● The name vi is derived from the shortest unambiguous
abbreviation for the ex command visual
● Improved version is called as vim
●
To open a file
$ vi <filename>
or
$ vim <filename>
34. Visual Editor - vi
●
vi opens a file in command mode to start mode.
●
The power of vi comes from its 3 modes
– Escape mode (Command mode)
●
Search mode
●
File mode
– Editing mode
●
Insert mode
●
Append mode
●
Open mode
●
Replace mode
– Visual mode
35. Visual Editor – vi
Cursor Movement
●
You will clearly need to move the cursor around your file.
You can move the cursor in command mode.
● vi has many different cursor movement commands. The
four basic keys appear below
– k move up one line
– h line move one character to the left
– l line move one character to the right
– j move down one line
●
Yes! Arrow keys also do work. But these makes typing
faster
36. Visual Editor – vi
Basic Commands
●
Open a file
$ vi <file_name>
●
How to exit
:q -> Close with out saving.
:wq -> Close the file with saving.
:q! -> Close the file forcefully with out saving
●
Already looks too complicated?
● Try by yourself, let us write a C program
37. Visual Editor – vi
Escape / Command Mode
● In command mode, characters you perform actions like moving the
cursor, cutting or copying text, or searching for some particular text
– Search mode
● vi can search the entire file for a given string of text. A string
is a sequence of characters. vi searches forward with the slash
(/) key and string to search. To cancel the search, press ESC
.You can search again by typing n (forward) or N (backward).
Also, when vi reaches the end of the text, it continues
searching from the beginning. This feature is called wrap scan
● Instead of (/), you may also use question (?). That would have
direction reversed
● Now, try out. Start vi as usual and try a simple search. Type
/<string> and press n and N a few times to see where the
cursor goes.
38. Visual Editor – vi
Escape / Command Mode
– File mode
●
Changing (Replacing) Text
:%s/first/sec - Replaces the first by second every where in
the file
:%s/orange/apple/gc - For all lines in a file, find string
"orange" and replace with string "apple" for each instance
on a line
●
File Interactions (edit and read)
:e filename - open another file without closing the current
:r filename - reads file named filename in place
●
Editor Settings
:set all - display all settings of your session
39. Visual Editor – vi
Escape / Command Mode – Useful Shortcuts
Command Operation
G Go to last line of the file
gg Go to first line of the file
. Repeat the previous command
Ctrl a Increment number under the cursor by 1
Ctrl x Decrements numbers under the cursor by 1
J Joining the two adjacent lines
(n)gg Move cursor to nth
line
40. Visual Editor – vi
Editing Mode
Command Mode Name Insertion Point
a Append just after the current character
A Append end of the current line
i Insert just before the current character
I Insert beginning of the current line
o Open new line below the current line
O Open new line above the current line
41. Visual Editor – vi
Editing Mode – Editing Text
Command Operation
dd For deleting a line
(n)dd For deleting a n lines
x To delete a single character
D Delete contents of line after cursor
dw Delete word
(n)dw Delete n words
●
Deleting Text Sometimes you will want to delete some of
the text you are editing. To do so, first move the cursor
so that it covers the first character of the group you want
to delete, then type the desired command from the table
below.
42. Visual Editor – vi
Visual Mode – Editing Text
●
Visual Mode
– Visual mode helps to visually select some text, may be
seen as a sub mode of the command mode to switch
from the command mode to the visual mode type one
of
●
v - visual mode
●
ctrl+v - Go's to visual block mode.
● d or y Delete or Yank selected text
●
I or A Insert or Append text in all lines (visual block
only)
44. Shell Scripting - Basics
Programming Languages
●
There are various types of programming languages, compared on various
parameters
●
From Embedded system engineer’s view it should be seen how close or how
much away from the hardware the language is
●
Based on that view programming languages can be categorized into three
areas:
– Assembly language (ex: 8051)
– Middle level language (ex: C)
– High level / Scripting language (ex: Shell)
●
Each programming language offers some benefits with some shortcomings
●
Depending on the need of the situation appropriate language needs to be
chosen
●
This make language selection is a key criteria when it comes to building real
time products!
45. Shell Scripting - Basics
Programming Languages – A Comparison
Language
parameter
Assembly C Shell
Speed High Medium Medium
Portability Low Medium High
Maintainability Low Medium High
Size Low Medium Low
Easy to learn Low Medium High
Shell or any scripting language is also called as ‘interpreted’ language as it doesn’t
go through compilation phase. This is to keep the language simple as the purpose is
different than other languages.
46. Shell Scripting - Basics
Shell Script
●
Any collection of shell commands can be stored
in a file, which is then called as shell script
●
Programming the scripts is called shell scripting
●
Scripts have variables and flow control
statements like other programming languages
●
Shell script are interpreted, not compiled
●
The shell reads commands from the script line
by line and searches for those commands on the
system
47. Shell Scripting - Basics
Shell Script – Where to use?
● System Administration
– Automate tasks
– Repeated tasks
● Development
– Allows testing a limited sub-set
– Testing tools
● Daily usage
– Simple scripts
– Reminders, e-mails etc…
48. Shell Scripting - Basics
Shell Script – Invocation
●
Example:
$ vi hello.sh
and type the following inside it:
#!/bin/bash
echo “ Hello World”
Then, make the script executable:
$ chmod 700 hello.sh
$ ./hello.sh
●
First line tells Linux to use BASH interpreter
●
Second line prints the “Hello world” into standard I/O
49. Shell Scripting - Basics
Variables
● Variables are a way of storing information temporarily.
NAME=”Emertxe”
X=10
● A couple of conversions we need to follow
– Variables usually appear in uppercase
– There is no white space between the variable name and the equal sign
● Variable substitution
●
Variable assignment
●
Bash variables & special variables
50. Shell Scripting - Basics
Whitespace & Line-breaks
● Bash shell scripts are very sensitive to whitespace & line-
breaks
● Because the “keywords” of this programming language are
actually commands evaluated by the shell
●
Need to separate arguments with whitespaces
● Likewise a line-break in the middle of a command will mislead
the shell into thinking the command is incomplete.
● Example: x=10; x = 10; x = “ok”; x=”ok”
51. Shell Scripting - Basics
Special Characters
Character Meaning
~ The current user's home directory
$ used to access a variable (e.g. : $HOME)
& used to put a command in the background
* wildcard, matching zero or more characters (e.g. : ls doc_*)
? wildcard, matching exactly one character (e.g.: ls doc_?)
${#} No of arguments passed to shell script
${@} Value of all arguments passed
$0 contains the name of the script user executed
52. Shell Scripting - Basics
Quotes
● Using single quotes causes the variable name to be used
literally, and no substitution will take place.
$var=’test string’
$newvar=’Value of var is $var’
echo $newvar
● Using double quotes to show a string of characters will allow a
ny variables in the quotes to be resolved
$var=“test string”
$newvar=“Value of var is $var”
echo $newvar
53. Shell Scripting - Basics
Expressions
● expr: Evaluates simple math on the command line calculator.
● bc: An arbitrary precision calculator language
●
Available operators: +, , /, *, %
1 #!/bin/bash
2
3 NUM1=5
4 NUM2=3
5
6 ADD=$((${NUM1} + ${NUM2}))
7 SUB=$((${NUM1} - ${NUM2}))
8 MUL=$((${NUM1} * ${NUM2}))
9 DIV=$((${NUM1} / ${NUM2}))
10 MOD=$((${NUM1} % ${NUM2}))
11
12 echo "Addition of two numbers is: ${ADD}"
13 echo "Substraction of two numbers is: ${SUB}"
14 echo "Multiplication of two numbers is: ${MUL}"
15 echo "Division of two numbers is: ${DIV}"
16 echo "Modulum of two numbers is: ${MOD}"
Example
54. Shell Scripting - Basics
Conditions – if else
● The if statement chooses between alternatives each of which
may have a complex test
● The simplest form is the if-then statement
1 #!/bin/bash
2
3 NUM1=5
4 NUM2=3
5
6 if [ ${NUM1} -gt ${NUM2} ]
7 then
8 echo "NUM1 is greater than NUM2"
9 else
10 echo "NUM2 is greater than NUM1"
11 fi
if [ condition ]
then
expression
else
expression
fi
Syntax Example
55. Shell Scripting - Basics
Conditions – if else if
● Multiple if blocks can be strung together to make an elaborate
set of conditional responses
1 #!/bin/bash
2
3 NUM1=5
4 NUM2=3
5
6 if [ ${NUM1} -eq ${NUM2} ]
7 then
8 echo "NUM1 is equal to NUM2"
9 elif [ ${NUM1} -gt ${NUM2} ]
10 then
11 echo "NUM1 is greater than NUM2"
12 else
13 echo "NUM1 is less than NUM2"
11 fi
if [ condition_a ]
then
condition_a is true
elif [ condition_b ]
then
condition_b is true
else
both false
fi
Syntax Example
57. Shell Scripting - Intermediate
String Tests
● String comparison, Numeric comparison, File operators and logical operators
● Comparison operations are provided below
1 #!/bin/bash
2
3 echo “Enter the first string”
4 read STR1
5 echo “Enter the second string”
6 read STR2
7
8 if [ -z ${STR1} ]; then
9 echo "First string is empty"
10 else
11 echo "First string is not empty"
12 fi
13 if [ -n ${STR2} ]; then
14 echo "First string is not empty"
15 else
16 echo "First string is empty"
17 fi
18 if [ ${STR1} = ${STR2} ]; then
19 echo "Both strings are equal"
20 else
21 echo "Both strings are not equal"
22 fi
Example
Operator Meaning
= Compare if two strings
are equal
!= Compare if two strings
are not equal
-n Evaluate if string
length is greater than
zero
-z Evaluate if string
length is equal to zero
58. Shell Scripting - Intermediate
Numeric Tests
1 #!/bin/bash
2
3 NUM1=5
4 NUM2=3
5
6 if [ ${NUM1} -gt ${NUM2} ]
7 then
8 echo "NUM1 is greater than NUM2"
9 else
10 echo "NUM2 is greater than NUM1"
11 fi
Example
Operator Meaning
-eq
Compare if two
numbers are equal
-ge
Compare if one number
is greater than are
equal to num
-le
Compare if one number
is less than or equal to
a num
-ne
Compare if two
numbers are not equal
-gt
Compare if one
number is greater than
another number
-lt
Compare if one
number is less than ano
ther number
59. Shell Scripting - Intermediate
Logical Operators
Operator Meaning
!
Negate (NOT) a logical
expression
-a
Logically AND two
logical expression
-o
Logically OR two logical
expressions
1 #!/bin/bash
2
3 echo “Enter the first number A”
4 read A
5 echo “Enter the second number B ”
6 read B
7 echo “Enter the third number C ”
8 read C
9
10 if [ ${A} -gt ${B} -a ${A} -gt ${C} ]; then
11 echo "A is the greatest of all"
12 elif [ ${B} -gt ${A} -a ${B} -gt ${C} ]; then
13 echo "B is the greatest of all"
14 elif [ ${C} -gt ${A} -a ${C} -gt ${B} ]; then
15 echo "C is the greatest of all"
16 else
17 echo "Invalid Input"
18 fi
Example
60. Shell Scripting - Intermediate
Loop – for
●
Sequential loop with expressions
● First arithmetic expr EXPR1 is evaluated;EXPR2 evaluated
repeatedly until it evaluates to 0; Each time EXPR2 is evaluated to
a non-zero value, statements are executed & EXPR3 is evaluated
1 #!/bin/bash
2
3 for ((i=1; i<=5; i++))
4 do
5 echo "Loop counter is ${i}"
6 done
for ((expr1; expr2; expr3))
do
Code Block
done
Syntax Example
61. Shell Scripting - Intermediate
Loop – while
● The structure is a looping structure. Used to execute a set of commands
while a specified condition is true
● The loop terminates as soon as the condition becomes false. If condition
never becomes false, loop will never exit
● Any valid conditional expression will work in the while loop.
1 #!/bin/bash
2
3 LOOP=1
4
5 while [ ${LOOP} -le 5 ]
6 do
7 echo "Looping : ${LOOP}"
8 LOOP=$((${LOOP} + 1))
9 done
while [ condition ]
do
Code Block
done
Syntax Example
62. Shell Scripting - Intermediate
Case Statements
●
The case statement compares the value of the variable
($var in this case) to one or more values
● Once a match is found, the associated commands are
executed and the case statement is terminated
● Used to execute statements based on specific values
●
Often used in place of an if statement if there are a large
number of conditions.
●
Each set of statements must be ended by a pair of
semicolon
● *) is used for not matched with list of values
63. Shell Scripting - Intermediate
Case Statements
1 #!/bin/bash
2
3 echo “Enter a number:”
4 read NUM
5
6 case ${NUM} in
7 1)
8 echo "You entered One"
9 ;;
10 2) echo "You entered Two" ;;
11 *) echo "Obey my orders please"
12 ;;
13 esac
case ${VAR} in
value_1)
commands;
;;
value_2)
commands;
;;
*)
commands;
;;
esac
Syntax Example
64. Shell Scripting - Intermediate
Functions
● Writing functions can greatly simplify a program
● Improves modularity, readability and maintainability
● However speed will get slowed down
● Arguments are accessed as $1, $2, $3…
function name()
{
<command>
<statments>
<expression>
}
Syntax
1 #!/bin/bash
2
3 function sum()
4 {
5 x=`expr $1 + $2`
6 echo $x
7 }
8
9 y=`sum 5 3`
10 echo "The sum is 5 and 3 is $y"
11 echo "The sum is 6 and 2 is `sum 6 2`"
Example
65. Shell Scripting - Intermediate
Arrays
● An array is a variable containing multiple values may be of
same type or of different type
● There is no maximum limit to the size of an array
● Array index starts with zero
66. Shell Scripting - Intermediate
Arrays
declare -a array_name=(element1 element2 element3)
Syntax
1 #!/bin/bash
2
3 declare -a LINUX_DISTROS=('Debian' 'Redhat' 'Ubuntu' 'Suse' 'Fedora');
4
5 echo "Number of elements in the array: ${#LINUX_DISTROS[@]}"
6 echo "Printing elements of array in one shot: ${LINUX_DISTROS[@]}"
7 echo "Printing elements of array in one shot: ${LINUX_DISTROS[*]}"
8 echo "Printing elements of array in using a loop:"
10 for ((i = 0; i < ${#LINUX_DISTROS[@]}; i++))
11 do
12 echo ${LINUX_DISTROS[$i]}
13 done
Example
Here declare –a is optional, arrays can be declared without that also
67. Shell Scripting - Intermediate
Command Line Arguments
● Shell script can accept command-line arguments & options
just like other Linux commands
● Within your shell script, you can refer to these arguments as
$1,$2,$3,.. & so on.
● Then the command line arguments are executed like
●
Read all command line arguments and print them
68. Shell Scripting - Intermediate
Command Line Arguments
1 #!/bin/bash
2
3 if [ $# != 2 ]
4 then
5 echo "Usage: Pass 3 arguments"
6 exit 0
7 fi
8
9 echo "The arguments of the script you passed are:"
10 echo "Total number of arguments you passed are : $#"
11 echo "The name of the script is : $0"
12 echo "The first argument is : $1"
13 echo "The second argument is : $2"
Example
70. Linux System – A Bigger Picture
How things fit together?
● Shell commands: ls, date, whoami etc.
●
Shell scripting: Operators, Loop, Arrays etc..
● Editor (vi): Insertion, commands, visual mode
Shell
commands
Shell
scripting
Editor
(vi)
Shell
programs
in Linux
Now let us learn some more Linux shell commands (advanced) for making
our shell scripts more powerful
71. Linux System – A Bigger Picture
Advanced Shell Commands
Shell
commands
User
Interface
File
Filters
Pattern
matching
73. Shell Commands - Advanced
User Specific Commands
● All Accesses into a Linux System are through a User
● Super user (root) will have higher privileges
● User related Shell commands
Command Meaning
useradd Create user
userdel Delete user
su - [username] Start new shell as different user
finger User information lookup
passwd Change or create user password
who To find out who is logged in
whoami Who are you
74. Shell Commands - Advanced
Remote Login and Remote Copy
● ssh is a program for logging into a remote machine
and for executing commands on a remote machine.
$ ssh username@ipaddress
● scp copies files between hosts on a network.
$ scp filename username@ipaddress:/path/
75. Shell Commands - Advanced
File Related - Redirection
● Out put redirection ( > )
$ ls > /tmp/outputfile
● Redirecting to append ( >> )
$ ls -l >> /tmp/outputfile
●
Redirecting the error (2>)
$ ls 2> /tmp/outputfile
76. Shell Commands - Advanced
File Related - Pipe
● A pipe is a form of redirection that is used in Linux
operating systems to send the output of one program to
another program for further processing.
● A pipe is designated in commands by the vertical bar
character
$ ls -al /bin | less
77. Shell Commands - Advanced
File Related
● Every thing is viewed as a file in Linux. Even a Directory is a
file.
● Basic Shell Command Set
Command Meaning
cp <source> <dest> Copy file from one to another
mv <source> <dest> Rename a file
rm <file> Remove a file
stat File related statistics (i-node)
ln Linking between files (-s option for soft link)
78. Shell Commands - Advanced
File Related
Command Meaning
mkdir <dir_name> Make directory
rmdir <dir_name> Remove a particular directory
touch Change file timestamps
wc Counts the number of lines in a file
cat Display contents of the file in standard output
more Display contents, navigate forward
head Display first 10 lines of the file (-n to change)
tail Display last 10 lines of the file (-n to change)
sort Sort lines of text files
79. Shell Commands - Advanced
File Listing
user@user:~] ls -l
total 12
drwxrwxr-x 2 user user 4096 Jun 23 16:48 A-Direcory
brw-r--r-- 1 root root 7, 0 Jun 23 16:55 block_file
crw-r--r-- 1 root root 108, 0 Jun 23 16:49 character_file
lrwxrwxrwx 1 user user 12 Jun 23 16:50 link_to_regular_file -> regular_file
prw-rw-r-- 1 user user 0 Jun 23 16:50 named_pipe
-rw-rw-r-- 1 user user 0 Jun 23 16:48 regular_file
-rwxrwxr-x 1 user user 7639 Jun 23 16:54 server
srwxrwxr-x 1 user user 0 Jun 23 16:55 server_socket
permissions
owner
& group
file
size
created date
& time
file name
80. Shell Commands - Advanced
File Listing - Types
user@user:~] ls -l
total 12
drwxrwxr-x 2 user user
brw-r--r-- 1 root root
crw-r--r-- 1 root root
lrwxrwxrwx 1 user user
prw-rw-r-- 1 user user
-rwxrwxr-x 1 user user
srwxrwxr-x 1 user user
Directory
Block
Character
Soft Link
FIFO (sometimes =)
Plain Text
Socket
81. Shell Commands - Advanced
File Listing - Permission
user@user:~] ls -l
total 1
-r w x r w x r - x 2 user user
Read 100 - 4
Write 010 - 2
Execute 001 - 1
Value used to Set
82. Shell Commands - Advanced
File Listing
user@user:~] ls -l
total 1
-r w x r w x r w x 2 user user
user group others
84. Shell Commands - Advanced
find
Find options Meaning
find . –print Find all files from current directory & sub-
directory & print their path
find . –name *.sh Find all files that are having *.sh extension
starting from current directory
find / -type d –name tech Search for directories with name ‘tech’ from
the ‘root’ directory
find . –type f –empty Find all files that are empty in current
directory
find <where-to-look> <criteria> <what-to-do>
Syntax
85. Shell Commands - Advanced
cut
cut <option> <file>
Option ‘-c’ character
Option ‘-d’ delimiter and much more
Syntax
cut options Meaning
cut –c3 <file> Outputs third character of every line of <file>
cut –c1-3 <file> Outputs the first three characters of every line
of <file>
cut -d':' -f1 /etc/passwd Outputs the first field of the file /etc/passwd,
where fields are delimited by a colon (':'). The
first field of /etc/passwd is the username, so
this will output every username in
the passwd file
cut -d':' -f1,6 /etc/passwd Output first and sixth fields of /etc/passwd
86. Shell Commands - Advanced
split
split <option> <file> <newfile>
Option ‘-b’ bytes
Option ‘-l’ lines and much more
Syntax
split options Meaning
split –b <file> <newfile> Split ‘b’ bytes from ‘file’ and put them into
newfileaa, newfileab, newfileac etc..
split –l <file> <newfile> Split <file> into ‘l’ number of lines and put
them into newfileaa, newfileab, newfileac etc.
There are three more file related commands as follows:
• cmp – Compares two files and stops where difference is found
• diff – Reports differences between two files
• uniq – Reports/Filters repeated pattern in a file
Let us read through the man pages and understand them (Self-study)
87. Shell Commands - Advanced
tr
tr <options> <input>
Syntax
tr options Meaning
tr –d <char> Delete occurrences of given character
tr –s <char> Squeeze repetition characters
:upper: Upper case characters
:lower: Lower case characters
:space: Space character
:digit: Numerical numbers
88. Shell Commands - Advanced
tr
# Delete all occurrences of character ‘h’
$ echo hello how are you | tr -d h
ello ow are you
# Replace all spaces with tabs
$ echo "whats up with you guys" | tr [:space:] 't'
whats up with you guys
# Remove all numbers from the input
$ echo "my age is 99" | tr -d [:digit:]
my age is
# Replace all lower case with upper case
$ tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
hello
HELLO
89. Shell Commands - Advanced
File Compression
●
Compression is needed to conserve the disk space
●
When there is a need to send large files as an attachment via
the email, it is good practice to compress first
●
Compression & Decompression utilities - gzip & gunzip(.gz)
●
The degree of compression depends on
– The type of the file
– Its size
– Compression program used
●
Example
– Html files compress more
– GIF & JPEG image files compress very less, as they are already in
compressed form
90. Shell Commands - Advanced
File Compression - Flow
file
gzip
file.gz
file.gz
gunzip
file
Compression flow De-compression flow
• Recursive compression and de-compression (-r option), will
come handy
• gzip –r <directory> : To compress whole directory
• gunzip –r <directory> : To de-compress whole directory
92. Shell Commands - Advanced
File Archival
● Used for creating disk archive that contains a group of files or
an entire directory structure
● An archive file is a collection of files and directories that are
stored in one file
●
Archive file is not compressed, it uses the same amount of disk
space as all the individual files and directories
● In case of compression, compressed file occupies lesser space
● Combination of archival & compression also can be done
• File archival is achieved using ‘tar’ with the following commands:
• tar -cvf <archive name> <file-names>
• tar -xvf <archive name>
94. Shell Commands - Advanced
Regular Expressions
●
Regular expressions = search (and
replace/modify/remove) pattern
●
In theoretical computer science regular expressions are
called as regex or regexp
●
It is a sequence of characters that forms a search
pattern using some special characters
●
Popular applications in Linux (Vi editor, Grep, Sed, Lex
& Yacc etc..) extensively use regular expressions
●
Extensively used in compiler design and implementation
●
Our idea is to understand them from Linux commands
95. Shell Commands - Advanced
Regular Expressions
● Each character in a regular expression is either understood to
be a meta-character with its special meaning
● Or a regular character with its literal meaning
● Together they form a pattern. Some popular & most frequently
used examples are provided below
Meta-character Meaning
? Zero or one occurrence
* Zero or more occurrence
+ One or more occurrence
96. Shell Commands - Advanced
Pattern Matching - grep
● Get Regular Expression And Print (GREP)
● Grep is pattern matching tool used to search the name input
file
Option Meaning
grep a* <file> Search for lines starting with name ‘a’ in <file>
grep –x <pattern> <file> Exactly match for <pattern> in <file>
grep –v <pattern> <file> Print non-matching of <pattern> in <file>
grep <reg-exp> <file>
Syntax
97. Shell Commands - Advanced
Pattern Matching - sed
● Stream Editor (SED)
●
Sed perform basic text transformations on an input stream
● It can be a file, or input from a pipe
sed <reg-exp> <file>
Syntax
Option Meaning
sed –n ‘1,5p’ <file> Print line numbers ranging from 1-5 in the
given input file
sed ‘1,5d’ <file> > out Delete line number ranging from 1-5 in the
given input file and re-direct into another
file called out
sed ‘s/<old_string>/<new_string>/’
<file>
Replace <old_string> with <new_string> in
input <file>