Day-6 | Linux & Shell Scripting | Complete Shell Scripting Playlist| #aws #azure | #devops
摘要
TLDRDans cette vidéo, Abhishek présente les bases du système d'exploitation Linux et du shell scripting dans le cadre d'un cours DevOps gratuit. Il explique le rôle d'un système d'exploitation comme intermédiaire entre le matériel et les logiciels, et pourquoi Linux est largement utilisé dans les environnements de production. Il aborde l'architecture de Linux, y compris le noyau et les bibliothèques système, et introduit des commandes de base du shell pour naviguer dans le système de fichiers, créer et modifier des fichiers, et vérifier l'utilisation des ressources système. La vidéo se termine par une invitation à explorer davantage les commandes shell et à se préparer pour un projet DevOps en temps réel.
心得
- 💻 Comprendre le rôle d'un système d'exploitation.
- 🔑 Linux est un système d'exploitation open source.
- ⚙️ Le noyau est le cœur de Linux.
- 📂 Utiliser des commandes shell pour naviguer dans le système de fichiers.
- ✍️ Créer et modifier des fichiers avec des commandes shell.
- 📊 Vérifier l'utilisation des ressources système avec des commandes.
- 🚀 Linux est préféré pour sa rapidité et sa sécurité.
- 📚 Explorer les commandes shell pour une meilleure gestion des systèmes.
- 🔄 Les commandes sont communes à différentes distributions Linux.
- 🎓 Se préparer pour un projet DevOps en temps réel.
时间轴
- 00:00:00 - 00:05:00
Introduction à la vidéo sur le système d'exploitation Linux et les bases du shell scripting, avec une recommandation de visionner les vidéos précédentes sur le cours DevOps.
- 00:05:00 - 00:10:00
Définition d'un système d'exploitation comme un pont entre le matériel et les logiciels, illustrée par l'exemple d'un ordinateur portable ou d'un serveur.
- 00:10:00 - 00:15:00
Importance de Linux en tant que système d'exploitation populaire, en raison de sa gratuité, de sa sécurité et de sa rapidité par rapport à Windows.
- 00:15:00 - 00:20:00
Présentation de l'architecture de Linux, en mettant l'accent sur le noyau, les bibliothèques système et les processus utilisateurs, sans entrer dans des détails complexes.
- 00:20:00 - 00:25:00
Résumé des concepts clés de l'architecture Linux, y compris la gestion des périphériques, de la mémoire et des processus par le noyau.
- 00:25:00 - 00:30:00
Introduction au shell scripting comme moyen de communication avec le système d'exploitation Linux, en soulignant l'importance des commandes shell dans un environnement sans interface graphique.
- 00:30:00 - 00:37:44
Démonstration de commandes de base du shell, y compris la navigation dans les répertoires, la création et la gestion de fichiers, ainsi que des commandes pour surveiller les performances du système.
思维导图
视频问答
Qu'est-ce qu'un système d'exploitation ?
Un système d'exploitation est un logiciel qui agit comme un pont entre le matériel et les logiciels, permettant la communication entre eux.
Pourquoi Linux est-il populaire ?
Linux est populaire car il est gratuit, sécurisé et rapide, ce qui en fait un choix privilégié pour les systèmes de production.
Quels sont les composants principaux de Linux ?
Les composants principaux de Linux incluent le noyau, les bibliothèques système, les compilateurs et les processus utilisateurs.
Comment créer un fichier dans Linux ?
Pour créer un fichier dans Linux, vous pouvez utiliser la commande 'touch nom_du_fichier'.
Comment naviguer dans les répertoires sous Linux ?
Utilisez la commande 'cd' pour changer de répertoire et 'pwd' pour afficher le répertoire de travail actuel.
Quelles commandes sont utilisées pour vérifier l'utilisation des ressources système ?
Utilisez 'free' pour la mémoire, 'nproc' pour le nombre de CPU, et 'df' pour l'espace disque.
Comment modifier un fichier dans Linux ?
Utilisez la commande 'vi nom_du_fichier' pour ouvrir un fichier dans l'éditeur vi et y apporter des modifications.
Qu'est-ce que le shell scripting ?
Le shell scripting est un moyen d'interagir avec le système d'exploitation via des commandes en ligne de commande.
Pourquoi utiliser des commandes shell au lieu d'une interface graphique ?
Les serveurs de production n'ont souvent pas d'interface graphique, donc les commandes shell sont nécessaires pour gérer le système.
Quels sont les avantages de Linux par rapport à Windows ?
Linux est open source, généralement plus sécurisé, et souvent plus performant pour les applications serveur.
查看更多视频摘要
- 00:00:01hello everyone my name is Abhishek and
- 00:00:05welcome back to my channel so today
- 00:00:07we'll be talking about Linux operating
- 00:00:09system and basics of shell scripting
- 00:00:11so if you haven't watched our previous
- 00:00:13videos on devops so just to let you know
- 00:00:17that we are doing a complete free devops
- 00:00:20course it will be a fortify uh to 40 to
- 00:00:2345 days of devops course where we'll be
- 00:00:25talking about most of the devops things
- 00:00:28and our aim with this devops course is
- 00:00:30to make a person with zero devops
- 00:00:33knowledge heroin devops
- 00:00:34so if you haven't watched those videos
- 00:00:36uh there is a playlist on my channel
- 00:00:38called devops Zero to Hero uh I would
- 00:00:39highly recommend you to watch the
- 00:00:41previous videos before jumping on to
- 00:00:42this video
- 00:00:44perfect so if you move to the agenda for
- 00:00:46the day that is Linux operating system
- 00:00:47and the basics of shell scripting
- 00:00:49firstly
- 00:00:52what is a operating system right before
- 00:00:54you understand the concept of Linux
- 00:00:55operating system you should know the
- 00:00:57basics of operating system or what is an
- 00:01:00operating system
- 00:01:01so just try to understand with a
- 00:01:05practical example let's say you have a
- 00:01:07laptop or you purchased a Raspberry Pi
- 00:01:10or any other server okay so what are the
- 00:01:12key components of any uh server right
- 00:01:14the key components is that you are
- 00:01:17purchasing Hardware
- 00:01:18I understand you get a lot of fancy
- 00:01:24things like your display you get uh
- 00:01:26other things mouse keyboard and all the
- 00:01:28other things that you are purchasing but
- 00:01:30essentially you are purchasing Hardware
- 00:01:33that is nothing but your
- 00:01:35CPU
- 00:01:37Ram
- 00:01:40and IO right or hard disk
- 00:01:42so you are purchasing these things and
- 00:01:44what you do once you purchase the
- 00:01:46hardware is you try to use some
- 00:01:48softwares on top of your on top of your
- 00:01:50Hardware okay let's say you purchase the
- 00:01:52laptop what would be your interest your
- 00:01:54interest is to
- 00:01:56you make use of
- 00:01:58some softwares whether you are using
- 00:02:00this for gaming
- 00:02:02okay or let's say you are a devops
- 00:02:04engineer so you must be using some
- 00:02:07applications like Jenkins
- 00:02:10or you must be using some office related
- 00:02:12stuff or as a student you must uh you
- 00:02:14might want to uh learn something like
- 00:02:17Java or python so you are essentially
- 00:02:19running some softwares right this is
- 00:02:21what you are doing so you have a
- 00:02:24software application that you want to
- 00:02:25run against the hardware that you
- 00:02:28purchased okay
- 00:02:30but you can directly do it okay let's
- 00:02:33say as a user you install Jenkins and
- 00:02:34you want to execute your Jenkins
- 00:02:37pipeline your Jenkins can directly not I
- 00:02:39mean it cannot directly talk to you the
- 00:02:42CPU or Ram or the io
- 00:02:44there has to be a medium between your
- 00:02:45software and Hardware that is nothing
- 00:02:48but your operating system
- 00:02:50okay so what is the operating system
- 00:02:53operating system is something that acts
- 00:02:55as a bridge between your software and
- 00:02:58Hardware so it drives as a medium for
- 00:02:59the communication between your software
- 00:03:02and Hardware that is the definition of
- 00:03:06your operating system okay
- 00:03:06so whether it is a Linux operating
- 00:03:10system whether it is a Windows operating
- 00:03:11system or anything
- 00:03:13so today when you purchase your laptop
- 00:03:15let's say you purchase the Dell laptop
- 00:03:17okay
- 00:03:20so what Del does is it sells you the
- 00:03:23hardware okay and on top of the hardware
- 00:03:26what is it doing it is installing a
- 00:03:28operating system and it is giving it to
- 00:03:30you so
- 00:03:32you purchase the Dell laptop which comes
- 00:03:36with the CPU Ram IO and along with that
- 00:03:38what Dell is doing is it is installing
- 00:03:41Windows operating system
- 00:03:44okay so that is the reason why you are
- 00:03:47able to directly deploy any application
- 00:03:49or install any application and your
- 00:03:52application is able to process the
- 00:03:53requests that are coming from the user
- 00:03:56that is you
- 00:03:57so as a user what you are trying to do
- 00:04:02is you are installing an application and
- 00:04:04your application is talking to the
- 00:04:06operating system and your operating
- 00:04:08system is talking to your hardware and
- 00:04:10vice versa right your Hardware is again
- 00:04:12talking to your operating system your
- 00:04:13operating system gives back the
- 00:04:14information to the application and your
- 00:04:16application gives back the information
- 00:04:17to you
- 00:04:19so this is the process so the
- 00:04:21communication happens in this way
- 00:04:23firstly as a user you are installing
- 00:04:26some application on your laptop and your
- 00:04:28laptop or your server okay just for your
- 00:04:31easy understanding I'm mentioning it as
- 00:04:33a laptop but always understand it as a
- 00:04:35server so as a user you installed
- 00:04:36application or software on your server
- 00:04:40and your server is giving the response
- 00:04:42or sorry uh giving the request to your
- 00:04:44operating system and your operating
- 00:04:46system is sending the request to your
- 00:04:49hardware for CPU usage or RAM usage or
- 00:04:51anything again your operating system is
- 00:04:53giving the response back to your sorry
- 00:04:55your Hardware is giving the response
- 00:04:57back to your operating system from
- 00:04:58operating system it goes to your
- 00:05:00software or your application and finally
- 00:05:03it reaches the user so this is the life
- 00:05:04cycle
- 00:05:06and this is where your operating system
- 00:05:07plays the key role you must have your
- 00:05:09applications ready you must have your
- 00:05:11Hardware ready but without operating
- 00:05:13system nothing happens so that's why
- 00:05:15it's a core earlier it's a heart of
- 00:05:17everything
- 00:05:19again depending upon your comfort
- 00:05:21whether you're using a apple like let's
- 00:05:23put let's say that you purchased a Apple
- 00:05:25laptop or your Mac laptop so it comes
- 00:05:27with your Mac operating system if you
- 00:05:29purchase Dell laptop by default most of
- 00:05:31the times it comes with a Windows
- 00:05:33operating system uh you are purchasing
- 00:05:35ThinkPad or something the Linux version
- 00:05:37of it so it comes with a Linux operating
- 00:05:39system so depending upon the user or
- 00:05:41depending upon the vendor they come with
- 00:05:44your own operating systems but why Linux
- 00:05:46is very popular
- 00:05:49but uh if you just think for a minute as
- 00:05:51a student or as a kid most of the times
- 00:05:53you are familiar with Windows operating
- 00:05:55system but once you move to your
- 00:05:58software Journey you see that Linux is
- 00:06:00used everywhere whether uh in your
- 00:06:02production system staging developer
- 00:06:05environments everything is deployed all
- 00:06:06the applications are deployed and tested
- 00:06:08on your Linux operating system I agree
- 00:06:11that there are windows as well like but
- 00:06:1590 to 80 of the times you test on Linux
- 00:06:17operating system and you also Deploy on
- 00:06:19Linux operating system
- 00:06:21let's try to understand why
- 00:06:23okay
- 00:06:27so there are very good reasons why Linux
- 00:06:29is very popular firstly first and
- 00:06:32foremost reason is Linux is a free
- 00:06:35operating system okay unlike Windows
- 00:06:36Windows is a proprietary operating
- 00:06:39system you must know that uh it's
- 00:06:40appropriating appropriate operating
- 00:06:42system provided by Windows right sorry
- 00:06:46Microsoft whereas Linux is a freeware or
- 00:06:48it's a open source software
- 00:06:53so today uh anybody can create Unix like
- 00:06:54operating systems that is Linux like
- 00:06:56operating systems
- 00:06:59and again uh one of the key reasons is
- 00:07:03Linux is very secure
- 00:07:04for example you uh have a Linux laptop
- 00:07:09and you have a Windows laptop you don't
- 00:07:11even have to install any kind of
- 00:07:12antiviruses
- 00:07:15for on your Windows laptop you must have
- 00:07:18installed my cafe or any other things
- 00:07:18like
- 00:07:21antivirus softwares right anti-malware
- 00:07:24softwares but whereas you win Linux you
- 00:07:26don't have to install any kind of
- 00:07:28antivirus It Is by default very very
- 00:07:30secure I'm not saying that it is 100
- 00:07:32secure but most of the times your Linux
- 00:07:35operating system is a secure software
- 00:07:38and it contain a lot of distributions
- 00:07:41like you know uh today you have uh many
- 00:07:43distributions like uh Centos you have
- 00:07:46distributions like Ubuntu you have
- 00:07:48distributions like uh red hat and lot of
- 00:07:50other things right but if you talk about
- 00:07:52the free distributions you have popular
- 00:07:54ones like Ubuntu sentos uh people also
- 00:07:57use Alpine Debian so different kinds of
- 00:07:58distributions are provided so you can
- 00:08:00depending upon your comfort you can use
- 00:08:04any uh distributions and finally one of
- 00:08:05the most important things for any
- 00:08:08application to run on your production
- 00:08:11systems is it has to be very fast
- 00:08:14if your operating system is slow because
- 00:08:16your operating system is hard of
- 00:08:18everything like whenever a user is
- 00:08:21trying to send a request let's say you
- 00:08:23are trying to access amazon.com you are
- 00:08:25trying to access Netflix so if your
- 00:08:27operating system itself is very slow
- 00:08:30then it doesn't matter right whether
- 00:08:31your application you might have used
- 00:08:34Advanced concept like multi-threading or
- 00:08:35any other things in your application but
- 00:08:37if your operating system is not capable
- 00:08:41of taking this requests then it's of no
- 00:08:43use so that's why people always prefer
- 00:08:45fast running operating systems or the
- 00:08:48operating systems which are not crashed
- 00:08:49or which are not slow in their
- 00:08:51production systems that's one of the key
- 00:08:54reasons why Linux is used as a operating
- 00:08:57system in production systems so it is
- 00:08:59very fast it is very secure and it is
- 00:09:01also free in nature so what are the
- 00:09:03things that you want right when
- 00:09:05something comes for free when something
- 00:09:07is very secure and fast then
- 00:09:10that's a bliss right that's a blessing
- 00:09:12so that's why people use Linux operating
- 00:09:14system over windows
- 00:09:18okay so if somebody asks you what is the
- 00:09:21difference between Linux and windows so
- 00:09:23this is something that you answer or why
- 00:09:25Linux is used Linux is most widely used
- 00:09:27when compared to other operating system
- 00:09:30these are some of the reasons
- 00:09:33now let's try to take a couple of
- 00:09:35minutes to understand the architecture
- 00:09:38of it okay so I'll not bore you or I'll
- 00:09:41not go into the details of the Linux
- 00:09:44Operator Operator architecture because
- 00:09:48it's very complicated and it's not even
- 00:09:51for me to explain the entire Linux
- 00:09:54operating system even if I take one two
- 00:09:56hours it's not easy to understand or
- 00:09:58easy to explain so that's why what I'll
- 00:10:00do is I'll try to keep it as crisp as
- 00:10:02possible or as simple as possible
- 00:10:04so let's say
- 00:10:08let's try to break break it down to make
- 00:10:09it easy okay
- 00:10:11so let's say this is your operating
- 00:10:12system
- 00:10:14OS
- 00:10:15so firstly the heart of your Linux
- 00:10:21operating system is your kernel
- 00:10:24okay and on top of your kernel you have
- 00:10:26something called as your system
- 00:10:29libraries
- 00:10:29don't worry I'll explain them in detail
- 00:10:35and on top of it you have some of the
- 00:10:42things like you have your compilers
- 00:10:43you have your uh user processes
- 00:10:49and you have some
- 00:10:53system related softwares
- 00:10:57even for your windows you have some
- 00:11:01system related softwares right so
- 00:11:03similarly even for Linux you have some
- 00:11:06system related software so whenever you
- 00:11:08are installing Linux let's say you
- 00:11:09install Linux on your laptop so these
- 00:11:11are the things that you are installing
- 00:11:13okay so because these are the
- 00:11:16fundamentals of your operating system
- 00:11:18so firstly you need to understand what
- 00:11:21is a kernel so kernel is heart of your
- 00:11:24Linux operating system why because the
- 00:11:27responsibility of Kernel is to establish
- 00:11:29a communication between your
- 00:11:32hardware and your software like I
- 00:11:34mentioned so there is a user
- 00:11:37okay the user is installing an
- 00:11:38application
- 00:11:41which is a software and then there is a
- 00:11:44hardware that is nothing but your CPU
- 00:11:47Ram IO so
- 00:11:49operating system is responsible for
- 00:11:51basically
- 00:11:53cascading your request that is from your
- 00:11:56software to Hardware so who takes the
- 00:11:57responsibility like there should be a
- 00:11:58component in your operating system which
- 00:12:00is taking this responsibility right so
- 00:12:02that component is nothing but your
- 00:12:04kernel so that's why kernel is again
- 00:12:07here heart of your operating system so
- 00:12:08there are some primary responsibilities
- 00:12:10of Kernel that you have to understand
- 00:12:13that is for CPU it does okay let's try
- 00:12:15to put it in this way there are four
- 00:12:18important aspects of your kernel even if
- 00:12:20somebody is asking in an interview what
- 00:12:22is a kernel in an operating system you
- 00:12:24can just say that kernel has four
- 00:12:27primary responsibilities it's a heart of
- 00:12:30any operating system which does
- 00:12:32device management
- 00:12:35okay kernel is responsible for memory
- 00:12:36management
- 00:12:38then it is responsible for your Process
- 00:12:42Management and finally it is responsible
- 00:12:45for handling your system calls
- 00:12:48okay for any operating system these are
- 00:12:52the key aspects and that are handled by
- 00:12:54your kernel one is device management
- 00:12:56memory management process management and
- 00:12:59handling the system related calls after
- 00:13:02that you have system libraries right uh
- 00:13:05like as I mentioned you can also take
- 00:13:07example of Kernel modules and other
- 00:13:08things but let's try to keep it very
- 00:13:10simple so after the kernel you have
- 00:13:12system libraries and what you have in
- 00:13:15system libraries so system libraries are
- 00:13:17basically responsible for performing a
- 00:13:18task let's say user is trying to perform
- 00:13:20a task so it comes from your system
- 00:13:21libraries and then it goes to your
- 00:13:23kernel
- 00:13:25so each operating system has their own
- 00:13:27uh supported kind of these system
- 00:13:29libraries so let's say you are
- 00:13:32installing uh uh you know a Debian
- 00:13:35distribution or you are installing a uh
- 00:13:36a different kind of distribution like
- 00:13:38your Cent Os or federal your system
- 00:13:40libraries might differ slightly but
- 00:13:42again most of the times the concept of
- 00:13:46the system libraries is the same
- 00:13:46if you want to take a uh example of a
- 00:13:50system Library you can try to understand
- 00:13:53like you have your Lipsy right so lip C
- 00:13:55is one of the system Library just for
- 00:13:58your understanding so uh there are other
- 00:14:00system libraries like the graphical gnu
- 00:14:02or the other things but
- 00:14:05okay after that you have the final stage
- 00:14:07where you have compilers user process
- 00:14:09and system software so compilers coming
- 00:14:11to the compiler so uh like let's say you
- 00:14:14want to run Java application or Java or
- 00:14:16you want to run python or you want to
- 00:14:18run any other uh kind of your software
- 00:14:21so your operating system has to compile
- 00:14:23this code right your application or
- 00:14:25these kind of things so for that reason
- 00:14:27you have compilers user processes and
- 00:14:29some kind of system softwares even if
- 00:14:31you are using a Windows laptop you are
- 00:14:32aware of your system softwares that you
- 00:14:33have
- 00:14:36so these are the fundamentals of any
- 00:14:38operating system like uh definitely I'm
- 00:14:39not going to the details of each of
- 00:14:41these things because even for me to
- 00:14:43explain like even when I'm trying to
- 00:14:45explain these things I'm trying to keep
- 00:14:46it as crisp as possible that's why I'm
- 00:14:48taking some time while explaining it
- 00:14:51because I don't want to complicate these
- 00:14:52things and explaining these things in
- 00:14:55like 30 to 40 minutes of session is
- 00:14:57technically not possible but
- 00:14:59you have to understand the breadth of
- 00:15:02the concepts like even in this 40 to 45
- 00:15:05days of devops Journey if we spend two
- 00:15:07to three days in just understanding the
- 00:15:09kernel or if you spend two to three days
- 00:15:10in understanding the operating system
- 00:15:12that will be of no use
- 00:15:14you have to understand the breadth of
- 00:15:15the knowledge of all the different kinds
- 00:15:17of Concepts that are available in devops
- 00:15:20or most widely used in devops and once
- 00:15:21you understand the breadth of it you can
- 00:15:23start giving your interviews and during
- 00:15:25your interviews you can go into the
- 00:15:27depth of each and every tool for example
- 00:15:28if I'm explaining you about the
- 00:15:30configuration management you have to
- 00:15:31understand about configuration
- 00:15:33management but you don't have to spend
- 00:15:35uh 10 days 15 days in just understanding
- 00:15:37different tools that are available in
- 00:15:38configuration management like don't
- 00:15:40learn ansible puppet itself and
- 00:15:42everything just learn one thing start
- 00:15:43with your interviews and then once you
- 00:15:45are comfortable with your devops journey
- 00:15:47then probably you can understand okay
- 00:15:49what is puppet why puppet is different
- 00:15:51from ansible for now just restrict to
- 00:15:52one thing
- 00:15:54so even today I'm just explaining you
- 00:15:57the Core Concepts of operating system
- 00:15:59but not going into the details of Kernel
- 00:16:00not going to the details of system
- 00:16:02libraries because that will be very
- 00:16:04complicating
- 00:16:05now
- 00:16:07so what did we learn till now we
- 00:16:09understood what is a operating system
- 00:16:14after that we try to understand what is
- 00:16:16the definition of an operating system uh
- 00:16:19why operating system is useful basically
- 00:16:20it is useful for establishing a
- 00:16:22communication between your hardware and
- 00:16:24your software whenever a user sends a
- 00:16:27request it has to go from your software
- 00:16:29to your operating system to your
- 00:16:31Hardware finally the response is also
- 00:16:33received back in the same way and then
- 00:16:35we try to see why Linux is a very
- 00:16:37popular operating system and why windows
- 00:16:39or other operating systems are not used
- 00:16:41in your production systems because of
- 00:16:44the free secure and the fast nature of
- 00:16:46your Linux operating system
- 00:16:48and finally we also try to understand
- 00:16:51the architecture of your Linux operating
- 00:16:54system so now let's move ahead and try
- 00:16:56to understand the fundamentals of your
- 00:17:00shell scripting okay
- 00:17:02so today we will not go into the details
- 00:17:04of shell scripting but we will only take
- 00:17:05a look at the fundamentals of shell
- 00:17:08scripting
- 00:17:10so because you understood what is Linux
- 00:17:15operating system
- 00:17:17why you have to use something like a
- 00:17:18shell scripting
- 00:17:21basically what is shell shell is a way
- 00:17:23that you talk to your operating system
- 00:17:26let's say you want to create a file
- 00:17:27what do you do in your windows so
- 00:17:32Windows has a very good graphical user
- 00:17:34interface but most of the times when you
- 00:17:35are working in your software
- 00:17:39organizations you don't have a graphical
- 00:17:41user interface for your servers so if
- 00:17:43you have issue on your production server
- 00:17:44you don't have a graphical user
- 00:17:46interface for you to navigate through
- 00:17:48the folders to understand what is issue
- 00:17:51so you have to do it through some uh
- 00:17:53command line way okay so this command
- 00:17:56line way through which you talk to your
- 00:17:58operating system are nothing but your
- 00:18:01shell commands
- 00:18:06okay so in Linux the way that you talk
- 00:18:08to your Operating System is using your
- 00:18:10shell commands so shell is most of the
- 00:18:15times like 99.9 percent of them your uh
- 00:18:16servers that you're using on your
- 00:18:18production or your Dev or staging
- 00:18:20environments default come with the shell
- 00:18:22environment so you can if you are aware
- 00:18:24of the shell commands you can directly
- 00:18:26talk to your Linux operating system and
- 00:18:28these commands are common across
- 00:18:29different distributions whether you are
- 00:18:33using uh Centos whether you are using uh
- 00:18:35fed Arrow or whether you are using a
- 00:18:38Debian or Ubuntu so these uh shell
- 00:18:40commands that we are going to talk or
- 00:18:42which we use as a devops engineer are
- 00:18:44mostly common across different
- 00:18:46distributions and different uh yeah just
- 00:18:47the different distributions not
- 00:18:49operating systems
- 00:18:51so that's why today we'll try to see
- 00:18:53what are some of the popular shell
- 00:18:56commands so again just to give you an
- 00:18:58example if you want to create a file on
- 00:19:00your windows what you would do is you
- 00:19:01would navigate through your graphical
- 00:19:03user interface that is you go to your
- 00:19:04laptop making use of your mouse or
- 00:19:06cursor you navigate through the
- 00:19:08different folders but online Linux
- 00:19:10operating system that's not possible
- 00:19:12because most of the times your graphical
- 00:19:15user interface GUI is not installed
- 00:19:17because it comes with some weight right
- 00:19:19if you want to install graphical user
- 00:19:22interface again your operating system or
- 00:19:24your servers would become heavy so
- 00:19:26that's why on your production systems we
- 00:19:28don't use graphical interface and most
- 00:19:29of the times we make use of the shell
- 00:19:32commands to talk to the
- 00:19:35distribution or to create files or to
- 00:19:37create anything in your operating system
- 00:19:40so let me just stop sharing and in the
- 00:19:43previous class we uh already understood
- 00:19:45how to create a virtual machine on your
- 00:19:47AWS right whether through the command
- 00:19:50line or whether through the AWS CLI we
- 00:19:52already talked how to create This Server
- 00:19:54so now let me make use of one of the
- 00:19:56server that I created in the previous
- 00:19:58class and show you some of the basic
- 00:20:01commands of shell scripting
- 00:20:04so I'll stop sharing here and share my
- 00:20:06screen with the
- 00:20:09stop sharing and let me share my
- 00:20:12terminal so you can use any terminal
- 00:20:14whether you want to use putty like I
- 00:20:15explained in the previous classes
- 00:20:18whether you want to use mobilex term or
- 00:20:20any other thing that's totally fine you
- 00:20:22can use anything
- 00:20:25yep
- 00:20:29so let me share my screen again
- 00:20:32here
- 00:20:32Okay cool so what I've done is I am uh
- 00:20:39for now I'm using a Mac laptop but I've
- 00:20:41installed bash in it by default it comes
- 00:20:44with SH so you can use zsh or you can
- 00:20:47use bash so I've installed bash like
- 00:20:49most of the times recommend bash is one
- 00:20:52of the popular ones and most widely used
- 00:20:55so instead of learning ksh instead of
- 00:20:58learning essay just learn bash and you
- 00:21:00can use this scripting even once you
- 00:21:02start your software journey and even in
- 00:21:04a devops Zero to Hero devops Journey
- 00:21:06we'll be learning about bash only
- 00:21:10so I have like I mentioned I have uh
- 00:21:12this one here
- 00:21:15the
- 00:21:17just give me a second uh for me to pull
- 00:21:22the
- 00:21:23okay I got hold of my IP address of the
- 00:21:29newly created AWS instance in the
- 00:21:31previous class so this is the command
- 00:21:33I'll use to login so if you just want to
- 00:21:35understand one more time so this is the
- 00:21:37key value pair that we just created I
- 00:21:40mean in the previous class and using the
- 00:21:42identity file that is the key value pair
- 00:21:44what we do is we make use of the public
- 00:21:47IP of the ec2 instance to log into the
- 00:21:51instance so we created a Ubuntu related
- 00:21:54image uh in the last class so that's why
- 00:21:56the user that comes by default is
- 00:21:57something that I already know that is
- 00:21:59the Ubuntu so that's why I use the
- 00:22:02command SSH minus I identity file Ubuntu
- 00:22:05at the rate public IP address
- 00:22:08perfect so this is the server it has
- 00:22:10Linux operating system installed that
- 00:22:11that is nothing but your Ubuntu
- 00:22:14distribution so even in Linux operating
- 00:22:15system you have different distributions
- 00:22:17uh most of the times we use Ubuntu or
- 00:22:19Centos
- 00:22:20distributions are nothing but the
- 00:22:22vendors that are providing this Linux
- 00:22:25operating system right so red hat is a
- 00:22:27vendor that provides Linux operating
- 00:22:30system uh using Red Hat uh Centos is one
- 00:22:32fedoro is one Ubuntu Debian different
- 00:22:34vendors provide Linux operating system
- 00:22:36you can make use of anything Ubuntu is
- 00:22:38most widely used
- 00:22:40so what is the command first of all you
- 00:22:42got into this one but you don't know how
- 00:22:44to navigate from one place to another
- 00:22:46place right if it is Windows what you
- 00:22:47would do you directly make use of your
- 00:22:49mouse you would see what are the files
- 00:22:51and folders that are present but on your
- 00:22:53Linux platform if you want to see what
- 00:22:55are the different files and folders that
- 00:22:57are present here the command that you
- 00:23:00make use is LS so by using LS you try to
- 00:23:02understand what are the files and
- 00:23:05folders LS is nothing but list okay so
- 00:23:07using LS command you list the files and
- 00:23:08folders
- 00:23:11but if you see here it is showing the
- 00:23:13files and folders in this particular
- 00:23:16directory right but I want to see the
- 00:23:17files and folders everywhere but for
- 00:23:19that I need to understand where I am
- 00:23:20currently
- 00:23:22again if you are on Windows what you
- 00:23:23would do you would right click and see
- 00:23:25what is your current location but
- 00:23:27everything in Linux has to be done
- 00:23:29through some commands for the for that
- 00:23:31what is the command that you use is PWD
- 00:23:34so PWD stands for present working
- 00:23:37directory so always once you start
- 00:23:40logging into your server firstly make
- 00:23:42use of the PWD command to understand
- 00:23:44what is your present working directory
- 00:23:47so here it says that I am in the slash
- 00:23:50home slash Ubuntu working directory
- 00:23:53now I can change this present working
- 00:23:57directory by using the CD command so
- 00:23:59using CD that is change directory okay
- 00:24:03so again uh always try to compare with
- 00:24:04the operations that you are doing on
- 00:24:05your Windows machine if you are very
- 00:24:08used to just to understand
- 00:24:09how to
- 00:24:12correlate right you know if you are for
- 00:24:14example uh you want to move from uh C
- 00:24:16directory to the D directory in your
- 00:24:18windows what you would do you will make
- 00:24:20use of the cursor and click on the back
- 00:24:22you do back click and then go to the
- 00:24:25directory but in Linux it's not possible
- 00:24:26because there is no graphical user
- 00:24:28interface most of the times so that's
- 00:24:30why firstly you would do PWD to
- 00:24:32understand where you are currently and
- 00:24:34using LS you understand what are the
- 00:24:36files and folders that are available in
- 00:24:38the directory and let's say you want to
- 00:24:41move from slash Ubuntu to bundle
- 00:24:42directory so for that what you will do
- 00:24:45is you will make use of the CD command
- 00:24:48CD can CD stands for change directory CD
- 00:24:49bundle
- 00:24:52and once you do CD bundle again if you
- 00:24:55do PWD you can clearly see that you are
- 00:24:57present working directory has changed so
- 00:24:59you now we are present where working
- 00:25:01directory is slash home slash Ubuntu
- 00:25:04slash bundle okay so just to repeat
- 00:25:09always once you log in to your uh Linux
- 00:25:10software or Linux system sorry Linux
- 00:25:13system what you would do is firstly you
- 00:25:15execute the command called PWD to
- 00:25:16understand what is your present working
- 00:25:18directory and once you understand your
- 00:25:22present working directory you need to
- 00:25:25do the ls command to list the files and
- 00:25:28directories okay so inside this present
- 00:25:31working directory I have few files or
- 00:25:33folders as well
- 00:25:36so for me to understand or to just uh
- 00:25:38see like let's say uh somebody asked you
- 00:25:40what are the files and folders that are
- 00:25:43present in bundle directory so you make
- 00:25:45use of the ls command to list the files
- 00:25:47as well as folders once you list these
- 00:25:49files and folders let's say I want to
- 00:25:52move to a directory called bundle so
- 00:25:54what I'll do is I'll make use of the CD
- 00:25:56command to change the directory okay so
- 00:25:59using CD I'll go to the bundle folder
- 00:26:02which I am currently already in
- 00:26:05or let's say there is a test folder so
- 00:26:08what I can do CD test once doing it
- 00:26:11again if I click on PWD you'll see the
- 00:26:13present working directory has changed if
- 00:26:16you want to go back okay like let's say
- 00:26:18you came here and now you just want to
- 00:26:20go back instead of giving the complete
- 00:26:21path what you can simply do is you can
- 00:26:25say CD space dot dot so what happens
- 00:26:28when you do CD space dot dot is you go
- 00:26:30back to One Directory let's say you want
- 00:26:32to go back to two directories okay so
- 00:26:36what you say is CD dot dot slash dot dot
- 00:26:39by doing that now you are in just the
- 00:26:41home directory and if you want to go to
- 00:26:43two directories more or you know two
- 00:26:44directories in depth what you can do is
- 00:26:47CD
- 00:26:50Ubuntu
- 00:26:51slash bundle okay so this is how you
- 00:26:56move from one directory to another
- 00:26:58director and if you want to do uh with
- 00:27:00multiple like you want to go back to
- 00:27:01multiple directories or go ahead of
- 00:27:03multiple directories you can make use of
- 00:27:05this slash operator
- 00:27:09perfect so just in uh one minute of time
- 00:27:10we learned about three different
- 00:27:13commands that is PWD CD LS so we learned
- 00:27:15about these things right now let's say I
- 00:27:17want to list all the files and folders
- 00:27:19with timestamp who is owner of the file
- 00:27:22uh and other information like is it a
- 00:27:24file or a directory so you can make use
- 00:27:27of this one simple command that is LS
- 00:27:29hyphen LTR
- 00:27:33okay LS minus LTR so what does this LS
- 00:27:36minus LTR does is it provides you uh it
- 00:27:38provides you the information like if it
- 00:27:40is starting with d that means that it is
- 00:27:42a directory if it is not starting with t
- 00:27:44that means that it is a Phi so if you
- 00:27:46see here this is a directory this is a
- 00:27:48directory this is a directory metadata
- 00:27:50is a directory uh like you know manifest
- 00:27:53is a directory bundle is a directory
- 00:27:56and if it doesn't start with the D that
- 00:27:58means that it's a file after that you
- 00:28:00have information of who is the owner of
- 00:28:02the file which group owns this file you
- 00:28:04know uh what is the content like what is
- 00:28:06the size of the contents inside this
- 00:28:09file and after that you also have
- 00:28:11information like you know when is this
- 00:28:13file created the timestamp of it and
- 00:28:14what is the name of the file or the
- 00:28:17folder so if you want to just list the
- 00:28:19files and folders you can use LS command
- 00:28:22but LS supports Advanced that is using
- 00:28:25LS minus LTR you can list the files and
- 00:28:29folders with its properties that is who
- 00:28:33is the owner who is the group owner or
- 00:28:35what is it a file and a folder and you
- 00:28:37also get the information that what are
- 00:28:40the permissions of it
- 00:28:42and what is the size of it and the
- 00:28:45timestamp using the ls minus LTR so
- 00:28:46these are some of the basics right and
- 00:28:49after this you might want to create a
- 00:28:52file okay so to create a file you can
- 00:28:54simply use the touch command so using
- 00:28:56touch command you can create a file but
- 00:28:59like let's say touch space Abhishek so
- 00:29:01now what happens is a file called wstick
- 00:29:03is created and to see if this file is
- 00:29:05created or not you can use again LS
- 00:29:07command and you'll see a new file called
- 00:29:08Abhishek
- 00:29:09okay
- 00:29:12but if you just want to create a file
- 00:29:14touch is fine most of the times you want
- 00:29:15to create a file and you want to write
- 00:29:17contents inside this file so for that we
- 00:29:20use the vi command so using VI you can
- 00:29:22not only create a file but you can
- 00:29:24create a file and write inside the file
- 00:29:27so VI space let's say test
- 00:29:30so a file called see here a new file is
- 00:29:32being created with name bi uh sorry with
- 00:29:35name test and you can also start writing
- 00:29:37into the file but to write content
- 00:29:40inside a Linux file okay or file in a
- 00:29:43Linux it's not straightforward because
- 00:29:45you know when you open a file Linux will
- 00:29:49ask you do you want to read the file do
- 00:29:50you want to write content into the file
- 00:29:53so using Escape okay always once you
- 00:29:56enter a file click on escape and tell
- 00:29:58Linux that you know I want to write
- 00:30:01content inside the file so click on I by
- 00:30:03clicking on I you will move to the
- 00:30:05insert mode and then you can start
- 00:30:07writing into the file hi
- 00:30:10I am Abhishek okay and using again
- 00:30:13Escape you have to use this called colon
- 00:30:16WQ to save the file
- 00:30:19Okay so now we wrote contents inside
- 00:30:22this file and using cat you can
- 00:30:24basically print the file now if you feel
- 00:30:27that I am moving too fast don't worry I
- 00:30:30have already created a very good video
- 00:30:32that covers all the basics of shell
- 00:30:34scripting I'll put the link in the
- 00:30:36description don't worry uh it's almost
- 00:30:38like you know 90 minutes of video or
- 00:30:40sorry 80 minutes of video where we
- 00:30:42covered all the fundamentals of shell
- 00:30:44and again we created one more video that
- 00:30:46is of one hour to cover some
- 00:30:48intermediate Concepts on shell so
- 00:30:50totally we have two end of ours content
- 00:30:52on my channel that only talks about this
- 00:30:55cell commands uh how to write some
- 00:30:56simple shell scripts so if you haven't
- 00:30:58followed any of these things right now
- 00:31:00don't worry I'll put the links in the
- 00:31:02description you can watch both of those
- 00:31:05videos where I covered uh all most of
- 00:31:07the concepts of shell commands like you
- 00:31:09know from Basics to the intermediate
- 00:31:11level of shell command so also we did a
- 00:31:13shell scripting interview questions
- 00:31:16video so watch those videos and you know
- 00:31:18you'll get very familiar clear with the
- 00:31:20shell command shell Concepts and
- 00:31:22tomorrow's class we'll talk about some
- 00:31:23Advanced topics
- 00:31:25where you know we'll take a look at one
- 00:31:28real-time devops project
- 00:31:30so you might be learning all of these
- 00:31:32shell commands but if you don't
- 00:31:33understand where are these practically
- 00:31:36used so that will be a problem right so
- 00:31:38that's why what I'll do is I'll make a
- 00:31:40video where I'll talk about a real-time
- 00:31:42devops project using shell scripting uh
- 00:31:44why shell scripting is used in an
- 00:31:47organization just for one example and
- 00:31:49with that you know you can understand
- 00:31:52okay so this is a real time use case of
- 00:31:55shell scripting in devops probably you
- 00:31:56can enhance or you can think of other
- 00:31:58Alternatives and you can create your own
- 00:32:00projects and you can put them on your
- 00:32:02resumes
- 00:32:05perfect so uh this is something and then
- 00:32:07uh you know you have uh some other
- 00:32:08commands like for creating directories
- 00:32:11you have a command called mkdir using
- 00:32:14mkdr you can create directory and for
- 00:32:15removing the files you have command like
- 00:32:18RM okay so using RM you can remove a
- 00:32:21file and using RM minus r you can remove
- 00:32:23a directory so these are some of the
- 00:32:26commands that we usually use as part of
- 00:32:29day to day life okay so it says folder
- 00:32:31already exists uh let's say I do mkdar
- 00:32:34and call it something called as
- 00:32:37abhishek1 so it creates a directory
- 00:32:38called
- 00:32:39Abhishek
- 00:32:42Abhishek and then if I want to remove
- 00:32:45the directory that I just created I can
- 00:32:47use RM minus r Abhishek one
- 00:32:49so these are some of the popular
- 00:32:52commands that people use it in day to
- 00:32:54day basis but apart from this so this is
- 00:32:56about creating a file writing a file
- 00:32:58reading a file and all of these things
- 00:33:00right but let's say uh you want to log
- 00:33:02into a uh
- 00:33:04Linux machine and you want to check the
- 00:33:07CPU memory or the performance of your
- 00:33:09machine completely
- 00:33:12which is very important right so let's
- 00:33:14say that you are using a Windows machine
- 00:33:16and in your Windows machine all of a
- 00:33:17sudden you realize that your Windows
- 00:33:21machine uh all the CPUs used or Ram is
- 00:33:23used so how do you check uh basically
- 00:33:25you go to your system properties and you
- 00:33:27will see what is the Ram size and then
- 00:33:29you will go to task manager and you will
- 00:33:31see how much RAM is used you will
- 00:33:33compare both of these things right so in
- 00:33:34your system properties you understood
- 00:33:38that your uh your laptop is of 8GB RAM
- 00:33:40and in your task manager you realize
- 00:33:42that okay 7gb is already used so
- 00:33:44similarly let's say you want to do the
- 00:33:47same uh things in your
- 00:33:50Linux so for that you again you do it
- 00:33:52only through your shell commands Okay so
- 00:33:54what are the sale commands that you will
- 00:33:55use here is
- 00:33:58for looking into the memory you use a
- 00:34:01command called free so using free uh for
- 00:34:03better readability what you can do is
- 00:34:05you can do
- 00:34:083 minus mg
- 00:34:10sorry
- 00:34:12so using free minus D what you can do is
- 00:34:18you can understand what is the memory of
- 00:34:22your laptop that is or your server
- 00:34:27and using uh n proc using nproc you can
- 00:34:29understand uh what are the CPUs uh
- 00:34:31number of CPUs that are because this is
- 00:34:33a basic ec2 instance that I just created
- 00:34:35right so it says that it only comes with
- 00:34:37one CPU we know but because we are using
- 00:34:40a free ec2 instance right so that's why
- 00:34:44it just has one CPU now and finally you
- 00:34:45want to understand what is the disk size
- 00:34:47first of all that you have a command
- 00:34:49called DF minus H so using DF minus H
- 00:34:52you can understand what is the disk size
- 00:34:54so 24 24 percentage I have already used
- 00:34:58so it comes with 5.8 GB and 1.9 GB I
- 00:35:00already used so just like you know you
- 00:35:01sorry
- 00:35:057.6 DB is the total size uh 1.9 GB is
- 00:35:07something that I used and 5.8 is
- 00:35:09available so 24 percentage of this is
- 00:35:11something that I used if you want to see
- 00:35:13all of these things at one place there
- 00:35:15is a very popular command that is called
- 00:35:18top so using top you can get the
- 00:35:20complete information so it's like a
- 00:35:24memory CPU and disk everything like you
- 00:35:26can monitor everything from one place
- 00:35:28that is using top so it says like you
- 00:35:30know what is the CPU percentage that is
- 00:35:32used what is the memory percentage that
- 00:35:33is used so this is a very popular
- 00:35:35interview question that is what is uh
- 00:35:38the command that you will use to manage
- 00:35:40your memory CPU or look into the details
- 00:35:42of it so the answer is using the top
- 00:35:44command and individually if you want to
- 00:35:46do you can use for memory you can use
- 00:35:48the free Command free is the command
- 00:35:51name for CPU you can use a command
- 00:35:52called n proc
- 00:35:55okay and for this you can use a command
- 00:35:56called DF
- 00:35:58so all of these commands if you want to
- 00:36:00look into one place that is using the
- 00:36:03top command so these are some of the
- 00:36:05popular shell commands that you use a
- 00:36:07day-to-day basis we looked into creating
- 00:36:09a file creating a folder removing files
- 00:36:12writing into a file reading a file uh
- 00:36:15and a listing file how to look into the
- 00:36:18permissions of a file right and finally
- 00:36:20we also looked into uh some of the
- 00:36:21processing or management related
- 00:36:25commands that is DF to look into this
- 00:36:30file size and memory using free Command
- 00:36:32and CPU using the in Pro command and for
- 00:36:34the whole management we can use the top
- 00:36:36command so we looked into all of these
- 00:36:38things right and if you have still more
- 00:36:40questions or if you are eager to learn
- 00:36:42many more shell commands so like I
- 00:36:44mentioned I created three videos on my
- 00:36:45channel and there is also playlist
- 00:36:48called Shell Shell scripting I guess so
- 00:36:50I'll put all of the links in the
- 00:36:51description so once you watch these
- 00:36:53videos uh at least watch the
- 00:36:55intermediate level video where I covered
- 00:36:57a lot of shell commands before we move
- 00:36:59to the tomorrow's topic because in
- 00:37:01tomorrow we will see a real time shell
- 00:37:03scripting devops project
- 00:37:07perfect I hope you enjoyed the video uh
- 00:37:08where we understood the concepts of
- 00:37:10operating system basics of cell shipping
- 00:37:13and everything if you feel that this
- 00:37:14video was useful click on the like
- 00:37:16button if you have any feedback for me
- 00:37:19whether it's positive or negative put
- 00:37:21that feedback in the comment section so
- 00:37:23I'll make sure uh to take your feedback
- 00:37:26and improve in the future videos
- 00:37:28and finally if somebody uh is willing to
- 00:37:30learn devops and is not a subscriber or
- 00:37:32a viewer of our Channel please try to
- 00:37:33share this video with your friends and
- 00:37:35family
- 00:37:37and if you haven't subscribed uh please
- 00:37:38subscribe to my channel I'll see in the
- 00:37:41next video take care
- Linux
- système d'exploitation
- shell scripting
- DevOps
- commandes shell
- noyau
- bibliothèques système
- sécurité
- open source
- performance