Introduction to Linux: Understanding its Architecture & Exploring Basic Commands
What is a Linux?
An Operating System (OS)🖥️, acts as a communication medium between hardware devices and software. It exercises direct control over all hardware resources and peripheral devices connected to it.
Linux,🐧💻 is a free and open-source operating system developed by Linus Torvalds in the early 1990s. Based on the Unix operating system, Linux powers a wide range of devices and systems. Its stability🚀, security🔒, and flexibility💪 make it a popular choice for various applications.
Linux Architecture
OS runs multiple software applications to effectively manage hardware resources on a computer. The diagram illustrates the structure of the Linux system, according to the layers concept.
🛠️Hardware layer: The hardware layer of Linux consists of various peripheral devices such as a CPU, HDD, and RAM.
🖥️ Kernel: The heart of the Linux operating system, responsible for managing hardware resources, providing essential services, and facilitating communication between software and hardware components.
🌐 Shell: The command-line interface (CLI) or shell allows users to interact with the operating system through text commands, providing control over system operations and executing programs. Shell interacts with the kernel and acts as the interface between users and the kernel, allowing them to communicate with the core of the operating system and execute commands.
💻 Applications in the Linux architecture are software programs that interact with the operating system's components. Linux offers a diverse range of applications, including web browsers, office suites, media players, and more, developed to efficiently work on various hardware architectures. The flexibility of Linux allows developers to create and customize applications to meet specific needs. Overall, Linux applications provide users with powerful and versatile tools for various tasks. 🐧🛠️🌟
Basic Linux Commands
I am using an AWS Ubuntu EC2 instance to demonstrate the following commands.
Listing commands
ls option_flag arguments
--> list the subdirectories and files available in the present directory.
Examples:
ls -l
--> list the files and directories in long list format with extra information
ls -a
--> list all including hidden files and directory
ls *.sh
--> list all the files having .sh extension.
ls -i
--> list the files and directories with index numbers inodes
ls -d */
--> list only directories.(we can also specify a pattern)
Directoy commands
pwd
--> print work directory. Gives the present working directory.cd path_to_directory
--> change directory to the provided pathcd ~
or justcd
--> change directory to the home directorycd -
--> Go to the last working directory.cd ..
--> change directory to one step back.cd ../..
--> Change directory to 2 levels back.mkdir directoryName
--> to make a directory in a specific location
Examples:
mkdir newFolder # make a new folder 'newFolder'
mkdir .NewFolder # make a hidden directory (also . before a file to make it hidden)
mkdir A B C D #make multiple directories at the same time
mkdir /home/user/Mydirectory # make a new folder in a specific location
mkdir -p A/B/C/D # make a nested directory
Task: Basics Linux command
What is the linux command to
- Check your present working directory.
- List all the files or directories including hidden files.
- Create a nested directory A/B/C/D/E