A Beginner's Guide to Linux for DevOps
📚 In this blog, you'll learn: ✅ What is Linux ✅ Linux Architecture ✅Essential Linux Commands for Command Line🚀 ✅ Basic Linux commands for file
✅ Bouns(☞゚ヮ゚)☞TASK☜(゚ヮ゚☜)
Task 1 ✅: Check your present working directory.
Task 2 🔍: List all files and directories, including hidden files.
Task 3 📂: Create a nested directory A/B/C/D/E
✅What is Linux & who created it?
The Linux kernel is an open-source operating system that forms the basis of many Linux distributions. Since Linus Torvalds created it in 1991, it has blossomed into a vibrant ecosystem with a sizable community of contributors.
Open-source means that People improve it, people adapt it, and people fix bugs. And this can happen at a speed that, compared to conventional software development, seems astonishing.
✔It is a Unix-like operating system.
✔It can run on 32-bit and 64-bit hardware.
✔Linux OS, is a freely distributable, cross-platform Supports multiple processors.
✔True multi-tasking, multi-user OS.
✔Linux is "virus-free" in that there are essentially no viruses or Linux in the wild, though research viruses certainly do exist.༼ つ ◕_◕ ༽つ
According to a StackOverflow survey, Linux is the most-used operating system by professional developers, with an impressive 55.9% of the market share. It isn’t just a coincidence. Linux is free and open-source, has better security than its competitors, and boasts a powerful command line that makes developers and power users more effective.
✅Linux Architecture
Linux architecture consists of three software components as follows:
1. Kernel
2. Shell
3. Utilities
Hardware layer − Hardware consists of all peripheral devices (RAM/ HDD/ CPU etc).
Kernel − It is the core component of the Operating System, interacts directly with hardware, and provides low-level services to upper-layer components.
Shell − An interface to the kernel, hiding the complexity of the kernel's functions from users. The shell takes commands from the user and executes the kernel's functions.
Utilities − Utility programs that provide the user with most of the functionalities of an operating systems
✅Essential Linux Commands for Command Line
Before jumping into the most-used Linux commands, make sure to fire up a terminal., you would use Ctrl + Alt + T to open the Linux terminal
pwd
Command
PWD stands for Print Working Directory. It writes the complete path name of the working directory to standard output in UNIX-like and other operating systems. We can use the command in the terminal window to print our current working directory:
-In this example, /home/devasc is your current directory. The full path of any directory under Unix-like operating systems always starts with a forward slash. In short:
\==>/ – Forward slash – The root directory on your system or the file system.
\==>home – Sub-directory
\==>devasc – Sub-directory
2.ls
Command
Type the ls
command to list the contents of the current working directory:
Following are some frequently used options in Linux ls commands:
Options | Description |
ls -a | list all files including hidden files starting with '.'. |
ls -d | list directories - with ' */'. |
ls -l | list with the long format - show permissions. |
ls -F | Append indicator (one of */=>@ |
ls -lh | This command will show you the file sizes in human-readable format. |
ls -r | list in reverse order. |
ls -i | list file's inode(index) number. |
ls -ltr | View Reverse Output Order by Date. |
ls -t | sort by time & date. |
ls -n | It is used to print group ID and owner ID instead of their names. |
ls -m | A list of entries separated by commas should fill the width. |
ls -g | This allows you to exclude the owner and group information columns. |
ls -q | Force printing of non-graphic characters in file names as the character `?';. |
ls -Q | Place double quotations around the entry names. |
3.cd
Command
It refers to “change directory” and, as its name suggests, switches you to the directory you’re trying to access.
For instance, if you’re inside your devasc directory and you’re trying to access one of its subfolders called Downloads, Check ls
Command all subfolder and switch the directory you can enter it by typing:
cd ~
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
4.mkdir
Command
The mkdir stands for 'make directory'. With the help of mkdir command, you can create a new directory wherever you want in your system. Just type "mkdir <dir name>, in place of <dir name> type the name of the new directory, you want to create and then press enter.
The syntax of this command is as follows
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
✅ Bouns(☞゚ヮ゚)☞TASK☜(゚ヮ゚☜)
Task 1 ✅: Check your present working directory.
Task 2 🔍: List all files and directories, including hidden files.
Task 3 📂: Create a nested directory A/B/C/D/E
❤conclusion:
Above mentioned commands are basic, I suggest you try this so you can get a good idea and also you will become familiar with the terminal.
If you can face an issue while trying this command feel free to ask your doubt in the comment section.
Thanks for your time, If you find this valuable follow me on hashnode.
Stay tuned for such amazing blogs...!