Day 12: Linux and Git Commands for DevOps Engineers

90DaysOfDevOps

·

3 min read

Day 12: Linux and Git Commands for DevOps Engineers

Now that we have completed the Linux & Git-GitHub hands-on in the last 11 days, let's make a cheat sheet of all the commands we have used so far.

Linux Commands -

  1. Navigating the File System:

    • pwd: Print the current working directory.

    • ls: List files and directories.

    • cd: Change the current directory.

    • mkdir: Create a new directory.

    • rm: Remove files or directories.

    • cp: Copy files or directories.

    • mv: Move or rename files or directories.

  2. Viewing and Editing Files:

    • cat: Display the contents of a file.

    • less: View file contents interactively.

    • nano or vim: Text editors for editing files.

    • head: Display the beginning of a file.

    • tail: Display the end of a file.

  3. File Permissions:

    • chmod: Change file permissions.

    • chown: Change file ownership.

  4. Processes and System Management:

    • ps: Display information about processes.

    • top or htop: Monitor system processes interactively.

    • kill: Terminate processes.

    • shutdown or reboot: Shutdown or restart the system.

  5. Networking:

    • ifconfig or ip: Display or configure network interfaces.

    • ping: Send ICMP echo requests to a host.

    • ssh: Securely access remote systems over SSH.

    • netstat or ss: Display network statistics.

  6. Package Management:

    • apt (Debian/Ubuntu) or yum (Red Hat/Fedora): Package management tools for installing, updating, and removing software packages.

    • dpkg (Debian/Ubuntu) or rpm (Red Hat/Fedora): Direct package management tools.

  7. File Compression and Archiving:

    • tar: Create, extract, and manipulate archive files.

    • gzip or gunzip: Compress or decompress files.

    • zip or unzip: Compress or extract files in ZIP format.

  8. User Management:

    • useradd: Add a new user.

    • passwd: Change user password.

    • usermod: Modify user properties.

    • userdel: Delete a user.

  9. Disk and Storage Management:

    • df: Display disk space usage.

    • du: Display file and directory space usage.

    • mount and umount: Mount and unmount filesystems.

Git-GitHub commands -

  1. Setting up Git:

  2. Creating Repositories:

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

    • git clone <repository_url>: Clone a remote repository to your local machine.

  3. Managing Changes:

    • git add <file>: Add a file to the staging area.

    • git commit -m "Commit message": Commit staged changes with a message.

    • git diff: Show the changes between working directory and staging area.

    • git diff --staged: Show the changes between staging area and last commit.

  4. Branching and Merging:

    • git branch: List all branches in the repository.

    • git branch <branch_name>: Create a new branch.

    • git checkout <branch_name>: Switch to a different branch.

    • git merge <branch_name>: Merge changes from one branch into another.

  5. Updating and Publishing:

    • git pull: Fetch and merge changes from a remote repository.

    • git push origin <branch_name>: Push local changes to a remote repository.

  6. Viewing History:

    • git log: Display commit history.

    • git log --oneline: Display a single commit history.

  7. Stashing Changes:

    • git stash: Temporarily save changes that are not ready to be committed.

    • git stash apply: Apply the most recent stash.

GitHub Commands:

  1. Managing Remote Repositories:

    • git remote -v: List remote repositories.

    • git remote add origin <repository_url>: Add a remote repository named "origin".

    • git push -u origin <branch_name>: Push and set the upstream branch.

    • git cherry-pick commit_id : To select specific commits from one branch and apply them to another branch.

Thank you for taking the time to read this blog.