Linux Terminal Mastery: Commands, Shells, and File Systems

This text is a transcript of a Linux crash course aimed at beginners. The course, offered by Amigo’s Code, covers the fundamentals of the Linux operating system, including its history, features, and various distributions. It guides users through setting up a Linux environment on Windows and macOS using tools like UTM and VirtualBox. The curriculum further explores essential Linux concepts like file systems, user management, and commands, including the use of the terminal. The course then introduces Bash scripting, covering variables, conditionals, loops, functions, and the creation of automated scripts. The goal of the course is to equip learners with the skills necessary to effectively use Linux for software development, DevOps, or system administration roles.

Linux Crash Course Study Guide

Quiz

1. What is Linux and who developed it?

Linux is a powerful and flexible operating system developed by Linus Torvalds in 1991. Unlike operating systems such as Windows and macOS, Linux is open source and allows developers around the world to contribute and customize.

2. What are the key features of Linux that make it a preferred choice for servers?

The key features are stability, security, the ability to be customized to specific needs, and performance. Due to these factors, servers worldwide often prefer Linux.

3. What is a Linux distribution? Name three popular distributions.

A Linux distribution is a specific version or flavor of the Linux operating system tailored for different purposes. Three popular distributions are Ubuntu, Fedora, and Debian.

4. Explain what UTM is and why it’s used in the context of the course.

UTM is an application that allows users to securely run operating systems, including Linux distributions like Ubuntu, on macOS. It’s used in the course to demonstrate how to set up and run Linux on a Mac.

5. What is VirtualBox and how is it used for Windows users in the course?

VirtualBox is a virtualization software that allows Windows users to install and run other operating systems, including Linux distributions like Ubuntu, within a virtual environment.

6. What is the difference between a terminal and a shell?

A terminal is a text-based interface where users type commands and view output. A shell is a program that interprets and executes those commands, acting as an intermediary between the user and the operating system.

7. What is Zsh, and why is it used in this course?

Zsh (Z shell) is an extended version of the Bourne shell, known for its advanced features like auto-completion, spelling correction, and plugin support. It is used in the course to provide a more customizable and efficient command-line experience.

8. What is Oh My Zsh, and what does it offer?

Oh My Zsh is an open-source framework for managing Zsh configuration. It includes numerous helpful functions, helpers, plugins, and themes to enhance the Zsh experience.

9. Explain the command sudo apt update. What does it do?

sudo apt update updates the package index files on the system. These files contain information about available packages and their versions. The sudo ensures the command is executed with administrative privileges.

10. What is a Linux command and what are its three main parts?

A Linux command is a text instruction that tells the operating system what action to perform. The three main parts are the command itself, options (or flags) which modify the command’s behavior, and arguments, which specify the target or input for the command.

Quiz Answer Key

1. What is Linux and who developed it?

Linux is a powerful and flexible operating system developed by Linus Torvalds in 1991. It’s open-source and allows for worldwide contributions.

2. What are the key features of Linux that make it a preferred choice for servers?

Key features include stability, security, customizability, and performance, making it ideal for servers.

3. What is a Linux distribution? Name three popular distributions.

A Linux distribution is a specific version of Linux. Ubuntu, Fedora, and Debian are examples.

4. Explain what UTM is and why it’s used in the context of the course.

UTM lets macOS users run other operating systems, including Ubuntu. The course uses it to set up Linux on a Mac.

5. What is VirtualBox and how is it used for Windows users in the course?

VirtualBox is a virtualization software. It allows Windows users to run Linux within a virtual environment.

6. What is the difference between a terminal and a shell?

A terminal is the interface for typing commands. The shell interprets and executes these commands.

7. What is Zsh, and why is it used in this course?

Zsh is an improved shell with features like auto-completion. The course uses it for a better command-line experience.

8. What is Oh My Zsh, and what does it offer?

Oh My Zsh is a framework for managing Zsh configuration. It provides themes and plugins to customize the shell.

9. Explain the command sudo apt update. What does it do?

sudo apt update updates package lists, requiring administrative privileges through sudo.

10. What is a Linux command and what are its three main parts?

A Linux command is a text instruction to the OS. It consists of the command, options, and arguments.

Essay Questions

  1. Discuss the advantages of using Linux as a server operating system compared to Windows Server. Consider factors such as cost, security, and customization.
  2. Explain the significance of open-source development in the context of Linux. How does the collaborative nature of its development benefit the Linux community and users?
  3. Compare and contrast the roles of the terminal and the shell in a Linux environment. How do they interact to enable users to control the operating system?
  4. Describe the process of installing Ubuntu on both macOS (using UTM) and Windows (using VirtualBox). What are the key differences and considerations for each platform?
  5. Discuss the importance of Linux file permissions and user management in maintaining a secure and stable system. Provide examples of how incorrect permissions can lead to security vulnerabilities.

Glossary of Key Terms

  • Linux: A powerful and flexible open-source operating system kernel.
  • Distribution (Distro): A specific version of Linux that includes the kernel and other software.
  • Open Source: Software with source code that is publicly available and can be modified and distributed.
  • Terminal: A text-based interface used to interact with the operating system.
  • Shell: A command-line interpreter that executes commands entered in the terminal.
  • Zsh (Z Shell): An extended version of the Bourne shell with advanced features and plugin support.
  • Oh My Zsh: An open-source framework for managing Zsh configuration.
  • Command: An instruction given to the operating system to perform a specific task.
  • Option (Flag): A modifier that changes the behavior of a command.
  • Argument: Input provided to a command that specifies the target or data to be processed.
  • Sudo: A command that allows users to run programs with the security privileges of another user, typically the superuser (root).
  • UTM: An application that allows you to run operating systems on macOS devices.
  • VirtualBox: Virtualization software that allows you to run different operating systems on your computer.
  • Operating System: The software that manages computer hardware and software resources.
  • Server: A computer or system that provides resources, data, services, or programs to other computers, known as clients, over a network.
  • Root Directory: The top-level directory in a file system, from which all other directories branch.
  • File System: A method of organizing and storing files on a storage device.
  • Directory (Folder): A container in a file system that stores files and other directories.
  • GUI: Graphical User Interface. A user interface that allows users to interact with electronic devices through graphical icons and visual indicators such as secondary notation, as opposed to text-based interfaces, typed command labels or text navigation.

Linux Crash Course: A Beginner’s Guide

Okay, here’s a detailed briefing document summarizing the main themes and ideas from the provided text:

Briefing Document: Linux Crash Course Review

Overall Theme: This document is a transcript of a video presentation promoting a “Linux Crash Course.” The course aims to take complete beginners to a point of understanding and mastering Linux, particularly in the context of software engineering, DevOps, and related fields. The presenter emphasizes that Linux is a fundamental skill in these areas.

Key Ideas and Facts:

  • Linux Overview:Linux is described as a “powerful and flexible operating system” developed by Linus Torvalds in 1991.
  • A key feature of Linux is that it’s “open source,” with developers worldwide contributing to its improvement and customization.
  • Linux boasts “stability, security, the ability of changing it to your needs, and performance.” This makes it preferred for servers globally.
  • Linux is used by “internet giants, scientific research companies, financial institutions, government agencies, educations,” and pretty much every single company out there.
  • Amigo’s code is actually deployed on a Linux server
  • Linux is versatile and used on “smartphones to service and also Raspberry Pi.”
  • Linux Distributions:Linux has different “flavors” called distributions.
  • Ubuntu is highlighted as the “most popular flavor of Linux.” It comes in server and desktop versions (with a graphical user interface).
  • Other distributions mentioned include Fedora, Debian, and Linux Mint.
  • Companies often customize Linux distributions to meet their specific needs.
  • Course Promotion:The presenter encourages viewers to subscribe to the channel and like the video.
  • The full 10-hour course is available on their website, with a coupon offered.
  • The course aims to “make sure that you become the best engineer that you can be.”
  • The course has a “Windows users as well as Mac users”
  • Setting up Linux (Ubuntu) on Different Operating Systems:Mac: The presentation details how to install Ubuntu on a Mac using an application called UTM (a virtualization software).
  • Windows: Installation of Ubuntu through VirtualBox.
  • Understanding the Terminal:The terminal allows users to interact with the operating system by entering commands.
  • Understanding the shellshell is a program for interacting with the operating system.
  • Z Shell (zsh)zsh also called the zshell is an extended version of Bor shell with plenty of new features and support for plugins and themes
  • Linux CommandsThey are case sensitive
  • Linux File SystemThe Linux file system which is the hierarchical structure used to organize and manage files and directories in a Linux operating system
  • Files and PermissionsLinux is a multi-user environment where allows us to keep users files separate from other users
  • Shell scriptingIt is essentially a command line interpreter

Quotes:

  • “If you don’t know Linux and also if you are afraid of the terminal or the black screen then you are in big trouble so this course will make sure that you master Linux”
  • “Linux is a must and don’t you worry because we’ve got you covered”
  • “Linux it’s a powerful and flexible operating system”
  • “Linux is open source developers around the world contribute to improve and customize the operating system”
  • “servers around the world prefer Linux due due to its performance”
  • “Linux is open source but it’s also used on a wide range of devices from smartphones to service and also Raspberry Pi”
  • “Ubuntu is the most popular flavor out there”
  • “At Amigo’s code we want to make sure that you become the best engineer that you can be”
  • “So many original features were added so let’s together in install zsh and as you saw the default shell for Mac OS now is zsh or zshell”
  • “We’ve got Bash as well as chh Dash KS sh T C CH and then zsh”

Potential Audience:

  • Beginners with little to no Linux experience.
  • Software engineers, DevOps engineers, backend/frontend developers.
  • Individuals seeking to enhance their skills and career prospects in the tech industry.

In summary: The document outlines a Linux crash course that aims to provide individuals with the necessary skills to confidently navigate and utilize the Linux operating system in various professional tech roles. It covers core concepts, practical setup, and promotes the course as a means to become a proficient engineer.

Linux and Shell Scripting: A Quick FAQ

FAQ on Linux

Here is an 8-question FAQ about Linux and shell scripting, based on the provided source material.

1. What is Linux and why is it important for aspiring engineers?

Linux is a powerful and flexible operating system developed by Linus Torvalds in 1991. Its open-source nature allows developers worldwide to contribute to its improvement and customization. Its stability, security, and performance make it a preferred choice for servers and various devices, ranging from smartphones to Raspberry Pi. For aspiring software, DevOps, or backend engineers, understanding Linux is crucial because most companies deploy their software on Linux servers, making it an essential skill.

2. What are Linux distributions and how do they differ?

Linux distributions (distros) are different “flavors” of the Linux operating system, each customized to suit specific needs. Popular distributions include Ubuntu, Fedora, Debian, and Linux Mint. Ubuntu, particularly its server and desktop versions, is a popular choice for many, while other distributions cater to specific requirements in different companies. The source material mentions Ubuntu will be used in the course.

3. How can I install Linux (Ubuntu) on my Mac?

On a Mac, Ubuntu can be installed using virtualization software like UTM. First, download and install UTM from the Mac App Store. Then, download the Ubuntu server ISO image from the Ubuntu website. Within UTM, create a new virtual machine, selecting the downloaded ISO image as the boot source. Configure memory and disk space as needed, and start the virtual machine to begin the Ubuntu installation process. The source material also highlights the Ubuntu gallery in UTM.

4. How can I install Linux (Ubuntu) on my Windows machine?

On Windows, you can use VirtualBox. The steps include downloading and installing VirtualBox. Then download the Ubuntu desktop ISO image from the Ubuntu website. Create a new virtual machine in VirtualBox, selecting the downloaded ISO image. Configure memory and disk space. Install ubuntu to the VM.

5. What is the difference between the Terminal and the Shell?

The terminal is a text-based interface that allows you to interact with the operating system by entering commands. It provides the prompt where commands are entered and outputs the results. The shell, on the other hand, is the program that interprets the commands entered in the terminal and executes them against the operating system. Shells include Bash, Zsh, Fish, and others.

6. What is Zsh and how do I switch from Bash to Zsh?

Zsh (Z shell) is an extended version of the Bourne shell, known for its advanced features like auto-completion, spelling correction, and a powerful plugin system. To switch from Bash to Zsh, first install Zsh using the command sudo apt install zsh. Then, change the default shell using the command chsh -s /usr/bin/zsh. After rebooting the system, Zsh will be the default shell. Oh My Zsh can be used to configure Zsh.

7. What are Linux commands, options, and arguments?

Linux commands are text instructions that tell the operating system what to do. They are case-sensitive. A command can include options and arguments that modify its behavior. For example, in the command ls -a ., ls is the command, -a is an option (for showing hidden files), and . is the argument (specifying the current directory).

8. What are user types and how do permissions work?

Linux is a multi-user environment with two main types of users: normal users and the superuser (root). Normal users can modify their own files but cannot make system-wide changes. The superuser (root) can modify any file on the system. Permissions control access to files and directories. The ls -l command displays file permissions, divided into three sets: user, group, and others. Each set includes read (r), write (w), and execute (x) permissions, dictating what actions each user type can perform on the file.

Understanding Linux: Features, Usage, and Commands

Linux is a powerful and flexible open-source operating system that was developed by Linus Torvalds in 1991 and has since become a robust platform used worldwide. Here’s an overview of some key aspects of Linux:

  • Open Source Linux is open source, meaning developers can contribute to improving and customizing it.
  • Key Features Stability, security, customizability, and performance are key features. Its flexibility and security make it a preferred choice for companies.
  • Usage Linux is used by internet giants, scientific research companies, financial institutions, government agencies, and educational institutions. Many companies deploy their software on Linux.
  • Distributions Linux has different versions called distributions, with Ubuntu being the most popular. Other distributions include Fedora, Debian, and Linux Mint.
  • Terminal In Linux, the terminal (also known as the command line interface or CLI) is a text-based interface that allows interaction with the computer’s operating system by entering commands. It provides a way to execute commands, navigate the file system, and manage applications without a graphical user interface.
  • Shell A shell is a program that interacts with the operating system. The terminal allows users to input commands to the shell and receive text-based output from the shell operations. The shell is responsible for taking the commands and executing them against the operating system.
  • File System The Linux file system is a hierarchical structure that organizes and manages files and directories. It follows a tree structure with the root directory at the top, and all other directories are organized below it.
  • Commands Linux commands are case-sensitive text instructions that tell the operating system what to do.
  • Shell Scripting Shell scripting automates tasks and performs complex operations by creating a sequence of commands. A shell script is saved with the extension .sh.

Shell Scripting Fundamentals in Linux

Shell scripting is a way to automate tasks and perform complex operations in Linux by creating a sequence of commands. It involves writing scripts, typically saved with a .sh extension, that contain a series of commands to be executed.

Key aspects of shell scripting include:

  • Bash Bash (Born Again Shell) is a command line interpreter used to communicate with a computer using text-based commands.
  • Editor A text editor is needed to write scripts, which could be a simple editor like Vim or a more feature-rich option like Visual Studio Code.
  • Shebang The first line of a shell script typically starts with a “shebang” (#!) followed by the path to the interpreter (e.g., #!/bin/bash). This line tells the operating system which interpreter to use to execute the script.
  • Variables These are containers for storing and manipulating data within a script. In Bash, variables can hold various data types like strings, numbers, or arrays.
  • Conditionals These allow scripts to make decisions based on specific conditions, executing different blocks of code depending on whether a condition is true or false.
  • Loops Loops enable the repetition of instructions. for and while loops can iterate over lists, directories, or continue tasks until a condition is met.
  • Functions Functions group a set of commands into a reusable block, promoting code modularity and organization.
  • Comments Adding comments to scripts is considered a best practice as it helps in understanding the script’s purpose, functionality, and logic. Comments are lines in a script that are not executed as code but serve as informative text.
  • Passing Parameters Bash scripts can receive input values, known as parameters or arguments, from the command line, allowing customization of script behavior. These parameters can be accessed within the script using special variables like $1, $2, $3, etc. The special variable $@ can be used to access all parameters passed to the script.
  • Executable Permissions Scripts are executables that require giving executable permissions using chmod.

To run a shell script:

  1. Save the script with a .sh extension.
  2. Give the script executable permissions using the chmod +x scriptname.sh command.
  3. Execute the script by using its path. If the script is placed in a directory included in the PATH environment variable, it can be run by simply typing its name.

Linux File Management: A Command-Line Guide

File management in Linux involves organizing, creating, modifying, and deleting files and directories. This is primarily done through the command-line interface (CLI) using various commands.

Key aspects of file management include:

  • Linux File System: The file system is a hierarchical structure with a root directory (/) at the top, under which all other directories are organized.
  • Essential Directories:
  • /bin: Contains essential user commands.
  • /etc: Stores system configuration files.
  • /home: The home directory for users, storing personal files and settings.
  • /tmp: A location for storing temporary data.
  • /usr: Contains read-only application support data and binaries.
  • /var: Stores variable data like logs and caches.
  • Basic Commands
  • ls: Lists files and directories. Options include -a to show hidden files and -l for a long listing format that includes permissions, size, and modification date.
  • cd: Changes the current directory. Using cd .. moves up one directory level. Using cd – flips between the previous and current directory.
  • mkdir: Creates a new directory. The -p option creates nested directories.
  • touch: Creates a new file.
  • rm: Removes files.
  • rmdir: Removes empty directories.
  • cp: Copies files.
  • File Permissions: Linux uses a permission system to control access to files and directories. Permissions are divided into three categories: user, group, and others. Each category has read (r), write (w), and execute (x) permissions. The ls -l command displays file permissions in a long listing format.
  • Working with Files:
  • To create an empty file, use the touch command.
  • To create a file with content, use the echo command to redirect a string into a file.
  • To view the contents of a file, you can use a text editor or command-line tools like cat.
  • Working with Directories:
  • To create directories, use the mkdir command.
  • To remove empty directories, use the rmdir command.
  • To remove directories and their contents, use the rm -rf command.
  • Navigating the File System To navigate, utilize the cd command followed by the directory path.

It is important to note that commands are case-sensitive.

Linux User and File Permissions Management

User permissions in Linux control access to files and directories in a multi-user environment. Here’s an overview:

  • Types of Users There are normal users and superusers (root).
  • Normal users can modify their own files but cannot make system-wide changes or alter other users’ files.
  • Superusers (root) can modify any file on the system and make system-wide changes.
  • Commands for User Managementsudo: Executes a command with elevated privileges.
  • useradd -m username: Adds a new user and creates a home directory.
  • passwd username: Sets the password for a user.
  • su username: Substitutes or switches to another user.
  • userdel username: Deletes a user.
  • File Permissions Permissions determine who can read, write, or execute a file.
  • The ls -l command displays file permissions in a long listing format. The output includes the file type, permissions, number of hard links, owner, group, size, and modification date.
  • The file type is the first character. A d indicates a directory, and a – indicates a regular file.
  • Permissions are divided into three sets of three characters each, representing the permissions for the user (owner), group, and others.
  • r means read, w means write, and x means execute. A – indicates that the permission is not granted.
  • The first three characters belong to the user, the second three to the group, and the last three to everyone else.

Essential Linux Terminal Commands

Linux terminal commands are case-sensitive text instructions that tell the operating system what to do. These commands are entered in the terminal (also known as the command line interface or CLI), allowing you to interact with the operating system. The terminal provides a way to execute commands, navigate the file system, and manage applications without a graphical user interface.

Here are some basic and essential commands:

  • ls: Lists files and directories.
  • ls -a: Includes hidden files.
  • ls -l: Uses a long listing format, displaying permissions, size, and modification date.
  • cd: Changes the current directory.
  • cd ..: Moves up one directory level.
  • cd -: Flips between the previous and current directory.
  • mkdir: Creates a new directory. The -p option creates nested directories.
  • touch: Creates a new file.
  • rm: Removes files.
  • rmdir: Removes empty directories.
  • cp: Copies files.
  • sudo: Executes a command with elevated privileges.

Each command may have options and arguments to modify its behavior. To understand how to use a command effectively, you can refer to its manual for instructions.

Linux For Beginners – Full Course [NEW]

The Original Text

what’s going guys assalamualaikum welcome to this  Linux crash course where I’m going to take you   from complete beginner to understanding Linux this  is a course that abs and I put together and it’s   currently 10 hours which a bunch of exercises  if you don’t know Linux and also if you are   afraid of the terminal or the black screen then  you are in big trouble so this course will make   sure that you master Linux and whether you want to  become a software engineer devops engineer backend   front end it doesn’t really matter Linux is a  must and don’t you worry because we’ve got you   covered if you’re new to this channel literally  just take 2 seconds and subscribe and also smash   the like button so we can keep on providing you  content like this without further Ado let’s off   this video okie dokie let’s go ahead and kick off  this course with this presentation which I want   to go through so that you have a bit of background  about Linux so Linux it’s a powerful and flexible   operating system that was developed by lonus tals  in 1991 so the name Linux comes from the Creator   Linus and since 1991 Linux has grown into a robust  and reliable platform used by millions worldwide   as you’ll see in a second the cool thing about  Linux unlike operating systems such as Windows Mac   OS is that Linux is open source developers around  the world contribute to improve and customize the   operating system and it has a Vibrant Community  of contributors and I’ll talk to you in a second   about distributions as well because it plays a big  part since Linux is open source the key features   of Linux are stability security the ability of  changing it to your needs and performance so   servers around the world prefer Linux due due to  its performance so who uses Linux well interned   Giants scientific research companies financial  institutions government agencies educations and   the platform that you are using right now so  Amigo’s code is actually deployed on a Linux   server so you look at Google meta AWS NASA  and obviously Amigo’s code and pretty much   like every single company out there majority of  them I can guarantee you that their software is   being deployed on Linux it might be a different  flavor of Linux but it will be Linux and the   reason really is because of the flexibility  and it’s secure so this is why companies opt   to choose Linux and the cool thing about Linux  is that it’s open source as I’ve mentioned but   it’s also used on a wide range of devices from  smartphones to service and also Raspberry Pi so   if you’ve ever used a Raspberry Pi the operating  system on this tiny computer is Linux Linux has   something called distributions and these are  different flavors the most popular flavor of   Linux is Ubuntu and you have the iunu server or  the desktop which comes with a graphical user   interface and this distribution is what we’re  going to use and is the most popular out there   but obviously depending on the company that  you work for the software will be deployed on   a different flavor of Linux to customize their  needs but there are also other distributions   such as Fedora Debian Linux Mint and plenty  of others and this is a quick overview about Linux cool before before we actually proceed  I just want to let you know that the actual   10 hour of course is available on our brand  new website and I’m going to leave a coupon   and a link as well where you can basically go  and check for yourself because many of your   students already have engaged with the course  they’ve been learning a lot and to be honest   the positive has been really really great so far  so we are coming up with something really huge   and we decided that Linux had to be part of this  something and here Amigo’s codee we want to make   sure that you become the best engineer that you  can be details will be under the destion of this video okie dokie for the next two sections  we’re going to focus on Windows users as   well as Mac users and just pick the operating  system that you are using and go straight to   that section because the setup will be the  exact same thing so I’m going to show you   how to get Linux and you bu to up and running  on your operating system if you want to watch   both sections feel free to do so uh but in this  course I just want to make sure that there’s no   issues when it comes to Windows or Mac because  there’s a huge debate which uh is better and   also um after those two sections you’ll see  how to rent a server of the cloud okay so   if you don’t to use nor um yunto or Linux on  your local machine but you prefer to rent it   from the cloud I’m also going to show you how  to do so cool this is pretty much it let’s get started in order for us to install Ubuntu on  a Mac operating system we’re going to use this   application called UTM which allows you to  securely run operating systems on your Mac   whether it’s window Window XP which I really  doubt that you’re going to do windows I think   this is Windows 10 maybe you can also run your  buntu which is the one that we’re going to run   and also like old operating systems in here also  Mac as well so you can virtualize Mac and um I’ll   basically walk you through how to use it and  install yuntu right here which is what we need   in order to get up and running with Linux cool  so in here what we’re going to do is click on   download and you can download from the Mac Store  then pretty much save this anywhere so in my case   I’m going to save it on my desktop and just give  a second to download cool then on my desktop I’m   going to open up this UTM DMG there we go and all  I’m going to do is drag this to applications and   job done now let me close this and also I’m  going to eject UTM and also I’m going to get   rid of this UTM file in here and now I’m going to  press command and then space and we can search for   UTM and then I’m going to open and I’m going to  continue and there we go we successfully installed UTM the next thing that we need is to install  Ubuntu navigate to ubuntu.com and in this page   in here we can download yuntu by clicking on  download and then what I want you to do is   let’s together download the Ubuntu server and  I’ll show you how to get the desktop from the   Ubuntu Server so here you can choose Mac and  windows so I’ve got the arm architecture so   I’m just going to choose arm in here if you  are on regular Mac and windows you can just   basically download your Windows server for  the corresponding architecture and operating   system so here I’m going to click on arm and  you can read more about it in here so this is   the I think this is the long-term support 2204 and  then two and right here you can see that you can   download the long-term support or I think this  is the latest version in here so in my case it   doesn’t really matter which version I download so  I’m just going to download the long-term support   in here so this my bugs who knows so here let’s  just download and I’m going to store this onto my desktop now just give it a minute or so so  my internet is quite slow and you can see the   download still uh in progress but once this  finishes I will um come back to you awesome   so this is done also what I want to show you  is within UTM you can click on on browse UTM   gallery or you can get to it via so in here  if I switch to the UTM official website in   here click on gallery and basically this gives  you a gallery of I think the operating systems   which are currently supported so you can see Arch  Linux Debian Fedora Kali Linux which is quite nice   actually and then you have Mac OS you have Ubuntu  I think this is the older version actually you’ve   got the 20.01 which is the long-term support  Windows 10 11 7 and XP so if you want to go   back to olden days feel free to do so but  we just downloaded yuntu from the official   website which is good and also have a look the  architecture in here so arm 64 x64 right so make   sure to pick the one which is corresponding to  you so if you want to have for example Windows   as well feel free to download an experiment or  a different version of Linux so K Linux which   is quite nice actually feel free to do it but  in my case I’m going to stick with traditional   buntu and next what we’re going to do is to  create a virtual machine and have Linux up and running right we have UTM as well as the iso  image in here for Ubuntu let’s create a brand new   virtual machine and in here we want to virtualize  never emulate so here this is slower but can run   other CPU architectures so in our case we want to  virtualize and the operating system is going to be   Linux leave these and check and in here boot ISO  image open up the iso that we’ve just downloaded   right so here browse and I’ve just opened up  the Ubuntu 22.0 4.2 the next step is going to   be continue and here for memory usually you should  give half of your available memory so in my case   I’m just going to leave four gigs I’ve seen that  it works quite well and I do actually have 32 but   I’m not giving 16 so I’m just going to leave four  in here and CPU course I’m G to leave the default   and here if you want to enable Hardware open  Gil acceleration you can but there are known   issues at the moment so I’m not going to choose  it continue 64 gig so this is the size of the dis   continue and here there’s no shared directory path  continue and for the name in here what I’m going   to do is say YouTu and then the version so 20.0  four dot and then two awesome so you can double   check all of these settings and I think they’re  looking good click on Save and there we go so at   this point you can see that we have the VM in here  so we’re going to start it in a second we can see   the status is stopped the architecture arm the  machine memory 4 gig the size this will increase   in a second and there’s no shared directory but  the cd/ DVD is yuntu which is this one in here so   one more thing that I want to do is so before  we play I want to go to settings so in here   click on settings and you can change the name  if you want to in here and uh all I want really   is within this play I’m going to choose retina  mode and this will give me the best performance   cool so save and I’m good to go next let’s go  ahead and install Ubuntu within our virtual machine oky dokie now the next step for us is to  click on play in here or in here and this should   open this window so in here you can see that  currently so I’m just gonna leave the the screen   like this so currently you can see that it says  press option and um I think it’s enter for us to   release the cursor So currently my cursor is not  visible right and the way that I can interact with   this UI is by using my keyboard so the down arror  in here and the app Arrow right so if you want   your cursor back you just press control and then  option I think control option there we go you can   see that now I have the mouse in here cool let me  just close this in here for a second and I’m going   to Center this like so and now what we’re going  to do is try or install Ubuntu Server so I’m going   to press enter on my keyboard so display output  is not active just where a second and we should   have a second screen there we go you can see that  now we have this other the screen and basically   now we can basically configure the installation  process so in my case I’m going to use English UK   and here so for you whatever country you are just  use the correct country basically so here English   UK for me press enter Then the layout and the  variant so for the keyboard I want to leave as   default and at the bottom you can see that I can  flick between done and back so I’m just going to   say done and I’m going to leave the default  so I want the default installation for you Bo   to server not the minimized so just press enter  and here there’s no need to configure the network   connections continue no need to configure proxy  and also the mirror address just leave as default   enter and in here configure a guided storage so  here I’m going to use the entire disk and leave   as default so just with my errors go all the way  to done enter and here now we have the summary   and you can see the configuration basically 60 gig  and I think the available free space is 30 gig and   you can see there and at this point I you sure  you want to continue I’m going to say continue   now for the name I’m going to say Amigos code the  server name I’m going to say Amigos code the usern   name Amigos code the password I’m going to have  something very short and Easy in here and then   go to done continue and I’m not going to enable  yuntu Pro continue continue there’s no need to   install open SSH server because we don’t need to  remote access this server that we are installing   so here done and also we have a list of available  software that we can install so for example micro   Kates nexcloud Docker you can see AWS CLI in here  so a CLI Google Cloud SDK we don’t need none of   these also postgress which is right here so if  you want to install these by all means feel free   to take but for me I’m going to leave everything  as default done and at this point you can see that   what he doing is installing the system so just  wait for a second and I’m going to fast forward   this step oky doie so you can see that the  installation is now complete and at this point   what it’s doing is downloading and installing  security updates so it’s really up to you whether   you want to wait for this or not but in my case  I think it’s you know the best practice for you   to have everything patched and um updated so I’m  just going to wait and then I’ll tell you what are   the next steps so this might take a while so just  sit back and relax all right so this is now done   and you can see that installation is complete and  we can even say reboot now but don’t don’t click   reboot now what we need to do is so basically we  have to close this so again close this window will   kill the virtual machine which is fine okay now  open UTM once more and you can see that we have   the Ubuntu virtual machine in here and if I open  this up once more so all I want to show you is   that this will take us to the exact same screen  to install yuntu server now we don’t want this so   close this and what we have to do is in here  so CD DVD clear so we have to remove the iso   image and at this point feel free to delete this  so here I’m going to delete this and that’s it   cool so this is pretty much the installation for  Ubuntu next let’s get our Ubuntu Server up been running cool so make sure that this CD for/ DVD  is empty before you press continue or before   you press play so let’s just play this there  we go and I can close this and I’m going to   Center things there we go and at this point we  should see something different there we go now   have a look yuntu the version that we installed  and then it says Amigos code login cool so here   what we need to do is I think we have to add  the username which is Amigos code then press   enter followed by by the password so my password  was I’m not going to tell you basically but it’s   a very simple one so here you don’t see the  password that you type so just make sure that   you have the username and the password press  enter and check this out so now we are inside   and we’ve managed to log in cool so at this point  this is actually yuntu server right so there’s no   graphical user interface and um that’s it right  so later you’ll see that when you SSH into the   servers this is what you get right so this black  screen and that’s it now obviously for us I want   to basically install a graphical user interface  so that basically you see the Ubuntu UI and um   the applications I I’ll show you the terminal  and whatnot but in a shell this is yuntu server   so at this point you can type commands so here  for example if you type LS for example just L   and then s press enter nothing happens if you type  PWD so these are commands you learn about these uh   later but if I press enter you can see that I’m  within home/ Amigos code if I type CD space dot   dot so two dots enter you can see that now if I  type PWD I’m within home okay so this is pretty   much the yuntu server and this is a Linux box  that we can interact with but as I said we want   to install a graphical user interface to simplify  things for now and that’s what we’re going to do next within the official page for UTM navigate  to support in here and I’ll give you this link   so you can follow along but basically they give  you the installation Pro process and things that   you should be aware when working with UTM now  one of the things is if we click on guides or   expand you can see that you have the different  operating systems so Debian 11 Fedora Cali yuntu   Windows 10 and 11 so we installed 2204 so let’s  open that and it doesn’t really matter just click   on your BTU and whatever version here um that  you have installed this will be the exact same   thing okay so just select yuntu anything that says  going to in here cool so if I scroll down in here   so they have a section so we’ve done all of this  creating a new virtual machine and basically here   installing you B to desktop if you install you B  to server then at the end of the installation you   will not have the graphical user interface to  install we need to run these commands in here   so sudu apt and then update and then install and  then reboot awesome let’s go ahead and run these   commands cool so in here within in Yun to server  let me see if I can increase the font size for   this so control and then plus and it doesn’t look  like I can but I’ll show you how to increase the   font size for this in a second but here let’s  type together PSE sudo and then a and then   update press enter and then it’s asking me for  the password for Amigos code so make sure you   add the password for your username press enter  and you can see that it’s basically performing   the update now now the update basically is used  to update the package index files on the system   which contains information about the available  packages and their versions cool so you can see   that 43 packages can be upgraded now if you  want to upgrade the packages we can run PSE   sudo and then AP so let me just remove the mouse  from there ABT space and then up and then grade   and here I’m going to press enter and we could  actually use flags and we could say Dy but for   now let’s just keep it simple and later you learn  about these commands so press enter and you can   see that it says that the following packages will  be upgraded right so you see the list of all the   packages do you want to continue I can say why  why for yes cool now just give it a second and   now it’s actually upgrading these packages to  their latest versions so it’s almost done and   and now it says which Services should be restarted  leave everything as default and say okay so I’m   just going to press the tab and then okay cool  that’s it so now the last thing that we need to   do is to install Yun desktop so this point type  sud sudo a and then install Ubuntu Dash and then   desk and then top press enter and you can see  that it gives us a prompt I’m going to say w   and now we’ve go prompt and it says do you want  to continue I’m going to say y for yes and now   we just have to wait until it installs the Yun  to desktop and this is pretty much the graphical   user interface that will allows us to interact  with our operating system like we are using for   example the Mac OS right so this is the graphical  user interface but equally we do have the terminal   so if I open up the terminal quickly so terminal  so have a look so this is the terminal right so so   what we doing is we are basically installing the  same experience that we have within Mac OS so if   I click on the Apple logo and then basically use  all of the functionalities that this operating   system has to offer right so if I click on about  this Mac and then I can go to more info so on and   so forth so let me just cancel this and just wait  for a second until this finishes oky doie cool so   this is done and if you encounter any errors  or anything whatsoever just restart and then   run the exact same command but here you see that  there were no errors cool at this point there’s   no services to be restarted no containers and  all we have to do is re and then boot now just   wait for it and hopefully now at this point  you should go straight into the desktop okie   dokie you can see that now we managed to get the  desktop app and running cool so at this point just   click on it the password so this is my password  and I’m going to press enter hooray and we’ve   done it cool so if you managed to get this far  congratulations you have successfully installed   yuntu otherwise if you have any questions drop  me a message next let’s go ahead and set up Ubuntu okie dokie so we have yuntu desktop up  and running and from this point onwards let me   just put this as full screen and for some reason  I have to log in again again that’s fine cool so   you can see that the UI looks nice and sharp  and in here let’s just um basically say next   we don’t want to install the btu Pro and in  here whether you want to send information to   developers I don’t really mind to be honest  and location I’m just going to turn it off   and here it says you’re ready to go and let’s  just say done cool we have the home so here I   can just put this on this side and what we’re  going to do here is some customization this is   actually an operating system so you’ve got a  few things in here so you’ve got mail client   you’ve got files so if I click on files you  know this is a file system you know the same   as I have in my Mac so here let me just close  this and what I want to do is I want to go to   show all applications or I could just right  click in here and then I can say a few things   so one is display settings this is what I’m  mostly interested so in here I’m going to   put things a little bit bigger so fractional  scaling and here I’m going to increase this by 175% apply so that things are quite visible to  you so here keep changes and you can see that   now it’s nice and big cool so just move this in  here and it doesn’t look like it lets me right   So eventually it will let me move this but also  I can click on show all applications and I can go   to settings through here so the same thing and um  cool so you can go to keyboards you can you know   change according to your layout so I’m going to  leave my one as English UK which is fine you can   go to displays you can change the resolution if  you want to power configure that whether you want   power saver mode or not and um online accounts  so here I’m not going to connect to anything   privacy go back and I’m just showing you around  so background if you want to change the background   you’re more than welcome to do so here a couple of  different ones but for me I’m going to stick with   the default and appearance as well you can change  this right so here if you want a blue theme for   example which I kind of like to be honest or this  purple right here so let’s just actually choose   this blue for myself and for the desktop size  I’m going to say Lodge in here so that things   are visible to you okay and I can scroll down  and also icon size just as big as this and you   can show Auto Hide dock does that work probably  I don’t know right so I think it hides when yes   when this collides with this right so basically at  this point it just hides cool let me just remove   that I don’t think I need that and notifications  so you can go through and customize this the way   you want it but for us I think this is looking  good one other thing also is if you have a window   opened you can basically pull it all the way to  the left and it will just snap so if I open a   new so let’s just say I have um a new window for  example I can put this right in here and you can   see that it auto arranges for me which is kind  of nice and uh to be honest I think I’m going   to stick with the red so red not not there but I  think it was appearance yes I think this orange   or actually orange I think this orange looks nice  yeah I don’t know it’s very difficult cool so I   think I’ll just stick with this default for now  cool and um yeah so let me just close this and   this and this is pretty much it uh I don’t know  for some reason why this is not um oh actually let   me just click on arrange icons maybe that will  do it no I think it doesn’t do it because it’s   too big it doesn’t want to move but I think if I  restart then it should basically sort itself out   uh the other thing is so in here yes so here I can  basically remove so I’m going to remove this from   favorites same as this so stop and quit and remove  favorites the same with this and no need for help   and I think this is pretty much it awesome this  is my setup and also I think the clock is I think   it’s 1 hour behind so feel free to fix that but to  me it doesn’t really matter so this is pretty much   it if you have any questions drop me a message  but this is the configuration required for yuntu in order for us to install yuntu desktop on  Windows let’s use Virtual box which basically   allows you to install and run a large number  of guest operating systems so here you can   see uh Windows XP which I doubt you’ll ever use  Vista Windows and then Linux in here Solaris so   these are different distributions but basically we  need virtual box in order to install another guest   operating system on top of windows so navigate to  downloads and in here download the Windows host   so just give it a second and then open file there  we go I’m going to say next so the installation   process should be really straightforward and don’t  worry about this warning in here so just say say   yes and then it says missing pice dependencies  do you want to install it yes why not and then   install cool so this should take a while and you  can see that we have the shortcut being created   for us in here and we are good to go so let me  just unake this because we’re going to continue on   the next video say finish and we have successfully  installed virtual box catch me on the next one we do have virtual box installed and before I open  this application in here the next thing that we   need is the Ubuntu desktop itself so that we can  mount on top of virtual box so in here if I open   up my web browser and search for Ubuntu on Google  and basically go to ubuntu.com and you you should   see so if I accept in here you should see that  we can download so we have yunto server in here   and this is the current version as I speak and  whatever version that you see provided that is the   sorry this is not the latest this is the long-term  support but whatever long-term support you see   just download that so here go to developer and you  should see that we have yuntu desktop so click on   that and we can download yuntu desktop so you can  watch this video if you want but I’m not going to   but if I scroll down you can see that it says that  your buntu comes with everything you need to run   your organization School home or Enterprise and  you can see the UI in here so on and so forth so   let’s go ahead and download yuntu cool now if  I scroll down in here you can see that we have   this version so long-term support just download  whatever long-term support you see available so download and it should start very soon there we  go and it should take about 5 minutes or so to   complete or even less now and there we go now  let me open this on my desktop and you can see   that it’s right here awesome now that we have  Ubuntu desktop next let’s go ahead and uh use   Virtual box to install this ISO image in here  this is pretty much it catch me on the next one cool let’s open up virtual box in here  and I’ll walk you through the steps required   to get yuntu desktop up been running so if this  is the first time that you’re using virtual box   this should be completely empty so what we’re  going to do is create new and here we’re going   to name this as yuntu there we go and you can put  the version if you want but I’m going to leave it   as is then for the iso image is the one that we  downloaded so here let’s just select order and   then navigate to desktop and I’ve got my Ubuntu  ISO image open cool and in here you can see that   basically we can’t really select anything else  so let’s just click next and we can actually   have the username and password so in my case I’m  going to say Amigos and then code there we go and   then choose the password so if I click on this  I icon in here you can see that it says change   me right so you can change this or you can leave  it as default so in my case I’m going to leave as   change me but obviously I would never do this  and I want want to leave the host name as you   B to domain as uh what it is right now and then  next then we need to specify the base memory in   here as well as the CPU so for CPU let’s just  choose two cores in here and for memory if you   have more memory on your machine just feel free  to rank this up to maybe four gigs but for me I’m   going to leave as default next and then here it  says either to create a virtual hard disk or use   an existing or do not so in my case I’m going to  basically have 20 gigs so here I’m really saving   memory uh I don’t think there’s much space on  this Windows machine so 20 gigs I think should   be fine and uh yeah create a virtual hard disk  say next and now we have a summary you can read   through it and let’s finish cool so this is pretty  much it now you can see that it says powering VM up so just wait for a second until this is up  and running and you can see that I think it’s   done right so you can see that it’s actually  running now obviously if I click click on it and then we have this window and you can see  that it’s loading yuntu and it says mouse mouse   integration so click on here and then there as  well all right so just give her a second or so   and uh this should install successfully and there  we go you can see that this was really quick and   and here you can see that it’s installing few  things so this is now installing and basically   I’m going to leave this complete and then I’ll  come back to it so that we can proceed our setup   cool now it’s installing the system and I can  click on this button and you can see what it’s   doing on the terminal so let’s just wait until  this finishes and this should take a while for   you so for me I’m going to speed up this video but  uh you should yuntu up and running in a second and   in fact we could actually skip this all together  but I’m going to leave it finish and after a long   time of waiting it seems that it’s almost there  let’s just wait and finally we are done cool so   if you get to this point where you have your  user and then you can click on it and then in   here the password was change and then me right  so I didn’t change the password let me just show   you so change me if I press enter we should be  able to log in if the password is correct there   we go cool this is pretty much it I’m going to  leave it here and we’ll continue on the next video okie dokie so we are almost done  with the configuration so one thing that   I want to do is let’s just click on  Virtual box in here and uh click on settings and then let’s go to Advanced so under  General click on Advanced and then share clipboard   so we’re going to basically say bir directional  and the same for drag and drop so basically we   can basically drag stuff from our Windows to our  yuntu desktop and uh the same with the clipboard   say okay or actually let’s just go to system  and see whether we have to change something so   I don’t think we have to change anything else  and uh under storage so in here so just make   sure that this is empty so make sure that this  is empty that it doesn’t contain the iso image   in here cool audio everything should be fine if  you want to enable AUD the input feel free to   do so serial ports nothing USB shared folders and  user interface we’re going to leave everything as   is okay and in here I can just close this and uh  if I try to put this full screen in here you can   see what happens so to do this what we have to  do is install virtual box guest editions so in   here we’re not going to connect to any online  accounts let me just Skip and also I’m going   to skip the pro yuntu pro next and uh also if  you want to send data feel free but I’m not   going to send any data click on next and uh I’m  going to turn off location and there you go you   you see that it says you’re ready to go you can  use software to install apps like these so press   done and what I want to do is let’s open up the  T terminal so click on this button in here that   shows all applications and then open the terminal  so this is the terminal and with the terminal open   let me just put this full screen like that and  now what we’re going to do is type some commands   and at this point in here I don’t expect you to  know none of this because we’re going to learn   in detail how all of this works cool so the first  thing that that we want to do is is if you type   with me so P sudo and then here we’re going to say  a PT and then up and then date so if this command   in here does not work and now it’s asking me for  the password so change and then me now I’m typing   but you don’t see that I’m typing because this is  done by default because here I’m typing sensitive   information which is the password press enter  and and if it says that Amigo’s code is not in   sudo’s file this incident will be reported that’s  fine so all we have to do is so if this happens   to you type pseudo or actually sorry my bad Su and  then Dash and then here type the password again so   change and then me and or whatever password that  you added and there we go now we can type pseudo   and then add and then user so user and make sure  that add user is all together and then type Amigos   so the user in question so this is Amigos code for  me and then we want to add Amigos code to PSE sudo   just like that press enter and you can see that  this is basically added Amigos code to PSE sudo   and now it means that if I say Su and then Amigos  and then code and by the way Su just allows it to   change users and you will also learn about this  command press enter and now you can see that I’m   back to Amigos code in here and if we type PSE  sudo and then basically the the previous command   I’m just going to press the up aror this one so  P sudo AP and then update and then let’s add the   password once more so change me enter you can see  see that this time this command works so I’m going   to leave these commands that I’ve just did under  description of this video so that you can follow   along as well cool the next command that we need  to run is PSE sudo in here and then AP install   Dash and then Y and then build Dash and then  essential space and then Linux Dash and then   headers Dash and then add dollar sign and then  parenthesis and then you name space Dash and then   R and then close parentheses just like that cool  also you’ll find this command under description   of this video press enter and just give you a  second or so and there we go now navigate to   devices and then insert guest editions CD image  and you can see that we have this dis in here so   let’s just click on it and now what we want to do  is let’s take this file in here autorun Dosh and   then drag it to the terminal in here and let’s  see whether this works so if I so right at the   end if I press enter this doesn’t work and that’s  because I need to remove the quotes there we go so   the quote at the beginning and also the one at  the end and then press enter and it looks like   it doesn’t work so let’s just click on the dis  again and then here I’m going to right click and   then opening terminal so we have a new terminal  let me close the old one so close this terminal   and then we can close this as well and now if  I put this full screen all I want you to do is   to type dot slash and then autorun Dosh press  enter and now it’s asking me for the password   for Amigo’s code and the password was change me so  change me let me show you change me authenticate and it’s installing some modules now we have to  wait until this is complete and the last step   will be to restart our machine and uh it says  press return to close the window it seems to   be done so I’m just pressing return there we go  finished and now let’s together so in here click   on the battery icon and then let’s click on power  off restart restart and now if I restore down so   let’s just restore and and um what I want to do  is I want to put it full screen so if I maximize   now now you saw that the screen went black and uh  what we have to do is so let’s just basically make   this smaller open up virtual box and basically on  this Ubuntu which is running click on settings and   display and what we want to do is to change the  video memory now this is grade out because what   we need to do first is right click on the VM  itself and we want to stop it so stop and then   power off cool let’s switch it off now we can go  to settings and then display and now you can see   that we can change this now I’m going to put this  at 64 somewhere in the middle okay and if we click   on it so you can click here or you can start  if you want through this button just give you a second and very soon we should have so  let me just close this we don’t need this so it should start very soon there we go and  if we try to put this full screen on actually did   that for me but what I want to do is actually put  everything full screen you can see that this time   it works there we go and then if I click on Amigos  code the password was change me enter and we are   inside cool so now what we can do is go to view  and then you can say full screen mode and you   can switch in here and you can see that now all of  this is in full screen mode and we done it awesome   we successfully installed yuntu and if you want to  exit full screen you can see here I could just go   down View and then you have the keyboard shortcuts  as well but if I press on it you can see that I   came out from this and I do have access two in  here my Windows machine cool this is pretty much   it and also if you get software updata just  go and install as always but in my case I’m   going to be naughty and I want to say remind me  later this is pretty much it catch me on the next one cool in this video what I want to walk  you through is how we going to customize our   desktop so in here let’s together just put this  full screen and I’m going to switch there we go   and if you want to customize the look and feel  of yuntu desktop go to show applications at the   bottom and then click on settings cool now that we  have settings in here we are able to change couple   of things so you can change the network specific  information Bluetooths in here background so you   can choose for example if you don’t like this  background just choose this one for example you   can see that it changes but for my case I’m going  to stick with the default in here appearance so   appearance you can change the color theme in  here so maybe you like this color in here so   if I click on it you can see that the icons have  changed have a look right but I’m going to leave   the default in here so everything is consistent  throughout and you can change the icon size if   you want as well so I think the icon size I  think we have one icon in here so the oh icon   so if I increment this no it’s yeah the icon  size is basically this one right here on the   left right so I’m going to leave that as 64 you  can change this according to whatever you prefer   so for me it’s more about making sure that you  see everything visible in here notifications so   there’s nothing here search multitasking so you  can basically configure this uh I’m not going   to touch none of these applications so there’s  no configuration on any of these applications   in here let me just go back privacy same nothing  I’m going to change here and um online accounts   you can connect your Google account Microsoft and  whatnot sharing so there’s nothing here you can   change the the computer name if you want sound as  well power so basically you can have power saver   or not screen blank after whatever minutes screen  display and in here let’s basically scale this so   let’s say that we want 200 so apply and you can  see that things are now so big so I’m going to   keep these changes 200 and um let’s have a look  if I put this full screen what what do I get yeah   this looks nice right so 200 and then let me go  to I think it was background or sorry appearance   and then the icon size we can make a little bit  smaller now just like this you can leave it like   that uh but as as I said you could basically do  whatever you want okay so screen display and again   you can make this 100% I’m just making things  big so you can see sharply and then Mouse and   touchpad you can change the speed if you want the  keyboard so my one is so so let me just add United   Kingdom so this is my one English UK and add and  then delete this guy so remove there we go and   um printers nothing there removable media nothing  and device color profiles and obviously here I can   scroll down and you can see a bunch more right so  language region so here you can change the region   the language accessibility date and time so on and  so forth all right so also the same with users so   here we only have one user and uh you can change  the password if I’m not mistaken in here right   cool so my password is changed me I could change  for uh something better but I’ll show you how to   do all of this through the terminal which is uh  what we are here to learn how to use Linux andd   terminal let me cancel and then close this so  let’s just get rid of this from favorites I’m   going to get rid of this as well office as well  ubun to sofware as well help as well I want to C   I want to keep it clean eject there and I think  this is it awesome this is pretty much it if you   have any questions drop me a message but from now  on if you you followed the Mac installation this   is the exact same point and vice versa so from  now on both Mac and windows uses everything should   be the same because we are using Ubuntu desktop  this is pretty much it I’ll see you on the next one okayy doie so with Linux it’s all about the  terminal and really the reason why I installed the   desktop is so that you basically get an operating  system but what we’re going to focus throughout   this course is on the terminal so Linux it’s all  about the terminal and as you’ll see later when   we SS into a remote server we never have the  graphical user interface so it’s all about the   terminal cool so what is a terminal really  right so terminal also known as the command   line interface or CLI so in here if I go to show  applications and we have terminal so let’s just   take terminal and I think if we put it there  does it takes it from here so hold on so let   me just put it back in here right click add to  favorites oh yes it doesn’t really matter cool   so the terminal now it’s within the favorites and  now I can just click on it and open cool so what   is this terminal in here right so we have Amigos  code and then add Amigos code so the terminal   is a text based interface that allows you to  interact with a computer operating system by   entering commands so in here let me just type  one command and you’ll see how it works so if   I say date for example press enter so this  is giving me the current date so this was   a command and we’ll let learn more about this  um commands and what not in a second but this   is a command which allows me to interact with the  operating system so similarly if I want to create   a folder in here on my desktop I’m going to type  mkd and then here just type Tilda for a second so   tilder for SL desktop and then say for Slash and  here I’m going to say f for example press enter   and now have a look there’s a new folder that  was created for us full right so the terminal   allows us to interact with the computer operating  system by entering commands it provides a way to   execute commands navigate the file system manage  applications without the need of the graphical   user interface so to be honest we don’t even need  this UI right so usually you would right click   and then uh move to trash for example so this so  This basically deletes the file so this is with   the graphical user interface but in reality we  don’t need this right so here if I just say for   example RM and we’ll go through these commands in  a second so RM and then tiller for Slash and then   desktop and then F and actually so here I need  to say RM dasr and then F so you learn this in   a second if I press enter you can see that now  the folder has disappeared okay so this is the   terminal so the terminal allows us to interact  with the operating system the time not provides   a prompt so this is the prompt where we can  enter the commands and receive the output so   when we say date we get an output right so some  commands we don’t get an output but I’ll show   you um other other things that we can do right so  with this we can per perform a wide range of tasks   such as navigating directories creating modifying  files running programs accessing system resources   and whatnot so the terminal is commonly used by  developers and systems administrators to perform   a bunch of tasks including software development  server Administration and Automation and this is   a very powerful and efficient way to work with a  computer operating system and it’s an essential   tool for everyone working with programming and  development so knowing how to use the terminal   it’s a must for you right so this is the reason  why I’ve got this course for you because you   should be doing pretty much everything through  your terminal okay I don’t want to see you know   if I want to create a folder right click on your  uh graphical user interface new folder and then   say the folder name blah blah blah so this is  bad Okay so by the end of this course you oh   you see I’m actually deleting the folder using  uh the UI this is wrong but let me just do it   there we go but at the end of this course you  will familiarize yourself quite a lot with the   terminal so that you have all the required skills  in order to use the terminal and as you’ll see   a bunch of tools such as git Docker kubernetes  all of them you actually have to interact with   them through the CLI or The Terminal cool  this is pretty much it catch me on the next one within my Mac OS what I want to show you is  that I also have a terminal available within Mac   OS so here if I search for terminal so this right  here is the default terminal that comes with Mac   OS so here I can type any command and basically  this will be executed against my operating system   so if I say for example LS in here and you’re  going to learn about LS later but just type   this command press enter and in here this is just  listing all the contents that I have within home   right here so if I type clear for example so  this is another command so this actually clears   the terminal and here I can type for example  PWD in here you’ve seen this one so this is   users and then Amigos code so similarly there’s  also another ter available and this is not part   of the Mac OS operating system but it’s the one  that I use actually on my machine and that is   the iter so in here this is item so yet another  terminal this is way fancier than the other one   you can see the look is actually all black and  it has lots of customizations for example if I   want to split the screen into two for example  I could just do it like that and maybe three   times right here you can see that I’ve got one  two three and in this I can type LS in here I   can type PWD and in here I can type for example  Cal for example and you can see that basically   I’m executing commands in three different shells  and I’m going to talk about shells in a second   but basically you can see that this terminal  right here is way more powerful than the default   that comes with Mac OS so here let me just close  this and yeah so I just wanted to show different   terminals available for Windows what you have  is the command line or simply CMD and it kind   of looks like this and probably you’ve seen  this if you’re on Windows and again this is a   terminal so you can run commands and those will be  executed against your operating system and perform   whatever tasks that you tell it to do and this is  pretty much for this video catch me on the next one also what I’m going to show you is within  text editors and idees there will always be an   integrated terminal so you don’t necessarily  have have to use a terminal that ships with   your operating system or you don’t have to  install a ter for example so here I’ve got   VSS code so visual studio code open and within  Visual Studio code if I click on Terminal and   then here new terminal and in here you see  that I do have the terminal so here I can   type the exact same commands that you saw  so for example if we type who and then am   and then I so just type this command here if you  have Visual Studio code or any other text editor   so in here let me just type who and then um I so  don’t you worry about this uh we’ll cover all of   these commands but for now I’m just showing you  other the terminals so if I press enter you can   see that this gives me a MH code also so I think  so this is one is quite cool so within terminal   I can split the terminal in here so have a look  so the same way that you saw with item which is   quite nice right and here you actually have two  different shells so this is zsh and we’ll cover   uh shells in a second but here I can delete this  delete this as well and it’s gone also one of my   favorite ID is intellig so in here intell has an  integrated terminal if I open this you can see   that we have the terminal in here and I can type  again the same command so who am I press enter   and you can see that this basically gives you the  exact same output awesome so this is pretty much   about terminals if you have any questions drop  me a message otherwise catch me on the next one all right so you know what the terminal is now  let’s focus on understanding exactly what the   shell because often people use these two words  so terminal and shell they’re kind of the same   thing and if you do it that’s fine but it’s  very important that you understand what is   the actual difference between terminal and  shell and that’s what we’re going to focus   in this section and also you’ll see how we’re  going to switch from bash to zsh and you also   see different shells available for the Linux  environment so without further Ado let’s kick off in this section let’s focus on understanding  what the shell is and basically we’ll also   customize the default shell that we have to a  better one but inet shell a shell is a program   for interacting with the operating system right  so you’ve seen that uh we have the terminal in   here and the terminal is just an application  that allows users to input commands to the   shell and receive text based outputs from the  shell operations right now the shell is was   actually taking the commands themselves and then  executing those against the operating system let   me give you a quick demo so in here let me  just open the terminal and the terminal in   here is responsible for taking the inputs right  so the terminal basically allows you to create   uh multiple tabs allows you to expand uh allows  you to here new tab so this is a terminal right   but now whenever I type a command so if I type  for example touch and this is the command that   you’ve seen before so on the slide so touch  and here I’m want to say desktop and then   full bar.txt so if I press enter and don’t worry  too much about this command so you learn how this   works but basically this command in here right  so I’m passing this command through the terminal   so the terminal is responsible for taking the  commands and also outputting the results from   commands executed by the shell so the shell now  is responsible to interact against the operating   system so if I press enter you can see that  we have the file in here full bar.txt right   so the same if I say RM and basically the same  Command right so here let me just go back and   if I say RM right press enter you can see that  the file is gone and again don’t worry too much   about this you learn all of these commands  later but this is pretty much the concept of   terminal and shells now I’ve said shells because  there’s a bunch of different shells that you can   use with Linux you have bash in here so bash for  Born Again shell this is one of the most widely   used shells in the default and is a default  on many Linux distributions we have zsh so   this is the one that we’re going to to switch  to in a second and this is highly customizable   and offers Advanced features like autoc completion  spelling correction and a powerful plug-in system   and then you have fish and many others cool this  is pretty much the gist of shells next let’s go   ahead and understand and customize and change  and basically learn what you need to know about shells cool so you know that the shell is basically  what takes the commands and then basically   execute them and executes them and the terminal  is just the graphical user interface in here so   you saw item you saw the terminal for Mac OS  command line for Windows and the the shell   itself is basically the command line interpreter  right shell or command line interpreter they are   both the exact same thing so what I want to show  you here is how do you view the available shells   that you have installed but also how are we able  to change the current shell so let’s together   type in here so basically if you have Tilda and  then desktop in here or if you don’t have this I   think we did run the CD command before but what  I want to do is so that you have the exact same   screen as mine just type CD yeah so so you’ll  have something like the server name plus the   user in here so my one is just Amigos code at  Amigos code cool at this point let’s together   type we’re going to say cat so you’re going to  learn about the cat command later but here say   for SL and remember tab so I’m going to press  tab have a look so if I go back e and press tab   have a look I just get Auto competetion okay now  type SE e now type shells so sh and then tab so   if I tap tab again you see that we do have Shadow  Shadow Dash and then shells so shells like that   and and in here let me just contrl L and then run  this command all right cool so now have a look so   these are the available shells that we can use  so I think these are the defaults that come with   yonto so if I take this exact same command so CD  so cat Etsy and then shells and run it on my Mac   OS so here the same command but it just looks  a little bit different but it’s going to be the   exact same thing press enter and have a look so we  have bash we have chh Dash KS sh T C CH and then   zsh so I’m going to show you how to use this one  later but if you want to know the current shell   so the current shell that you are using so here  we could just type this command so I’m going to   basically say Echo and then dollar sign and then  shell so basically all caps and um we’ll go over   the echo command as well as dollar sign in here  but for now this is the command I need to run and   it will tell you the current shell that you are  using so in my case I’m using zsh if we take this   exact same command and running within Ubunto so  here Echo and then dollar sign and then shell run   it you can see that the default shell for yuntu  is Bash cool next let’s go ahead and install zsh zsh also called the zshell is an extended  version of Bor shell with plenty of new features   and support for plugins and themes and since  it’s based of the same shell as bash Zs has   many of the same features and switching over it  it’s a Nob brainer so in here you can see that   they say many original features were added  so let’s together in install zsh and as you   saw the default shell for Mac OS now is zsh or  zshell so let’s actually install this as well   in our Ubuntu desktop so in here you saw the  list of available shells so you saw that we   have bash in here which is a default right so  bin and then bash and when you run Echo shell   bin bash is a default so we want to change  this to zsh because it’s an improvement on   top of bash so here what we need to do first is  contrl L to clear the screen and to install zsh   we say pseudo and then AP and then space install  Zs so we’ll come back to AP or apt and this is the   pack manager basically that allows us to install  software okay so here let’s just press enter and   we need to enter the password for Amigo’s code  and in fact your password so here I’m going to   type and you might think that I’m not typing  anything but I’m actually typing so this input   right here doesn’t show the password for security  reasons so press enter and you can see that now   it went off and it’s installing and it’s just  waiting for us to confirm so in here just say Y and just wait for a second you can see that  we have the progress and boom so this is done   now to make sure that this was installed  correctly just type zsh and then Dash Dash   and then version press enter if you have  this output in here it means that you have   installed zsh so if I clear the screen control  l in here and then press the up Arrow a couple   of times and if we list the available shells  under ET C cat now you should see that we have   user bin and then sh right as well as bin dsh  and we’ll cover the difference between bin and   u or actually user or USR later on when  we discuss the Linux file structure cool   this point we just installed zsh but what  about using zsh let’s continue on the next video oky dokie now for us to use zsh what we need  to do is just simply type on the terminal Z red   s and then H press enter and now you can see that  the output is a little bit different and basically   instead of having this colid Amigos code at Amigos  code we just have Amigos code which is just a user   okay and at this point nothing else changes  because as I said zsh is built on top of bash   so all the commands that we execute for example in  here you saw that we run this this command before   LS so this command if I press enter this will work  so the output right here is not call it as before   but I’ll show you what we need to install later  so that we can improve the experience when using   zsh and to be honest this is it now if you want to  switch back to bash just type bash in here and now   we are back to bash and in fact let’s just press Z  SSH once more more and now if I search so here I’m   going to say dollar and then s basically and oh  actually sorry this will not even work because now   we are within a different shell so I was trying  to search for Echo and then shell so let’s just   type and not be lazy so Echo and then dollar sign  and then shell and I was expecting to say zsh but   the reason why is because zsh currently is not  the default one which means that if I open a new   tab in here and you can see that if I make this  smaller actually bigger and here I can type Echo   and then dollar sign and then shell just like that  and you can see that this is Bash in here cool so   let me just close this and you’ve just seen that  if you want to go back to bash you just say bash   in here right but also if I say cat for slash  etc for Slash and then shells press enter we   have all the shells so we have dash sh so let’s  just type sh for example in here so now we’re   going to switch from bash to sh boom you can see  that now this is sh so this is yet another shell   if I want to use for example dash dash this is  a another shell R bash R and then bash there we   go bash and zsh and this is pretty much how you  switch between shells but really what I want to   do is switch my defa shell to zsh and the way to  do it is by using this command in here so CH h s   and then Dash and then s and what we’re going  to do is point to the Shell itself so this one   user bin zsh so say for slash USR not user my bad  USR for slash bin SL Zs press enter let’s add the   password cool now if I show you something if I  open a new shell so contrl shift T have a look   this still Bash and I know because if I typee Echo  so let’s just type Echo and then dollar sign and   then shell and if I put this smaller press enter  you can see that it still says b bash so let me   just come out of this controll and then D and  now let’s just reboot so re and then boot press enter now let me loog in enter and if I open the terminal you can see that the first thing  that we are prompted with is to configure   zsh so in here let me just press control and  then minus so you see everything in here there   we go and you can see that this is the zshell  configuration function for new users you are   seeing this message because you have no zsh  startup files so basically this is the files   that it needs for configuring zsh and it says  you can quit or do nothing exit create in the   file continue to the main menu or populate your  zsh with the configuration recommended so this   is exactly what we’re going to do okay so type  one of the keys in parenthesis so we want two   and there we go so basically this has now created  a file called zshrc and U I’ll show you this in   a second right so from this point onwards we  have successfully installed zsh and now it’s   a default shell so if I clear the screen control  and then Z zero to increase the font and now if I   open a new shell control shift T have a look so  this is no longer bash so here let’s just type   Echo and then dollar sign shell press enter  have a look zsh in our previous one as well   and then type the same command Echo Dash and  then shell and you can see that now now it’s   zsh awesome we have successfully switched  to zsh and we have a better shell from now on cool now let’s switch our default shell  to zsh and the way to do it is by using this   command in here so CH H sh and then Dash and  then s and what we’re going to do is point   to the Shell itself so this one user bin zsh  so say for slash USR not user my bad USR for   slash bin for slash zsh press enter let’s add  the password cool now if I show you something   if I open a new shell so control shift T have  a look this still bash and I know because if   I type Echo so let’s just type Echo and  then dollar sign and then shell and if I   put this smaller press enter you can see  that it still says b bash so let me just   come out of this controll and then D and now  let’s just reboot so re and then boot press enter now let me loog in enter and if I open the terminal you can see that the first thing  that we are prompted with is to configure   zsh so in here let me just press control and  then minus so you see everything in here there   we go and you can see that this is the zshell  configuration function for new users you are   seeing this message because you have no zsh  startup files so basically this is the files   that it needs for configuring zsh and it says  you can quit or do nothing exit creating the   file continue to the main menu or populate your  Zs AG with the configuration recommended so this   is exactly what we’re going to do okay so type  one of the keys in parenthesis so we want two   and there we go so basically this has now created  a file called zshrc and um I’ll show you this in   a second right so from this point onwards we  have successfully installed zsh and now it’s   the default shell so if I clear the screen  control and then zero to increase the font   and now if I open a new shell control shift T  have a look so this is no longer bash so here   let’s just type Echo and then dollar sign shell  press enter have a look zsh in our previous one   as well and then type the same command Echo Dash  and then shell and you can see that now now it’s   zsh awesome we have successfully switched  to zsh and we have a better shell from now on the last thing that I want to do in this  section is to unleash the terminal like never   before with oh my zsh which is a delightful  open- Source Community Driven framework for   managing your zsh configuration it comes bundled  with thousands of helpful function helpers plugins   themes and basically you’ve got all the batteries  included and you can see here on the left you can   customize your theme and make it so powerful and  beautiful and uh yeah just a bunch of things that   will make you look like a professional so if I  scroll down you can read more about it in here   and they’ve got many plugins and you can see  that on GitHub so this is where this is hosted   and in fact if I click on this link in here so  let’s just give you a star I think I have done   it before but if not this is the right time  because it’s awesome so here we can see all   the staggers and let’s give it a star in here so  if you don’t have GitHub don’t worry so there we   go one more star and let’s click on this repo  in here or you can actually click on the code   Tab and here if I scroll down you can see some  description of what it is how to get started the   installation process in here have a look at this  method sh so this is a shell remember you saw sh   and you just pass this command with curl we’ll  look into curl as well and if I scroll down you   can see they talk about how to configure so this  is is zshrc so this is where the configuration   file is and also plugins g.m Mac OS and basically  you can install a bunch of plugins and also themes   they have a section on themes so you can choose a  theme and here I’ll show you this in a second how   to configure zshrc and um it might look like this  if you choose for example I think it’s this theme   in here but you can do a lot with this and also  you can choose a random theme for example which   is nice awesome so let’s install oh my zsh and  I can actually go back to the previous website   and in here they have a section on install oh  mysh now so what we’re going to do is let’s just   take this command and I’m going to copy this go  to yuntu desktop and here I’m logged out let me   just add the password there we go and just paste  the command so control shift and then V and let   me just put this smaller so you see what this  looks like whoops there we go you can see the   entire command in one line if I press enter  so have a look it’s doing few things so it’s   just cloning oh my that issh and basically it’s  just running some script and tada this is now   installed so oh my Zs is now installed before  you scream oh my Zs I actually screamed look   over the zshrc file to select plugins themes and  options also if you look closely so if I press   control 0 in here the so in here have a look so  so now the prompt has changed so you have this   arrow in here and you have Tia so Tia basically  means that you are in the home folder and we’ll   talk about home later but to be honest this is  pretty much it nice if I open up a new tab you   can see that this is already configured and zsh  is installed next let’s look how to configure zsh cool you saw that they said before you scream  oh my zsh look over the zshrc file to select   plugins and themes and other options so in order  for us to achieve this what we have to do is the   following I’m going to clear my screen crl L and  make sure to type CD just to make sure that we   are within the same folder so just type CD there  we go and what this does basically is if I say   for example CD and then desktop press enter so for  example maybe you are inside of a different folder   desktop so if you type CD it just takes you to the  home folder in here and again we’ll come back to   all of this commands in a second so type CD if I  claim my screen contrl l type VI space do zsh R   and then C you can just type tab so here if I type  zsh or Dot zsh and then tab have a look we’ve got   zsh history zsh RC and rc. pm. preo my zsh so  the one I want is our C right and if I click   the screen and then press enter and there we go  so this is the configuration for zsh and here if   we scroll down so just scroll down in here and  you can see that a few things are commented out   and scroll down in here you can see that we have  some stuff plugins so at the moment there’s only   one plug-in which is get but I’ll leave this up  to you to configure this the way you want it you   can explore themes and whatnot and also you can  configure alyses and a bunch of other things but   basically this is pretty much it if I go back to  the giab repository so here remember if I scroll   down I think they have a section on themes have a  look selecting a theme so once you find the theme   that you like you’ll see an environment variable  all caps looking like this right and to use a   different theme just change to agnos for example  so let’s try this and actually I think the themes   are available so I think there’s a link right  so yes in case you did not find a suitable theme   please have a look at the wiki so here if I click  on this link it takes me to external themes and   have a look so this one looks actually quite good  oh even this one wow so you can see that there’s   a oh you can see that there’s oh I’m getting  excited here you can see that there’s a bunch of   themes that you can use and basically just follow  the instructions in here on how to install them   but let’s just go back to the terminal and what  we’re going to do is so here if I scroll all the   way up to the top in here and have a look the zsh  theme is Robbie Russell so what I want to do is   the following so here we need to be really careful  and just follow exactly as I say because this is   VI and we will learn about this text editor so  here type J just type J and make sure that you   select the terminal type J and you can see that  the cursor is moving down so stop right here and   what I want to do is to type on your keyboard  the letter Y twice so y y and followed by the   letter P there we go so this basically duplicates  the line for us now I want you to type the letter   I and you can see that now it says insert and this  means that we can basically type on the text edit   editor itself so I want you to use the app arror  and we’re going to comment this line so here let’s   just comment this with the pound sign and then go  down and here I’m just using the arrow but I’ll   show you a better way later so let’s just remove  so delete anything within double quotes and let’s   use the AG Noster EG Noster and now I want you to  type the scape key on your keyboard and you can   see that insert is no longer here and then type  colon so colon in here W and then Q so write and   quit so this allows us to come out of this editor  in here press enter and that’s it awesome now   what we going to do is open a new tab you can see  that the theme looks slightly different and here   is actually missing some fonts which we have to  install but I’m going to leave this up to you in   terms of how you’re going to customize your IDE so  I’m not spending time on this okay so usually my   one is just black so here let me just close this  and let me go back to VI so I’m going to press the   app eror so here crl L and you can see the command  once more enter and what we’re going to do is the   following so here I’m going to press D and then D  so twice and make sure that the cursor is in this   line so DD twice so that is gone so basically that  deletes the line I’m going to press I for insert   and let’s just get rid of that and esape colon WQ  esape colon WQ I’ll leave instructions on how to   work with Vim but I’ll teach you Vim later on so  here press enter and now if I open a new tab you   can see that we have the default theme cool so  here control 0 to have the default font size crl   L and this is pretty much it I’ll leave some  links under the description of this video so   you can go and explore and Adventure yourself on  how to customize your ID e but if I show you my   one quickly on Mac OS it just looks like this so  it’s plain black and there’s no themes whatsoever   so let me just say uh in here VI and then zsh  zshrc so this is the exact same configuration if   I put this full screen in here have a look so the  exact same thing I didn’t change nothing and you   can add plugins and whatnot so I’ll leave this  up to you cool so here Escape W colon and then   Q this time I didn’t change this file and press  enter this is pretty much it catch me on the next video let us now focus on Linux commands because  moving forward we’re going to learn a bunch of   commands which essentially is what Linux is all  about right so it’s about learning a bunch of   commands that allows us to interact with the  operating system so a Linux command is a text   instruction that tells the operating system  what to do these commands can be entered in   the terminal or command Lin or basically CLI and  by now you should be familiar with the terminal   and um we basically pass those commands and then  an instruction is sent to the operating system   maybe you want to create a file you want to delete  a file you want to check the time or you want to   connect to a remote server so there’s a bunch  of commands that allows us to interact with the   underline operating system the Linux command  the commands themselves are case sensitive so   for example LS and LS in capital these are  two different commands Linux commands are   often various in options and arguments that can  modify their behavior allowing for a wide range   of functionality so in this example in here so  we have the command option and argument so this   is a command so LS is the command then we can  pass an optional argument so this is Dash and   then a and then an argument so here we are saying  dot which means the current directory so here are   some basic commands LS for listing files CD for  changing directories make di for creating a new   directory RM for removing files CP for copying  files and many more each of these commands they   have an instruction via the manual so if you  don’t know how to use a command you can see   the instructions or some guide on how to use  it effectively let’s go ahead and learn about commands in here I do have the terminal open and I  want to give you a quick introduction of commands   so throughout this course you actually seen some  of the commands that I’ve been using for example   LS so you saw that I did the type LS couple of  times on the terminal you also seen M KD iir or   make there you also seen I think it was sleep  so all of these are commands that allows us to   interact with the underlying operating system  so let me quickly just show you the ls command   and then we’ll go over the command itself the  options and the arguments and also on to show   you the list of all available commands as well  as alyses and the manual so the man page so in   here if I type LS you can see that this is a  command and literally just type LS anywhere   so if you are within a different folder or maybe  let’s just make sure that we are within the same   folder together so here type CD so CD this is a  command so press CD and and this will take you to   the home folder okay now we type CD so CD stands  for change directory so this is one command now   change directory means that you change in the  directory where the subsequent commands will be   run from so let’s just type LS so basically the  ls command will be run under this home folder   in here and come back to the tilder and home  folder as well so press enter and you can see   that we have desktop music templates documents  pictures videos downloads and public so these   right here these are folders currently okay but  I know that within this folder so in here if we   type PWD so this is another command and we’ll  come back to this in a second but this stands   for present working directory press enter and it  tells you that I’m under for slome for/ Amigos   code so this is the folder that I’m currently in  so we just typed LS under this folder and we have   these contents in here right now I know for a  fact that there are more stuff under the home   folder okay so this is home okay so home meaning  that if I say Echo so this is another command so   Echo and Echo takes an argument right so here  I want to pass the argument as the home so this   is actually an invironment variable and we’ll  cover environment variables later but this is   the command Echo and this is the argument in  our case for PWD we just executed the command   without no arguments nor options the same with  ls the same with CD so here if I press enter so   this will give me the home location which is  basically for slome and then the user itself   in here cool so LS in here so let me just clear  the screen so contrl L and here if I typ LS you   can see that we have desktop music templates blah  blah blah right now I know for a fact that there’s   more content inside of the home folder so here  let’s type LS and then we’re going to say Dash   and then a so a in here so this is an option  this is an option if I press enter now have   a look so what we have we have more stuff so if  I scroll up in here so we basically typed ls- a   and have a look so these are all the files bash  history we have the cache we have config then   we see so oops let me scroll down here so then we  see the desktop documents downloads as before but   here we are actually including as well as hidden  files so all of these are hidden now what do I   mean by hidden right so if I open files and in  here this is home right have a look under home   I see documents downloads music picture public  templates and videos so this is what I see so in   here let me just put this on this side like so and  then this guy right here and if I put the font a   little bit smaller and then crl L and if I type  LS without the option- a what we see is desktop   music templates so basically everything that you  see in here right but through the terminal if I   say ls- a now we have a bunch of more stuff so in  here what I can do is I can click on these three   lines at the top click on it and here show hidden  files click on it now can you see bash history profile Vim info zshrc so remember this file in  here so these are hidden files right so you saw   that by default it doesn’t come up in here but we  can toggle the hidden files so here this is the   Das a so – a means hidden files now before we move  on to the next video so one thing that I want to   show you also so LS in in here we could say LS and  then so let me just go back here say LS and then   dot so dot means the current directory and this is  actually optional with the ls command because we   are so here if I type again PWD present working  directory we are within Amigos code this folder   this is the home folder which is this one that you  see right so if I time LS and then dot this is the   exact same thing as LS okay so contrl C there let  me just type LS and then Dot and you can see that   is the exact same thing so what we’ve done before  was LS and then Dash and then a and then dot okay   so this is the command itself so LS the option and  this is the argument so here if I press enter you   can see that we get the exact same output now you  might be saying right so here the ls so if I press   the up error so ls- a and then dot so here this  is the argument well we are printing or well we   are listing the contents of the present working  directory which is home but let’s say that within   documents so let’s just go to documents in here  so documents and let’s just right click in here   new folder I’m going to say f in here okay press  enter let’s create another folder and then call   it bar create so now within documents we have  F and bar so we have two directories cool so   here let’s just press contrl + C I’m going to  type LS so you can see that we are able to see   desktop and here documents right so what we can  do is we can say LS and then the argument so we   want to list the contents of the folder called  documents so make sure that this is capital D   so the exact same name here I can press tab to  autocomplete press enter and have a look we see   F and bar so these are two folders that we are  seeing within documents so you can see that this   is the command and this is the argument we could  also say LS in here and if I go back and I can   say Dash and then a space enter and basically  we just see bar and then Fu okay so there’s no   hidden files Within the documents folder so this  is pretty much what a command is obviously there   are plenty of other commands which I’m going to  go through with you in this course but you should   know what a command is what are options and also  what are arguments in here so here there’s just   one argument but some commands might have multiple  arguments and also I actually forgot so remember   I said that commands they are case sensitive so  LS in here so if I type this command basically   command not found so this command is not the same  as LS in lowercase cool now that you know about   commands options and arguments next let me walk  you through the manual pages or simply the man page in this section let’s focus our attention  in Le in the Linux file system which is the   hierarchical structure used to organize and manage  files and directories in a Linux operating system   it follows the tree structure with the root  directory so here you can see this is the   root at the very top and all other directories  are organized below it so here we have bin is a   directory Etc another directory sbin USR VAR dev  then we have have home lib Mount opt proc root   so on and so forth so in this section basically  I want to give you the overview so that we can   start exploring and start using the CD command  PWD on all that good stuff so basically you have   the root in here and then after root you have all  the directories in here so sbin which is used for   essential user commands binaries so here bash gut  CP date Echo LS uh less kill and then basically   all of this commands are used before the USR so  here is mounted because within this USR so here   you can see that there’s also a for slash bin in  here right so these is where you find the programs   right so binaries are programs then you have Etc  so here it’s mainly used to store configuration   files for the system so here you can see fonts  Chown tabs in it and profile uh shells time zone   and whatnot so these are mainly for configuration  files then we have the sbin so sbin is similar to   bin but only for the super user then we have  USR or you can say user so here it’s read only   application support data and binary so you can  see binaries in here for SL include in here lib   right so here basically some code and packages and  also uh you can see some local software which is   stored as well under for SL looc you also have  the for/ share which is static data across all   architectures then we have the VAR so this was  initially uh named as variable because it was   used to store data that change frequently so here  you can see uh youve got cache so application   cache data lib data modified as program runs  lock for lock files to track resources in use   then log files are stored in here variable data  for installed packages and opt es poool tasks   waiting to be processed here you’ve got es poool  and then cron cups and mail and basically here   is where you store temporary data so once the  system reboots then the data is gone you have   Dev in here so this is for device files then we  have for slome so this is the home directory and   we’ll come back to this in a second you have lib  so here for libraries and carel modules Mount so   here Mount files for temporary file systems  such as USB then we have opt for optional   software applications proc for process and kernel  information files for/ root so this is the Home D   for the root user and this is pretty much it now  obviously here I’ve schemed through it and um as   you go through your journey in terms of learning  Linux and um using the command and navigating your   way around and even you know building software  then you start to familiarize yourself with all   all of these folders in here that I’ve just  talked about so this actually is from the   Linux Foundation org I’ll leave a link where  you can basically go and read more in detail   about what each of these folders and subfolders  do but this is pretty much the Linux file system   in a nutshell next let me go ahead and show you  how we can navigate around within the Linux file system all right so in here I’m with in my  terminal and let’s together explore the Linux   file system together so I want you to type this  command in here so CD in here literally just type   CD and then for Slash and then space and then  for slash so this whatever you are just type   CD and then for SL now CD in here means change  directory and basically allows us to change from   one location to another So currently I’m within  the home directory and I want to see I want to   change directory into forth slash so for slash  is the root so press enter now we are within root   if I type PWD it just gives us forth slash which  means root nice if I type LS so list directories   and basically so list the contents within this  directory press enter in here so anytime that   you see something which looks you know something  like bin lib proc serar boot Dev ety Mount up   temp user this is basically the Linux file system  from root so remember I’ve showed you so in here   we have root and then we have ban at C SB user  VAR Dev home lib so if I go back so have a look   bin lib VAR temp user in here so on and so forth  media Mount opt home as well in here have a look   home right so this is pretty much it now what I  want to do with you is so let me just clear the   screen crl L and in here let’s together type this  command we’re going to say PSE sudo and we’ll come   back to P sudo and a also apt we’ll come back to  this in a second and then say install and then   tree so this is basically a way of us installing  extra binaries into our operating system so press   enter Then adding the password and I’m typing  trust me but you can’t see press enter and now   this is installing the tree binary and there we  go so now if I type in here so I just clear the   screen I’m going to type tree or actually let’s  just say which and then tree press enter you can   see that this is under user bin and then tree  okay so it means that we have this binary that   we can use now this binary here so tree so here  I’m going to pass an option so the option will be   Dash and then capital l in here and then I have  to pass an argument into this option and press   enter and literally what this basically gives  me is this nicely formatted LS so basically we   are lising the directories within the root folder  but this is nicely formatted for us so here you   can see we have bin we have boot we have Dev we  have ety we have home lib and also these arrows   in here I’ll come back to them in a second but  in here so temp as well V are so this is pretty   much the Linux file structure from root and you  can see currently there’s 20 directories and   one file so the file is this swap. IMG awesome  next let’s go ahead and learn how to use the CD command all right so in order for us to navigate  around the Linux file system we need to use the   CD command so here let me just put this full  screen and clear the screen crl l so we need to   use the CD and then command so CD and if I press  tab let’s just press tab in here so this now is   giving me the list of all available option right  so here if I want to now move into the directory   called let’s say temp for example so this is where  temporary files are stored I can just say DM press   enter and now you can see that this reflects so  this is all my zsh and it’s telling me that I’m   within the temp folder and now if I press LS  and you can see that there are some files in   here so these are temporary files so if I say  ls- a and um yes so you can also see the dot so   file started with Dot in here and if you want more  information about it ls- and in here you can see   that basically anything that starts with d in here  and I’ll come back to what all of this means in a   second but these are directories in here and these  are files in here okay which means that we can you   know navigate into the snap and then private temp  or system d right so I’m not going to do it this   is p myit now I’m inside of so let me just press  control Z and then clear the screen I’m inside   of temp folder right here so let’s just type  this command and I want to go back to the root   again so how do I do it well I’ve got couple of  options I can say CD and then for slash root or   I can basically go back one folder right so here  if I say CD dot dot so this goes back a folder   so you see from temp it went back to root so if I  type CD TMP in here press enter again I can type   CD for slash so this is actually going directly  to the location instead of going back a folder   press enter and we get the same thing what about  if you want to switch between these two folders   for example right so you don’t want to say CD and  then temp or CD dot dot well you could just say   CD and then Dash and basically this flips between  the previous and the current folder and this goes   back to the previous folder whatever it is within  the file system so if I press enter I go back to   Temp if I press CD and then Dash again I should  go back to root have a look I went back to root   in here cool so I’ll show you more examples of  this in a second and this is pretty much how   you navigate around the Linux file system so  if I type LS once more clear the screen enter   you should see a bunch of folders if you want to  navigate into a particular folder you just say   CD let’s go into bin for example CD and then bin  this and then press enter and now I’m within bin   in here if you want to go for example within  media you don’t necessarily have to go back a   folder you could just say CD for Slash and then  media right so because media is within the root   right here press enter and you can see that now I  went back to Media if I type CD Dash This should   take me back to where think for a second so this  goes back to the previous location which was Bin   press enter you can see that now I’m within bin if  I press up arror and then CD Dash I should go back   to Media enter and you can see that I’m within  media this is pretty much it catch me on the next one all right in this section let’s focus our  attention in terms of working with files and   also in the next section I will show you file  permission in this section let’s focus our   attention in terms of working with files and  later I’ll show you um also directories and   then we’ll learn about permissions so in Linux  in here so you’ve seen that if I open the so   this folder files so in here remember if I click  on these three lines I can basically show hidden   files right how do we create files manually  with Linux so one we have two options so we   could use the UI and we could open so let’s  just open any of these so zshrc and this will   bring the text editor so here what we could do  is we could create a new document and here I   could say hello and then Amigos and then I can  save this I can give the destination so let’s   let’s just save it into documents I’m going  to say hello.txt and there we go close the   file close this let’s navigate to documents  so CD and then documents so you’ve learned   about the CD command LS and you can see that we  have our file in here right so obviously that   is the wrong way of doing that so hopefully  in this section we’ll go through in terms of   how to work with files creating files deleting  them and moving them to a different directory   I’ll show you how to print them as well and also  how to zip any file cool let’s begin in the next video cool in order for us to create a file with  Linux we have this command called touch so this   command allows us to create a file so here let’s  just say buy so buy. txt now obviously here if I   don’t specify the location and just give the  name so this is the name of the file so this   will be saved under the current working directory  which currently is documents right so home and   then documents so if I press enter now let’s type  LS and you can see that we have the file in here   called by. txt so this is how to create files  now obviously this file in here is empty let me   show you so before I actually show you the Linux  command in order for us to print this file if I   open up files in here and then let’s navigate  to documents we have buy. txt let’s open that   up and you can see that it’s absolutely empty so  this is to much how to create an empty file now   obviously it’s not useful because you know most  of the times what we want to do is to create a   file with some content so there are a couple ways  that we can do that and one way is for us to use   the echo command so here I’m going to say Echo  and here we have to pass a string and here I’m   going to say for example by by and then Maria for  example right so this is just a random string now   if I press enter this command just prints back  by Maria now what I can do is I can take this   command and then redirect to the file so here  I can give an existing file name or I can give   it a brand new file so let’s just overwrite the  file that we have which is b.txt so here by. txt   press enter and we get nothing so here we know  that basically if you don’t see anything on the   console and the command just run and executed  you know that it works so let me just clear the   screen crl L LS we have our buy. txt now if we  want to view the contents let’s just again just   open files and here let’s go to documents buy.  txt and sure enough we have buy and then Maria   so this is pretty much how to create a file both  an empty file as well as passing some string or   some output into the file so basically we use use  the echo command in here and then we pass a string   and then we say by. txt or if you want an empty  file you could just say basically so here you can   use the touch command okay so this is touch and  then you can say whatever right so lol and you   don’t even need the extension so here if I say  enter and then LS you can see that we have buy.   txt we have F we have low. txt actually these  are folders so I think we did these before we   created these folders before and um yeah so this  is pretty much it so if I open of files again once   more go to documents you can see that we have  three files in here both with extension and uh   without extension cool there’s another way that  we can create files which is so basically let’s   say that you want to type a couple of things  uh before you actually uh submit the content so   here you see that I’m just saying Echo and then  by Maria I’m redirecting the output from this   command into this file but maybe you want to type  a document or a piece of code right so this is not   feasible and I’ll show you later with Vim how to  do it but for now these are the basics of creating files cool in this section let’s learn how to work  with folders or directories so you saw that we   can basically create files we can delete files  through the terminal using commands and so far   I’ve been creating folders by right clicking and  then new folder and also the same with deleting   folders right click and then basically I think  it’s moved to trash in here right so there’s   better ways of doing it and through the terminal  we can use the mkdir so this right here allows   us to create folders or directories so in here  let’s just CD into and then add documents and let   me put my font a little bit smaller just like  that clear the screen now if I want to create   a folder in here I can say mkd I bar and then  hello bar for example so this now is the name   of my folder press enter and you can see that  we have a folder in here called hello and then   bar if I want to delete a folder which is empty I  can say rmd iir so this actually will remove the   folder only if it’s empty right so here if I press  enter you can see that the folder is no longer in   here if you want to create a folder or basically  nested folders you say mkd I Dash and then P so   Dash p in here and then you can say f for slash  in here and then the bar press enter and in here   actually uh I think we had a folder called Fu  which was here so it didn’t actually create a   new folder but basically inside of Fu now you can  see that we have a new folder called bar so let   me just go back in here and what I’m going to  do is I’m going to run the exact same command   but I’m going to say for example here test and  then bar now you can see that we have a folder   called test and inside of test we have a folder  called bar now if we try to delete so let’s just   say rmdir and then the folder called test in here  press enter you can see that RM failed to remove   test because it’s empty right so rmd just deletes  the folder if it’s empty remember how to delete   the files so we can use the RM command in here so  RM dashr in here and then I’m going to say f to   basically Force delete and accept the prompt so R  for recursive and then here I can say the name of   the folder which is test now this is the key so  if I say in here for Slash and instore right so   pretty much just delete anything under test and if  I open up test you can see that we have bar so if   I press enter here this is still going to prompt  me yes or no so because we have the force here so   let’s just press n for a second so what we want to  do is just add a trailing for slash so this will   basically remove without prompting it’s just going  to remove every single folder and subfolder so if   I press enter you can see that now the folder is  gone and we kept the parent folder in here so if   you want to keep let’s say you want to keep the  parent in here so let’s just again create a new   folder so make the- p test bar let’s also say bar  and then two or three doesn’t really matter and   let’s just have two in here right so here inside  we have three folders if you want to delete them   all all you do is you say rm-rf the name of the  folder for slashstar for slash so here you could   also do a pattern right so let’s just say you  want to delete anything that ends with three for   example so three in here press enter and you can  see that only the folder that ended with three was   gone right so star means pretty much any folder  right so also if for example here so you have   bar so let’s just create a new folder inside of  bar two for example so here I’m going to say FU   press enter now within bar two we have Fu okay  so I’ve just said- P to create subfolders so if   I was to reun the command in here so this will  pretty much just delete all subfolders including   folders within folders right so if I press enter  you can see that it’s gone and we can’t go back   right because the folder doesn’t exist so the  parent which was bar two doesn’t exist so here   let me just say okay and go to documents and test  and you can see that all folders are gone if you   want to delete basically everything including  the parent all you do is so let’s just create   a new folder here so basically bar two inside  with f so this is the command and you want to   delete everything including the parent folder  which is test all you do is mkd and then Dash   oh actually sorry rm-rf so D RF or f r is the  same thing but I’ve just switch the options   and then the name of the folder test then press  enter and you can see that the folder is now gone   and this is pretty much how you create folders  but also delete contents within your folders Linux is a multi-user environment where allows  us to keep users files separate from other users   we can add a new user by using the pseudo and  then user ad- M so this is a flag that allows   you to create the home directory and then you  pass the name we can also set the password for   the particular user by using the pass WD and  then the user in question and if we want to   switch between users we use the Su command I.E  substitute user if you also want to delete the   user you can say user Dell and then here we can  pass some flags and then the user in question   but I’ll show you the flags in question as well  so and with this we have two types of user we   have a normal user that can modify their own  files this user cannot make systemwide changes   install software update system files and also  cannot change other users file so You’ seen the   pseudo command I think throughout this course but  I didn’t cover it but I’ll show you in a second   when we try to install for example a package then  we are not allowed to do that unless we use the   pseudo command and then we have the super user  in here I.E root and this user can modify any   file on the system it can make systemwide changes  such as install software and even change files on   the operating system so in this section let’s  understand basically how all of this works and   then we also touch on files and permissions  which is very important and this is actually   very important that you must understand how it  works because it’s key towards your journey in   terms of becoming a Linux administrator  if you want to follow that path but for   a regular software engineer still crucial for  you to know how this works because it’s key to Linux cool you’ve seen that if I was to type this  command and we’ll learn about package managers   later but here let’s say that we want to install  a piece of software in our machine so basically a   binary so here I think you’ve seen this APK or  I think no it’s apt and then install and here   let’s just say tree so here just say tree and we  did this before but let’s just understand exactly   what we had to do to install this software  if I press enter in here it says could not   open lock file permission denied have a look  permission denied and then it says enable to   acquire the front end log blah blah blah are  you roote well so in order for us to execute   this command successfully we need to execute  this as root I.E with the pseudo command so   the way we do it is we can type in here pseudo  so PSE sudo this is the command that we need to   use and then here I’m going to say exclamation  mark exclamation mark twice and then press Tab   and basically this just adds in the previous  command that I had in my terminal and now if   I press enter now it’s actually asking me for the  password you’ve seen this before so here I’m going   to add the password so it looks like I’m not  typing but trust me it’s hiding the password   for security reasons so just type your password  and then press enter and in fact if I basically   have a wrong password press enter it will say that  the password was incorrect so now I need to type   the password again so here I’m going to type the  correct password press enter and you can see that   basically it tries to install but this is already  installed so this dependency is already installed   as we did before similarly if we try so in here  if I try to navigate to CD and then the root so   for slash LS so in here we have couple of folders  in here but one is root so let’s just try and say   LS and then root for example press enter you  can see that it says LS cannot open directory   root permission denied so if we want to execute  this command on this particular folder we need to   execute the exact same command as root so here  we can say pseudo LS and then root or if I add   exclamation mark exclamation mark twice tab it  just brings in the previous command so this is   a nice trick that I use all the time so if I press  enter now you can see that now we are able to list   the contents inside of the root directory so for  you this might say snap or it might say something   different or maybe nothing right but you can see  that with this command we have super powers now   obviously this here you have to be really careful  how you use this command so remember I said never   do this so sud sudo rm-rf in here and then root  right because if you do this basically you are   getting rid of your entire operating system and  you don’t want to do this so obviously you need   to be careful who you choose to allow to have  the super powers and I’ll will show you this   later in a second but this is the main idea  and basically this is the pseudo command in   NHL pseudo executes a given command with elevated  Privileges and these privileges are required to   perform certain tasks which are required by admins  let’s explore pseudo even further in the next video if you remember correctly when we  do an LS so if we type LS in here so LS   and then Dash a l you can see that we have  some output in here that contains a bunch   of information so in here have a look so we’ve  got that we’ve got this we’ve got all of this   and basically we have some information and  then this is the actual file itself right   so file or directory so in this section we’re  going to focus on understanding the files and   permissions in here and also I’ll explain the  uh output from the ls command so in here if   you remember correctly so if I type in here  ls- Dash and then help and then scroll up in   here so remember the dash so Dash and then l  in here use a long listing format so that’s   why you see all of the information and then  – A as well for Eden file in here so do not   ignore entry that start with DOT right which is  basically all of this right so this dot in here   so the dot files are for the- a and then the  L is for long listing which is for all of this   information in here cool let’s go ahead and uh  start learning about Linux files and permissions next in here I do have this awesome diagram where it  teaches about the output of the command ls- L and   more specific we’ve got the permissions here  which is the core of this section but let me   actually start from here and explain the output  for uh ls- L now in here you can see that we have   the folder name or the file basically the name of  the file that you list within that directory so in   our case we got food. txt as well as di so this  is the name of a folder in here and this could   be literally anything then we have the date and  time and this more specific is the last modified   date and time okay so if you create the file  so that will basically be the creation time and   if you change or modify the file then this will  reflect then we have the size so for a file this   is 4 kilobytes then for a directory this is 4,000  kilobytes and basically the total of whatever is   inside of the folder last section you’ve learned  about groups so this is the group name so to which   group the file belongs to so in this case Amigos  code so both files and then we have the owner so   the owner is the user so in my case Amigos code  earli on you saw that we created a user called   Jamal so this also will reflect then here we have  the number of hard links so two and one and we’ll   come back to hard links later then we have in here  the permissions and the very first character in   here so basically this so excluding D basically I  can’t select it but basically the first character   of this sequence in here it’s always the file  type and then we have the set of permissions   now for the file type in this case d stands for  for directory and then Dash stands for basically   a regular file now when it comes to permissions  this is divided into three sections as I said the   first one is the file type and then and then rwx  rwx r-x in here so basically what this means is   read write and execute R for read W for write and  X for execute the first three characters belongs   to the user so this means that a user can perform  a set of actions on the file type the second set   of characters so the first three for the user  the second three for the group so these are group   permissions and the last three are for everyone  else or others so if it doesn’t belong to the   user nor the group then the rest of of the world  and here’s an example so for example for this file   in here called f.txt so you can see that the file  type in here Dash so it’s a file read W and then   Dash so this means that Amigos code user can only  read and write it cannot execute and we’ll come   back to execute in a second so once we create a  Bash script but also for folders execute Works   a little bit different then the next three set  of characters read write and then Dash so when   it’s a dash it means that there’s no permissions  in there so here Amigos code group so the group   can read and write and then the last three are  dash dash it means that anyone can literally   read so we’ll go into details uh in a second in  terms of the actual permissions but this is the   general overview of the Linux file permissions  and they more specific when you perform ls- L   this is basically the output but as I said in  this section we want to focus on the permissions themselves we’re done with Linux and that’s not  Myer feat you’ve learned about some key commands   and you’re already on your way to becoming  an expert but how do we group those commands   together well that’s where shell scripting  comes in is shell scripting like a programming   language such as python or goang exactly  so you learn about conditions and Loops you   learn about functions how to do effective error  handling and that’s not all we have challenging   exercises waiting for you to put your skills  to the test I’m looking forward for it so am I scripting is where Linux comes in really handy  let’s dive into shell scripting a game changer   for anyone who wants to automate tasks in Linux  first things first what is Bash Bash stands for   Born Again shell a bit of a fun name isn’t it  it’s essentially a command line interpreter   which in simple terms means it’s your gateway  to communicate with your computer using text   based commands with bash you boost efficiency  Skyrocket productivity and can effortlessly   streamline tasks that might otherwise be tedious  think of bash as a way to create a sequence of   commands automating tasks and Performing complex  operations without breaking a sweat now how do   you write these magical scripts all you need to  start is an editor it could be as simple as Vim   which we’ve covered in this course or a feature  editor like Visual Studio code your choice once   you’ve penned down your script save it with  the extension Dosh which tells your system   hey this is a bash script now let’s explore  some fundamental elements of bash scripting   as we talk remember the true understanding  comes from practical application which we’ll   delve into shortly first up variables think of  them as containers they store and manipulate   data for you typically denoted by something like  dollar Vore name variables can hold a variety of   data be it strings numbers or even arrays  moving on to conditionals they are scripts   decision makers allowing it to make choices  based on specific conditions based on whether   something is true or false different blocks of  code will run making your scripts Dynamic and   responsive next up loops loops let you repeat  instructions over and over as needed with for   loops and while Loops you can iterate over  lists sift through directories or continue   a task until a specific condition is met last  but not least functions imagine grouping a set   of commands into one block you can call upon this  block or function multiple times throughout your   script they’re the essence of code reusability  modularity and organization in your script which   is a very key component when it comes to script  writing and there you have it an introduction to   Shell scripting with bash while this is just the  tip of the iceberg armed with these fundamentals   you’re well in your way to master the art of  scripting Linux so without further Ado let’s get started let’s write a simple script to get  a taste of B scripting in this example we’ll   create a simple script to greet the user first  let’s create our script we can use the touch   command followed by the name of our script let’s  call it my first script and make sure you use the   extension Dosh which indicates that these are  bad scripts let’s now open our file using Vim   my first script.sh now the first line of every  file starts with a shebang line don’t worry too   much about this line at the moment we’ll cover  this in a future video now we Echo hello world   in our script and then we can escape and then  we can save our file using coal WQ exclamation   mark now because scripts are executables we  have to also CH mod our script using CH mod   and we can use the symbolic notation plus X  followed by the script name my first script   and now we can run our script using the dot for/  prefix and my first script and there you have it   H world now this is just a basic example but  B scripting allows you to do so much more you   can manipulate files process data automate  backups and perform complex operations all   through the power of scripting so to become  proficient in B scripting it’s essential to   understand the fundamental concepts that form  the building blocks of scripting let’s briefly   cover some of these Concepts and that’s  all for this video I’ll see you in the next one in this video we’ll delve into an important  concept called shibang the shebang also known as a   hashbang or interpreted directive plays a crucial  role in the execution of bash scripts so let’s   first create a file we can just touch greet Dosh  for example and then press enter now we briefly   touched upon shebang line in the previous video  and that’s the first line that you find in any   bash script where you have followed by bin bash  this line is a she and it serves as a directive   to the operating system on how to interpret the  script in this case we’re asking the system to   interpret the script using the binary bash so the  path after the exclamation mark is essentially   pointing to the specific interpreter or shell that  should handle the script the shebang line provides   flexibility by allowing you to specify different  interpreters or different types of scripts for   example if you’re writing a python script you can  use a shebang line that instead has user being   Python and then you can decide if you want Python  3 or python 2 to ensure the script is executed   using the python interpreter and similar for  scripts written in Ruby for example you’ll just   change this binary to Ruby and so on now let’s  see the impact of the shebang connection suppose   in this bad script we want to print hello world  for example we want to write a greeting message   so first let’s write our she bang with bin bash  and then we do Echo hello world and then we escape   and then colon WQ to save this now remember B  scripts are executables which means we need to   give it the executable permission so to do this  we use a CH mode command followed by the symbolic   notation to give it executable permission so we do  plus X followed by the name of the file so greet   Dosh and then we press enter now this file is an  executable so we can check that this is the case   by running LS followed by the long form option  and as as you can see our greet Dosh file now has   executable permissions which is the X here okay  let’s clear our screen now to run this we can use   a for/ prefix followed by the script name and then  we press enter and as you can see it prints hello   world now this is only one way to run this bash  script we can also use the command sh to run the   bash script so greet Dosh and that gives you the  same thing and we can also use Bash read.sh and   we press enter this is for when you don’t specify  The Interpreter within the bash script so if we   remove our bin bash line or or a shebang line in  the bash script we can use these two commands to   interpret this script as bash great now the She  Bang is not limited to just the bash shell you   can use different interpreters depending on your  needs and by specifying the correct interpreter   in the shebang you ensure that your scripts are  executed consistently regardless of which sh or   environment they’re running so a quick summary the  shebang line starts with the hash followed by an   exclamation mark it specifies The Interpreter or  shell that should handle the script it enables   consistent execution of scripts across different  environments regardless of whatever shell you’re   using even though we’re using the zsh Shell here  it was still able to interpret the GRE Dosh file   as a bash script you can specify different  interpreters for different types of scripts   and the she bang line should be placed as the  first line of the script without any leading   spaces or characters before it and that’s it  thanks for watching and I’ll see you in the next one in a previous video we learned how to run  scripts using slsh and Bash so let’s recall our   simple script greet Dosh so if I do a cat greet  Dosh we can see that this script prints hello   world right now we can run it from its current  directory using for/ greet Dosh but what if we   want to run it from anywhere without specifying  its path well the trick is to place our script   in one of the directories that’s in our path  environment variable the path is an environment   variable that tells the shell which directories  to search for executable files in response to   commands so let’s clear our screen and if I do an  echo of the path environment variable we can see   that there are several directories separated  by colons any executable file placed in one   of these directories can be run from anywhere in  the terminal now a common directory to place user   scripts is user local bin that’s this directory  over here so let’s move our greet Dosh file into   this directory and give it executable permissions  now for this we are going to use pseudo because it   requires super user permissions to move scripts  into this directory so we run PSE sudo and then   move and then our script greet Dosh and we’re  going to move this to user local bin and we’re   also going to change the name to greet so it  becomes easy to run later on so now we can press   enter it will ask you for your password so enter  your password so that’s moved greet Dosh into the   user local bin directory now remember you also  have to CH mod since this is a script so once   again pseudo CH mod with the plus X symbolic  notation followed by user local bin and then   greet so we press enter now the reason we changed  the name to greet is so that for Simplicity this   is how we will call it now let’s clear our screen  now if I has to run the command greet just like   this it will give me hello world without using sh  without using the current directory and if I was   to also change it directory and call greet it will  still work so if I change directory to let’s say   desktop for example I can also run it from here as  GRE so you can see we were able to run our script   using just its name without needing to specify  any path or use for/ sh or bash so to recap by   adding our script to one of the directories in  a path environment variable we can conveniently   run it from anywhere in our terminal this can be  incredibly useful as you build up a library of   custom script just be cautious though and ensure  the scripts you add to Global paths are safe and   intended for Global use and that’s all for this  video Happy scripting and I’ll see you in the next one in this video we’ll explore the concept of  comments and how they can enhance the clarity   and understandability of your script comments  are lines in a script that are not executed as   part of the code instead they serve as informative  text for for us reading the script adding comments   to your scripts is considered a best practice  because it helps you and others understand the   purpose functionality and logic of the script so  let’s take a look at how comments are Written In A   bash script in bash there’s two types of comments  you have a single line comment and a multi-line   comment so let’s first go into our greet Dosh  file VM greet Dosh and then press enter now we   know what the script does it prints hello world  to the console when we run the script so first we   can press I to insert and to write a single line  comment simply start the line with the hash symbol   anything following the hash symbol on that line  will be treated as a comment so print greeting   to the console for muline comments you can enclose  the comment text between colon with single quotes   and then we can have our comments within the lines  enclosed between the single quotation marks so   anything between 6 and 9 will now be considered  a comment this is a multi-line comment and we can   just get rid of this line as well so Escape great  now if I was to exit and save this file and rerun   GRE Dosh you’ll notice that it only prints hello  world even though that in our GRE Dosh file we   have these two lines but because they are being  taken as comments they are therefore not executed   now let’s see the Practical benefits of comments  in action consider a bash script that renames all   txt files in a directory to have a Bak extension  so what we do here is VI extensions. sh file and   then press enter and here we have a for Loop  without comments the script may appear cryptic   especially for someone unfamiliar with the purpose  and inner workings of this for Loop especially for   someone who’s new to B scripting who doesn’t  really know how to write for Loops so in our   case it’s very important for us to write comments  here to improve the understandability so we start   with our hash and then we add our comment so what  we’re doing in this for Loop is renaming all txt   files Tob so we’re changing the extension of the  file now we can use multi line comments to add   more detail as to what the script is doing so to  do this we start with a colon and then the single   quotation mark and also close this with a single  quotation mark So now anything inclosed between   these two quotation marks would be considered  a comment so we can write explanation and then   what we’re doing is looping through all. txt  files in the current directory we are using   the move command as you can see move command to  rename each. txt file to do B and finally the   this part of the code is the syntax so the and  then we can paste that here is the syntax that   removes the txt extension and the pens B okay  let’s save the script WQ and exit let’s just   now cut this file and let’s zoom out a little  bit now notice by adding comments throughout   the script we can provide explanations and context  as to what the script is actually doing making it   easier for others and ourselves to understand the  script’s intention so comments not only help with   the script comprehension but also enable you to  temporarily disable or exclude specific sections   of code without deleting them let’s say we did  want the script to run these three lines or we   we can actually prevent those lines from running  by turning them into comments so let’s go back   into our file and what we do is let’s first do an  i and then add a hash in front of this so now it   turns into a comment and same for the remaining  two lines now you can see this script essentially   won’t run anything because now we’ve turned all  our commands into comments we can exit and we can   save this if we tried running the script we do  for/ extension. sh oops wrong file okay we get   permission denied because it’s not executable so  let’s make it executable sh and then rerun as you   can see nothing happens because all our commands  have now been commented okay and that’s all you   need to know about comments and how useful they  are within our scripts so by adding comments to   your scripts you improve the readability you  can you know Foster collaboration within your   team and you can ensure that the scripts purpose  remains evident throughout the life cycle of the   script so other people can read what the script  is doing and so later if changes need to be made   you know where those changes need to happen okay  thanks for watching and I’ll see you in the next one in this video we’ll delve into the world of  variables variables are an essential component   of bash scripting as they allow you to store and  manipulate data it makes your script Dynamic and   flexible in bash variables are like containers  that hold data such as text strings numbers or   even arrays they provide a way to store values  that can be accessed and modified throughout the   script so let’s look at how variables are created  and used in bash script to create a variable you   simply assign a value to it using the assignment  operator so let’s first create a file and call   this file. SH now first in this file let’s begin  with our shebang b bash and then let’s also assign   a variable called greeting and we can assign it  to the string hello world to access the value of   this variable you prepend the variable name with a  dollar sign so we start with dollar greeting let’s   say we want to use the echo command to Output  the value stored in greeting we just start with   Echo followed by Dollar greeting and then we can  escape and save our file make sure you CH mod your   script to give it executable permission v.sh and  then the/ prefix to run the script and there you   have it hello world now variables in bash are not  constrained to a specific data type they can hold   different types of data such as strings numbers  and arrays let’s create a variable that we can   assign a number so let’s reopen our v.sh and let’s  assign another variable I use all my keyboard to   go to the next line and we can assign the count  variable to the number 42 for example so as you   can see I’m not enclosing the number 42 within a  string because I want this bad script to interpret   this as a number and not a string right and then  we can call this variable using the same format   Echo count then let’s exit save our file and run  our bash script v.sh and there you have it it   prints the number 42 as well as our hello world  now variables can also hold an array so let’s   create another variable called fruits and assign  it to the values apple banana and orange so we do   that using parentheses first element will be apple  second element banana and the third element orange   and then you close your parenthesis and there you  have it the fruits variable assigned to this array   now you can also use variables within strings to  create Dynamic output this is known as variable   interpolation let’s see how we can do that let’s  assign a variable name to the name let’s say armid   for example we can now Echo and then within our  string we can use variable interpolation to say   hello to this variable name and Let’s Escape and  WQ to save and let’s call a.sh and there you have   it hello armid so it’s taken the name variable and  assigned it with within our string so essentially   we’re doing variable interpolation in this case  so the value stored in name is inserted into   the string using the dollar name syntax great  let’s summarize what we’ve learned variables   are created using the assignment operator  equals to access the value of a variable   we prend the name of the variable with a dollar  sign variables can hold different types of data   such as strings numbers and arrays and variable  interpolation allows you to use variables within   strings to create Dynamic output and that’s  all for variables I’ll see you in the next one in this video we’ll dive into the topic of  passing parameters to bash scripts by allowing   inputs from the command line you can make  your script more versatile and interactive   bash scripts can receive input values known  as parameters or arguments from the command   line when they are executed these parameters  allow you to customize the behavior of your   script and make it more flexible let’s look  at how to pass parameters to a b script when   running a script you provide parameters after  the script name so for example let’s say we   had a script.sh file we pass parameters just  like this parameter 1 parameter 2 and so on so   when running a script you provide the parameters  after the script name separated by spaces so the   parameters are all separated by spaces so in  this example we’re executing a script called   script.sh and passing two parameters parameter  1 and parameter 2 inside the B script you can   access these parameters using special variables  dollar one doll two and dollar three let’s look   at an example let’s create the script.sh file and  let’s start with our Shang bin bash and let’s say   we wanted to echo three parameters let’s say  the first parameter parameter one and we use   use a special variable so dollar one which  basically grabs the value of the parameter   passed into the script when we run the script  let’s say we have these lines three more times   so let’s just copy this line here copy and then  paste let’s say now parameter two we have two   and then for parameter three we have three so in  this script snippet we’re using the echo command   to display the value of these three parameters so  Let’s Escape and save this file now when I call   the script.sh I can pass in a parameter so let’s  say the first parameter let’s call it hello and   second parameter hi then press enter as you can  see because we’ve only passed in two parameters   it only prints the first two hello and hi because  this is taken as dollar one and this is taken as   dollar two if I was to pass in a third parameter  let’s call it hey and press enter now we have a   third parameter and it is printed in this third  line excellent so when executing the script with   parameters the values passed on the command line  will be substituted into the scripts parameter   variables dollar one doll two and doll 3 now what  if we wanted to access all the parameters passed   into a script we can do this using a special  variable so let’s go into our script.sh let’s   add another line and let’s say we want to Echo  all parameters right we use a special variable   followed by the at symbol and then quotation  marks and then now let’s save the script and   now when we run it we get all parameters and then  the parameters that we’ve passed into the script   in other words the echo command in that line  will output all the parameters passed to the   script great let’s summarize what we’ve learned  parameters are provided after the script name when   executing a script inside the script parameters  can be accessed using dollar one do two doll three   and so on based on their position and the special  variable dollar at can be used to access all the   parameters pass to the script so by allowing  inputs through parameters you can make your   script more interactive and versatile great that’s  all for this video and I’ll see you in the next one phew well done for reaching  the end of this course but your   journey doesn’t stop here whether  you’re taking the devil’s path or   the software engineering path well it’s  only the beginning we have courses to   help you on this journey it was a pleasure  teaching you and we’ll see you in the next one Assalamualaikum

By Amjad Izhar
Contact: amjad.izhar@gmail.com
https://amjadizhar.blog


Discover more from Amjad Izhar Blog

Subscribe to get the latest posts sent to your email.

Comments

Leave a comment