🚀Day 15: Git, GitHub, and Linux Cheat Sheet for Beginners

·

4 min read

🚀Day 15: Git, GitHub, and Linux Cheat Sheet for Beginners

Table of Contents :

  • ✅Linux Cheatsheet

    • Navigation and File Operations

    • File Permissions

    • System Information

    • Package Management

    • Process Management

    • Networking

    • System Logs

    • Cron Jobs

    • Compression and Archiving

  • ✅Git and GitHub Cheatsheet

    • Git Basics

    • GitHub

  • 🎯Conclusion


✅Linux Cheatsheet:

Navigation and File Operations:

  • ls: List files and directories

  • cd: Change directory

  • pwd: Print working directory

  • mkdir: Make directory

  • touch: Create empty file

  • cp: Copy files or directories

  • mv: Move or rename files or directories

  • rm: Remove files or directories

  • cat: Display file content

  • nano or vi: Text editors for editing files

File Permissions:

  • chmod: Change file permissions

  • chown: Change file ownership

  • chgrp: Change group ownership

System Information:

  • uname -a: Display Linux system information

  • hostname: Show system hostname

  • top or htop: Display system resources and running processes

  • free: Show memory usage

  • df -h: Display disk space usage

Package Management:

  • apt-get (Debian/Ubuntu) or yum (Red Hat/CentOS): Package management commands for installing, updating, and removing software packages

  • apt-cache search or yum search: Search for available packages

  • apt-get update or yum update: Update package lists

  • apt-get install or yum install: Install packages

  • apt-get remove or yum remove: Remove packages

  • apt-get upgrade or yum upgrade: Upgrade installed packages

Process Management:

  • ps: Display information about active processes

  • kill: Terminate processes

  • kill all: Terminate processes by name

  • pgrep: Find processes by name

  • pkill: Send signals to processes by name

Networking:

  • ifconfig or ip addr: Display network interface information

  • ping: Check network connectivity

  • netstat: Display network statistics

  • ssh: Secure Shell for remote access

  • scp: Securely copy files between hosts

  • wget or curl: Download files from the internet

System Logs:

  • tail: Display the last part of a file (e.g., log files)

  • grep: Search for patterns in files or output

  • journalctl: Query and display system journal logs

  • dmesg: Display kernel ring buffer messages

Cron Jobs:

  • crontab -e: Edit cron jobs for scheduling tasks

  • crontab -l: List cron jobs

  • crontab -r: Remove cron jobs

Compression and Archiving:

  • tar: Archive files

  • gzip, bzip2, zip: Compress and decompress files

This cheat sheet covers some essential commands for navigating the filesystem, managing processes, networking, package management, and more. Remember to use man command followed by the command name to get more information about any command.

✅Git and GitHub Cheat sheet:

Git Basics:

  • git init: Initialize a new Git repository locally

  • git clone <repository-url>: Clone a repository from a remote URL

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

  • git commit -m "Commit message": Commit staged changes to the repository

  • git status: Check the status of the working directory and staging area

  • git diff: Show changes between commits, commit and working tree, etc.

  • git log: Display commit history

  • git branch: List, create, or delete branches

  • git checkout <branch-name>: Switch branches or restore working tree files

  • git merge <branch-name>: Merge changes from one branch into another

  • git pull: Fetch from and integrate with another repository or a local branch

  • git push: Update remote repository with local commits

  • git remote -v: List remote repositories and their URLs

  • git fetch: Download objects and refs from another repository

  • git reset: Reset current HEAD to the specified state

  • git revert: Revert some existing commits

  • git stash: Stash changes in the working directory

GitHub:

  • git remote add origin <repository-url>: Add a remote repository URL named 'origin'

  • git push -u origin <branch-name>: Push the local branch to the remote repository

  • Pull Requests (PRs): Create, review, and merge code changes via GitHub's Pull Request feature

  • Issues: Create, assign, and manage issues to track bugs, tasks, and enhancements

  • Branch Protection: Configure rules to enforce quality checks and prevent force-pushes on specific branches

  • Webhooks: Set up event-driven automation by configuring webhooks to trigger actions in response to repository events

  • GitHub Actions: Automate workflows, build, test, and deploy code using GitHub Actions

Conclusion 🎉

Understanding and mastering Linux commands alongside Git and GitHub is essential for any DevOps engineer. This cheat sheet aims to provide a comprehensive yet easy-to-follow guide to help you navigate the basics efficiently. Whether it's managing files, permissions, processes, or repositories, these commands form the backbone of daily operations in a DevOps environment.

Happy Learning! 🚀

Â