Day 14 of My 90-Day DevOps Challenge: Linux Commands Cheat Sheet π§π
π Linux Cheat Sheet π
Linux is the backbone of most cloud and DevOps environments. Mastering basic and advanced Linux commands is essential for system administration, scripting, and automation. Below is your go-to cheat sheet with all the Linux commands from basic to advanced.
1. File and Directory Management
ls
: Lists files and directories. πcd [directory]
: Changes to the specified directory. πmkdir [directory]
: Creates a new directory. ποΈrm [file]
: Removes a file. ποΈrm -r [directory]
: Removes a directory and its contents. π§Ήtouch [file]
: Creates a new, empty file. πcp [source] [destination]
: Copies files or directories. πmv [source] [destination]
: Moves or renames files or directories. π
2. Permissions and Ownership ππ₯
chmod [permissions] [file]
: Changes file or directory permissions.chown [user]:[group] [file]
: Changes the owner and group of a file.ls -l
: Lists files with detailed information, including permissions.
3. System Information π₯οΈπ
uname -a
: Displays system information.top
: Shows running processes and system resource usage.df -h
: Displays disk space usage in human-readable format.free -h
: Shows memory usage.
4. Networking ππ‘
ping [hostname]
: Sends ICMP echo requests to test network connectivity.ifconfig
: Displays network interface configurations.netstat -tuln
: Lists open ports and network services.
Git & GitHub Commands Cheat Sheet ππ
1. Basic Git Commands π οΈ
git init
: Initializes a new Git repository.git clone [repository_url]
: Clones an existing repository.git status
: Shows the status of the working directory and staging area.git add [file]
: Adds files to the staging area.git commit -m "[message]"
: Commits staged changes with a message.
2.Branching & Merging πΏπ
git branch
: Lists all branches.git branch [branch_name]
: Creates a new branch.git checkout [branch_name]
: Switches to the specified branch.git merge [branch_name]
: Merges the specified branch into the current branch.
3. GitHub Collaboration π€π»
git push origin [branch_name]
: Pushes local changes to the remote repository.git pull origin [branch_name]
: Fetches and merges changes from the remote repository.git fetch
: Downloads changes from the remote but doesn't merge them.
4. Tagging & Releases π·οΈπ
git tag [tag_name]
: Creates a new tag.git push origin [tag_name]
: Pushes a tag to the remote repository.π Conclusion
Mastering Linux and Git-GitHub commands is fundamental for any DevOps engineer. Whether youβre building pipelines, deploying applications, or collaborating on open-source projects, having these commands at your fingertips will make your workflow smoother and more efficient.
By using this cheat sheet, you can:
Automate system administration tasks using Linux.
Manage source code efficiently with Git.
Collaborate and deploy code to GitHub with ease.
Happy learning and coding! π