Skip to main content

Command Palette

Search for a command to run...

Linux and shell scripting

Published
•2 min read•View as Markdown

Most of the software professions and companies in software world are using linux based operating system.

operating system : os is used to establish connection between hardware and software

Advantages

-- Open source software

-- Secure, no need to install antivirus software like windows

-- Multiple distributions (i.e , flavours)

-- Fast

Architecture:

Kernel:

-- Heart of the operating system

-- It is responsible for device, memory, process management

-- It is responsible for handling system calls

System libraries:

--System libraries awhy we re used to perform tasks

Shell Scripting:

In OS, the way to talk to the OS is called shell scripting by using shell commands

why to use shell scripting instead of GUI?

-- In production systems, if we use GUI we need to install GUI , so the servers will become heavy, so we will make use of shell scripting

Basic commands of shell scripting

-- Connect to the ec2 instance

ls : list (used to list files and folders)

pwd : present working directory

mkdir : make directory( ex : mkdir f1)

cd : change directory

cd .. : switch back one step

cd ../.. : switch back two steps

ls -ltr : used to display files and folders list along with dates.

if the results starts with d then its a directory otherwise its a file

touch : used to create a file ( ex : touch file1)

vi file2 : is used to create the file and write anything inside it.

-- to write in it press "esc" and click i(insert mode)

-- esc and :wq! to save the file

cat : used to display contents of file

rm : remove a file

rm -r : remove a directory

free : used to see how much available space of memory etc

free -r

nproc : how many cpus are there

df -h : used to display disk size

top : monitor everything from one place( cpus, disk etc)