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 directoriescd
: Change directorypwd
: Print working directorymkdir
: Make directorytouch
: Create empty filecp
: Copy files or directoriesmv
: Move or rename files or directoriesrm
: Remove files or directoriescat
: Display file contentnano
orvi
: Text editors for editing files
File Permissions:
chmod
: Change file permissionschown
: Change file ownershipchgrp
: Change group ownership
System Information:
uname -a
: Display Linux system informationhostname
: Show system hostnametop
orhtop
: Display system resources and running processesfree
: Show memory usagedf -h
: Display disk space usage
Package Management:
apt-get
(Debian/Ubuntu) oryum
(Red Hat/CentOS): Package management commands for installing, updating, and removing software packagesapt-cache search
oryum search
: Search for available packagesapt-get update
oryum update
: Update package listsapt-get install
oryum install
: Install packagesapt-get remove
oryum remove
: Remove packagesapt-get upgrade
oryum upgrade
: Upgrade installed packages
Process Management:
ps
: Display information about active processeskill
: Terminate processeskill all
: Terminate processes by namepgrep
: Find processes by namepkill
: Send signals to processes by name
Networking:
ifconfig
orip addr
: Display network interface informationping
: Check network connectivitynetstat
: Display network statisticsssh
: Secure Shell for remote accessscp
: Securely copy files between hostswget
orcurl
: 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 outputjournalctl
: Query and display system journal logsdmesg
: Display kernel ring buffer messages
Cron Jobs:
crontab -e
: Edit cron jobs for scheduling taskscrontab -l
: List cron jobscrontab -r
: Remove cron jobs
Compression and Archiving:
tar
: Archive filesgzip
,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 locallygit clone <repository-url>
: Clone a repository from a remote URLgit add <file>
: Add file changes to the staging areagit commit -m "Commit message"
: Commit staged changes to the repositorygit status
: Check the status of the working directory and staging areagit diff
: Show changes between commits, commit and working tree, etc.git log
: Display commit historygit branch
: List, create, or delete branchesgit checkout <branch-name>
: Switch branches or restore working tree filesgit merge <branch-name>
: Merge changes from one branch into anothergit pull
: Fetch from and integrate with another repository or a local branchgit push
: Update remote repository with local commitsgit remote -v
: List remote repositories and their URLsgit fetch
: Download objects and refs from another repositorygit reset
: Reset current HEAD to the specified stategit revert
: Revert some existing commitsgit 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 repositoryPull 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! 🚀