Day 12 - DevOps Mastery Cheatsheet  (Dec 8, 2023)

Day 12 - DevOps Mastery Cheatsheet (Dec 8, 2023)

Linux Commands

Navigation

  • cd [directory]: Change directory. Move to the specified directory.

  • ls: List files and directories. Display the contents of the current directory.

  • pwd: Print working directory. Show the current working directory's full path.

File Operations

  • touch [filename]: Create a new file. Generates an empty file with the specified name.

  • cp [source] [destination]: Copy file or directory. Duplicate a file or directory to a specified location.

  • mv [source] [destination]: Move or rename file or directory. Move a file or directory to a new location or rename it.

  • rm [file]: Remove/delete file. Delete a file permanently.

Text Manipulation

  • cat [file]: Display content of a file. Output the content of a file to the terminal.

  • grep [pattern] [file]: Search for a pattern in a file. Find and display lines matching a specified pattern in a file.

  • echo [text] > [file]: Create or overwrite content in a file. Write text to a file, overwriting existing content.

  • nano [file]: Open a text editor. Launch the Nano text editor to create or edit files.

File Permissions

  • chmod [permissions] [file]: Change file permissions. Modify the access permissions of a file.

  • chown [owner]:[group] [file]: Change file owner and group. Assign a new owner and group to a file.

Process Management

  • ps: Display running processes. Show a snapshot of the currently running processes.

  • kill [PID]: Terminate a process. End a running process using its Process ID.

Git-GitHub Commands

Repository Basics

  • git init: Initialize a new Git repository. Start a new Git project in the current directory.

  • git clone [repository]: Clone a repository. Copy a remote repository to the local machine.

  • git status: Show the status of changes. Display the current state of the working directory.

Making Changes

  • git add [file]: Add changes to the staging area. Stage modifications for the next commit.

  • git commit -m "[message]": Commit changes with a message. Record changes to the repository with a descriptive message.

Branching

  • git branch: List branches. Display a list of all branches in the repository.

  • git checkout [branch]: Switch to a branch. Change to the specified branch.

  • git merge [branch]: Merge changes from a branch. Combine changes from the specified branch into the current branch.

Remote Collaboration

  • git remote add origin [remote repository]: Add a remote repository. Set a remote repository for the project.

  • git push -u origin [branch]: Push changes to a remote repository. Upload local branch changes to the remote repository.

  • git pull origin [branch]: Pull changes from a remote repository. Retrieve changes from the remote repository and merge them into the local branch.