Day-17 : Linux & Shell Scripting
Linux & Shell Scripting | Complete Shell Scripting
We have covered the creation of EC2 instances. We hope you have completed the tasks and understood all the sections in the previous blog.
Let's dive into the basics of Operating Systems and Shell Scripting. Understanding the basics of Operating systems would help us in building some questions.
What is an Operating System
Operating systems are the bridging workers coordinating the software and hardware of your system.
The hardware consists of RAM, CPU, and I/O (Hard disk). The software could be anything, maybe a game, the Python IDE where you are coding, or any app. The OS system coordinates their interaction.
Why Linux?
Many Operating Systems are working, but companies prefer using Linux. But why?, let's dive in
Linux is a free, opensource software, whereas Windows is a proprietary product of Microsoft
Secure, no antivirus need for Linux OS
It contains numerous distributions (Vendors who provide the OS) like Ubuntu, alpine, etc.
Fast running OS
Linux Architecture in a Crux
What is Shell Scripting?
Shell scripting is the commands to interact with your operating system
We don't use any GUI to interact with distribution at the production level, but we use shell commands.
For example, if you want to create a file, you will use your mouse to do it with a good UI on screen, but at the production or staging level, it's different, as this GUI can put a heavy load on the systems. Hence, we use the Shell commands.
Shell Commands
pwd # to know where you are now in your machine or the environment, present working directory.
ls # to list the contents of the present working directory.
ls -ltr # to list the contents of present working directory, with the time stamps, file nature and other properties of the contents.
cd <path> # change directory to a path, may be a directory or to a folder.
touch abc.txt # creates a file called abc.txt
vi def.txt # creates the file and will let you start writing into the file.
mkdir directory_name # creates a directory
rm directory_name # to remove a directory
rm -r file_name # to remove a file
free -g # to check the memory of the laptop or the environment you are in
nproc # to check the number of CPUs working for the machine.
df -h # to check the disk size of the machine or the environment you are in
top # it provides all the information for memory, cpus used and disk size.
Please find the codes for this blog DevOps learning in the GitHub Repository. Please add your feedback here in the comments.
Stay tuned for the upcoming blogs and exciting algorithms. Stay learning.