DevOps Journey: PART ONE

DevOps Journey: PART ONE

Continuing my 90-day DevOps journey with the TrainWithShubhm platform, I have progressed to phase one, where I learned to access AWS cloud instances using Ubuntu and grasped basic Linux commands. Under the guidance of Shubham Sir, I delved into the foundational aspects of Linux, which are crucial for DevOps practices. This blog will provide a detailed overview of what I learned, elaborating on each command and its application.

Accessing AWS Cloud Instances

To begin with, I learned how to access AWS cloud instances. AWS (Amazon Web Services) provides scalable and reliable cloud computing services. Using AWS, we can deploy virtual servers (instances) running various operating systems, including Ubuntu Linux.

Basic Linux Commands

System Information and Basic Commands

  1. lsb-release: Displays Linux distribution information.

     bashCopy codelsb_release -a
    
  2. date: Displays or sets the system date and time.

     bashCopy codedate
    
  3. echo: Prints text to the terminal.

     bashCopy codeecho "Hello, World!"
    
  4. mkdir: Creates a new directory.

     bashCopy codemkdir new_directory
    
  5. touch: Creates an empty file or updates the timestamp of an existing file.

     bashCopy codetouch new_file.txt
    
  6. pwd: Prints the current working directory.

     bashCopy codepwd
    
  7. cd: Changes the current directory.

     bashCopy codecd /path/to/directory
    

File and Directory Management

  1. df -h: Displays disk space usage in a human-readable format.

     bashCopy codedf -h
    
  2. cp: Copies files or directories.

     bashCopy codecp source_file.txt destination_file.txt
    
  3. rm -r: Removes files or directories recursively.

    bashCopy coderm -r directory_name
    
  4. mv: Moves or renames files or directories.

    bashCopy codemv old_name.txt new_name.txt
    

System Navigation

  1. cd /: Changes to the root directory.

    bashCopy codecd /
    
  2. cd dev: Changes to the /dev directory, which contains device files.

    bashCopy codecd /dev
    
  3. cd bin: Changes to the /bin directory, which contains essential binary executables.

    bashCopy codecd /bin
    
  4. cd var: Changes to the /var directory, which contains variable data files.

    bashCopy codecd /var
    

Network Commands

  1. ping: Checks the connectivity to another network host.

    bashCopy codeping google.com
    

User and Group Management

  1. sudo: Executes commands with superuser privileges.

    bashCopy codesudo command
    
  2. whoami: Displays the current logged-in user.

    bashCopy codewhoami
    
  3. adduser: Adds a new user.

    bashCopy codesudo adduser new_username
    
  4. groupadd: Creates a new group.

    bashCopy codesudo groupadd new_group
    
  5. usermod -aG: Adds a user to a group.

    bashCopy codesudo usermod -aG group_name username
    
  6. passwd: Changes the user password.

    bashCopy codesudo passwd username
    

File Permissions

  1. chmod: Changes the file permissions.

    bashCopy codechmod 755 filename
    

Package Management

  1. apt-get install: Installs packages using the APT package manager.

    bashCopy codesudo apt-get install package_name
    
  2. apt-update: Updates the package lists.

    bashCopy codesudo apt-get update
    

Text Editors

  1. vim: Opens the Vim text editor.

    bashCopy codevim filename
    

File Viewing and Searching

  1. cat: Concatenates and displays file content.

    bashCopy codecat filename
    
  2. head: Displays the first few lines of a file.

    bashCopy codehead filename
    
  3. tail: Displays the last few lines of a file.

    bashCopy codetail filename
    
  4. grep: Searches for patterns within files.

    bashCopy codegrep "search_pattern" filename
    
  5. cat /etc/passwd: Displays the contents of the passwd file, which contains user account information.

    bashCopy codecat /etc/passwd
    

Creating and Managing Users and Groups

Creating New Users

To create a new user, use the adduser command followed by the username:

bashCopy codesudo adduser new_username

This command will prompt you to set a password and fill in user details.

Creating New Groups

To create a new group, use the groupadd command followed by the group name:

bashCopy codesudo groupadd new_group

Adding Users to Groups

To add a user to a group, use the usermod command with the -aG option:

bashCopy codesudo usermod -aG group_name username

Changing User Passwords

To change a user's password, use the passwd command followed by the username:

bashCopy codesudo passwd username

Changing File Permissions

To change file permissions, use the chmod command:

Understanding File Permissions

In Linux, file permissions are represented by a set of 10 characters, for example: -rwxr-xr-x.

  • The first character represents the file type (- for regular file, d for directory).

  • The next nine characters represent the permissions, divided into three sets of three characters each:

    • Owner permissions: The first three characters (rwx) specify read (r), write (w), and execute (x) permissions for the file's owner.

    • Group permissions: The middle three characters (r-x) specify read and execute permissions for the group members.

    • Others permissions: The last three characters (r-x) specify read and execute permissions for all other users.

Here's a table summarizing common permission settings:

---

0

No permissions

--x

1

Execute

-w-

2

Write

-wx

3

Write and execute

r--

4

Read

r-x

5

Read and execute

rw-

6

Read and write

rwx

7

Read, write, execute

BinaryNumericDescription
000 000 000000No permissions
000 000 001001Execute only for others
000 000 010002Write only for others
000 000 011003Write and execute for others
000 000 100004Read only for others
000 000 101005Read and execute for others
000 000 110006Read and write for others
000 000 111007Read, write, and execute for others
111 111 111777Read, write, and execute for all
110 110 110666Read and write for all
bashCopy codechmod 755 filename

This command sets the permissions to read, write, and execute for the owner, and read and execute for the group and others.

Conclusion

Today's session provided me with essential skills to navigate and manage a Linux environment, a critical component in DevOps. I learned to access AWS cloud instances, execute basic Linux commands, and manage users and groups. These skills lay a strong foundation for more advanced DevOps practices.

A big thank you to the TrainWithShubhm platform and Shubham Sir for guiding me through this journey. Stay tuned as I continue to dive deeper into the world of DevOps with the TrainWithShubhm platform. Each day promises new insights and skills that will pave the way for a successful career in DevOps.

#TrainWithShubhm #ShubhamSir #90DaysOfDevOps