What is Linux ?
Linux is an open-source operating system (OS) that is widely used in servers, desktop computers, smartphones, and other devices. Linux was created in the early 1990s by Linus Torvalds, and is based on the Unix operating system.
One of the key features of Linux is its open-source nature, which means that the source code of the operating system is freely available for anyone to modify and distribute. This has led to a large community of developers and users who contribute to its development and use.
Linux is known for its stability, security, and flexibility, and is popular for use in web servers, cloud computing, scientific research, and many other areas.
The popularity of Linux has also led to the creation of many different distributions or versions, such as Ubuntu, Debian, and Red Hat, each with their own features and strengths.
Applications :
Mobile devices:
Android, the world's most popular mobile operating system, is based on the Linux kernel.
Internet of Things (IoT):
Linux is used in many IoT devices, such as smart thermostats, home automation systems, and industrial sensors.
Security:
Linux is often used in security-focused environments, such as network security appliances, firewalls, and intrusion detection systems.
Cloud computing:
Many cloud computing platforms, such as Amazon Web Services (AWS) and Google Cloud Platform (GCP), run on Linux servers.
Why Linux ?
Open-source:
Linux is an open-source operating system, meaning that its source code is available for anyone to use, modify, and distribute. This allows users to customize and adapt the system to their needs, and also means that Linux is often free to use.
Stability and reliability:
Linux is known for its stability and reliability, with a reputation for being less prone to crashes and errors than other operating systems.
Security:
Linux is generally considered to be more secure than other operating systems, due to its architecture and the availability of security-focused distributions.
Flexibility and customizability:
Linux is highly customizable, allowing users to choose from a wide range of distributions and software packages, and to configure the system to meet their specific needs.
Performance:
Linux is often used in high-performance computing environments, such as scientific research and supercomputing, due to its ability to handle large workloads efficiently.
Community and support:
Linux has a large and active community of users and developers, who provide support, guidance, and resources to users of all levels.
Overall, Linux offers a powerful and flexible operating system that can be tailored to meet the needs of users and organizations in a wide range of environments.
File system hierarchy :
The Filesystem Hierarchy Standard (FHS) is a set of guidelines that define the directory structure of Linux-based operating systems. Here is a brief overview of the most important directories in the FHS hierarchy:
/: The root directory, which contains all other directories and files.
/bin: Contains essential system utilities and binaries, such as ls, cp, and mv.
/boot: Contains the files necessary to boot the system, such as the bootloader and kernel.
/dev: Contains device files for all system devices, such as /dev/sda for the first hard disk.
/etc: Contains system configuration files, such as /etc/passwd for user accounts.
/home: Contains user home directories.
/lib: Contains shared libraries that are required by system binaries in /bin and /sbin.
/media: Mount point for removable media, such as USB drives or CD/DVDs.
/mnt: Mount point for temporary file systems or network shares.
/opt: Contains third-party applications installed on the system.
/proc: Contains system information and process-related information, presented as files and directories.
/root: The home directory of the root user.
/run: Contains system information that is required during the boot process.
/sbin: Contains system administration binaries, such as iptables.
/tmp: Contains temporary files that are created by the system or users.
/usr: Contains user applications and support files, such as libraries, documentation, and development files.
/var: Contains variable data files, such as log files, system databases, and spool files.
These directories and their subdirectories provide a standardized structure for the organization of files and directories in a Linux-based operating system.
Basic Linux Commands :
cd - change directory
Syntax: cd [directory_name]
Example: cd Documents
ls - list files in a directory
Syntax: ls [options] [directory_name]
Example: ls -l /home/user
pwd - print working directory
Syntax: pwd
Example: pwd
mkdir - make directory
Syntax: mkdir [directory_name]
Example: mkdir new_directory
rmdir - remove directory
Syntax: rmdir [directory_name]
Example: rmdir old_directory
touch - create a new empty file or update an existing one
Syntax: touch [filename]
Example: touch file.txt
cp - copy file(s) or directory
Syntax: cp [options] [source] [destination]
Example: cp file1.txt /home/user/Documents
mv - move or rename file(s) or directory
Syntax: mv [options] [source] [destination]
Example: mv file.txt /home/user/Documents/new_file.txt
rm - remove file(s) or directory
Syntax: rm [options] [file(s) or directory]
Example: rm file.txt
cat - concatenate files and print to standard output
Syntax: cat [filename]
Example: cat file.txt
echo - print text to standard output
Syntax: echo [text]
Example: echo "Hello, world!"
chmod - change file or directory permissions
Syntax: chmod [options] [permissions] [file(s) or directory]
Example: chmod u+x script.sh
sudo - execute command as superuser (root)
Syntax: sudo [command]
Example: sudo apt-get update
Tasks : Day2
Check your present working directory.
$pwd
List all the files or directories including hidden files.
$la -a
Create a nested directory A/B/C/D/E
$mkdir -p A/B/C/D/E
Basic Hands-On Linux Commands on Terminal
(base) shivraj@Shivrajs-MacBook-Air ~ % pwd
/Users/shivraj
(base) shivraj@Shivrajs-MacBook-Air ~ % ls
Applications Downloads Movies Public opt
Desktop Heart.csv Music Untitled.ipynb
Documents Library Pictures lab1dsdb.py
(base) shivraj@Shivrajs-MacBook-Air ~ % mkdir new
(base) shivraj@Shivrajs-MacBook-Air ~ % ls
Applications Downloads Movies Public new
Desktop Heart.csv Music Untitled.ipynb opt
Documents Library Pictures lab1dsdb.py
(base) shivraj@Shivrajs-MacBook-Air ~ % touch textfile.txt
(base) shivraj@Shivrajs-MacBook-Air ~ % ls
Applications Downloads Movies Public new
Desktop Heart.csv Music Untitled.ipynb opt
Documents Library Pictures lab1dsdb.py textfile.txt
(base) shivraj@Shivrajs-MacBook-Air ~ % echo "Hello Kernal"
Hello Kernal
(base) shivraj@Shivrajs-MacBook-Air ~ % rm textfile.txt
(base) shivraj@Shivrajs-MacBook-Air ~ % ls
Applications Downloads Movies Public new
Desktop Heart.csv Music Untitled.ipynb opt
Documents Library Pictures lab1dsdb.py
(base) shivraj@Shivrajs-MacBook-Air ~ % pwd
/Users/shivraj
(base) shivraj@Shivrajs-MacBook-Air ~ % la -a
zsh: command not found: la
(base) shivraj@Shivrajs-MacBook-Air ~ % mkdir -p A/B/C/D/E
(base) shivraj@Shivrajs-MacBook-Air ~ % cd A
(base) shivraj@Shivrajs-MacBook-Air A % cd B
(base) shivraj@Shivrajs-MacBook-Air B % cd C
(base) shivraj@Shivrajs-MacBook-Air C % cd D
(base) shivraj@Shivrajs-MacBook-Air D % cd E
(base) shivraj@Shivrajs-MacBook-Air E % ls
(base) shivraj@Shivrajs-MacBook-Air E % pwd
/Users/shivraj/A/B/C/D/E
(base) shivraj@Shivrajs-MacBook-Air E %
Thank You for Reading the blog ๐
Keep Learning...๐