Day2-90DaysofDevOpsChallenge

Linux

Day2-90DaysofDevOpsChallenge

Table of contents

Table of Contents

  1. What is Linux?

  2. Architecture of Linux

  3. Basic commands of Linux

what are Linux commands to,

  • Check your present working directory.

  • List all the files or directories including hidden files.

  • Create a nested directory A/B/C/D/E.

What is Linux?

Linux is an operating system, which is based on Linux Kernel. It is an open-source operating system where it can run on different hardware platforms. It provides a free and low-cost operating system for users. It is a user-friendly environment where they can easily modify and create variations in the source code.

Architecture of Linux

Kernel: It is the core component of Linux, it acts as an interface between software and hardware.

Shell: It acts as an interface between the user and the Kernel.

GUI: It stands for Graphic User Interface, which is another way for the user to interact with the system. But it is unlike images, buttons, and text boxes for interaction.

System Utilities: These are the software functions that allow users to manage the computer.

Application Programs: A set of functions designed to perform a set of tasks.

Architecture of Linux

Basic commands of Linux:

Basic and most commonly used commands.

  1. Is: Displays information about files in the current directory.

  2. pwd: Displays the current working directory.

  3. mkdir: Creates a directory.

  4. cd: To navigate between different folders.

  5. cp: Moves files from one directory to another.

  6. mv: Rename and Replace the files

  7. rm: Delete files

  8. uname: Command to get basic information about the OS

  9. locate: Find a file in the database.

  10. touch: Create empty files

  11. ln: Create shortcuts to other files

  12. cat: Display file contents on terminal

  13. history: The system will list up to previously executed commands, allowing you to reuse them without re-entering.

  14. man: Access manual for all Linux commands

  15. grep: Search for a specific string in an output

  16. echo: Display active processes on the terminal

  17. wget: download files from the internet

  18. whoami: Create or update passwords for existing users

  19. ping: Use ping to check your connection to a server.

  20. chmod: To make a file executable and to change the permissions granted to it in Linux.

  21. du: Use du to know the disk usage of a file in your system.

  22. tar: To create and extract archive files. An archive file is a compressed file that contains one or more files bundled together for more accessible storage and portability.

Check your present working directory

The command used to check the directory you are currently at - pwd

pwd stands for Print Working Directory. It writes the complete path name of the working directory to standard output in operating systems.

cd ~ / cd: This navigates to the home directory.

cd - : To change back to the previous working directory, pass the dash (-) character as an argument to the cd command.

cd . . : which is used to move to the parent directory of the current directory, or the directory one level up from the current directory. “..” represents the parent directory.

cd . . /. . : This command changes the directory to two previous directories up from the directory you are currently at.

List all the files or directories including hidden files:

ls is a Linux shell command that lists directory contents of files and directories. It provides valuable information about files, directories, and their attributes.

Syntax of ls command in Linux

ls [option ] [file/directory]

ls -a: This shows all hidden files in the directory you are in

ls-l: It is a long format that displays detailed information about files and directories.

Field explanation:

drwxrwxr-x 2 ec2-user ec2-user 6 Jul 19 06:51 dev3

  • Field 1 – File Permissions: Every 3 characters specify read, write and execute permissions for user(root), group and others respectively in order.

  • Field 2 – Number of links: This specifies the number of links for that file. In the above line, 2 indicates two links to this file.

  • Field 3 – Owner: specifies the owner of the file. In the above line, this file is owned by username ‘ec2-user’.

  • Field 4 – Group: specifies the group of the file. In the above line, this file belongs to ’ec2-user' group.

  • Field 5 – Size: specifies the size of a file in bytes. In this example, ‘6’ indicates the file size in bytes.

  • Field 6 – Last modified date and time: specifies the date and time of the last modification of the file. In this example, ‘Jul 19 06:51' specifies the last modification time of the file.

  • Field 7 – File name: The last field is the name of the file. In this example, the file name is dev3.

    ls -i:

    which displays the index number (inode) of each file and directory.

  • ls -d */:

  • List directories themselves, rather than their contents.

Create a nested directory A/B/C/D/E.

mkdir: This command allows the user to create directories. This command can create multiple directories at once as well as set the permissions for the directories.

Syntax:

mkdir [options ] [directory name........]

example: mkdir devops

mkdir . : This command creates hidden directories

mkdir A B C D: To create multiple directories

mkdir -p a/b/c/d: To create nested directories.

Thank you, This is my understanding about some of Linux commands. Hope you find this helpful.

Thank you Shubham Londhe !!

#TrainwithShubham #DevOps #DevOpsJourney #90Daysofchallenge #Linux #Linuxcommands