#Day 12 - Linux & GitHub Cheatsheet

Passionate AWS Developer | DevOps Engineer with a strong background in cloud architecture and solutions engineering. Leveraging the power of Amazon Web Services (AWS), knowledge of the AWS global infrastructure, design and implement robust cloud-based solutions that align with clients' specific needs.
File and Directory Operations:
ls: List files and directories in the current directory.cd: Change the current directory.pwd: Print the current working directory.touch: Create an empty file.mkdir: Create a new directory.rm: Remove files or directories.cp: Copy files or directories.mv: Move or rename files or directories.
File Viewing and Editing:
cat: Concatenate and display the contents of a file.moreorless: View text files page by page.headandtail: Display the beginning or end of a file.nano,vim, oremacs: Text editors to create and edit files.
File Permissions:
chmod: Change file permissions.chown: Change file ownership.chgrp: Change group ownership of files.
File Searching:
find: Search for files and directories.grep: Search for text patterns in files.locate: Quickly find files by name.
Process Management:
ps: List running processes.toporhtop: Display real-time system information and process usage.kill: Terminate processes.killall: Terminate processes by name.
User and Group Management:
useradd: Add a new user.passwd: Change a user's password.groupadd: Add a new group.usermod: Modify user settings.
Networking:
ifconfigorip: Display or configure network interfaces.ping: Test network connectivity to a host.ssh: Securely log into a remote server.scp: Securely copy files between systems.curlorwget: Download files from the internet.
Compression and Archiving:
tar: Create and extract archive files.gziporgunzip: Compress or decompress files.zipandunzip: Create and extract ZIP archives.
System Information:
uname: Display system information.df: Display disk space usage.free: Display memory usage.lscpu: Display CPU information.
Package Management:
apt-getorapt(Debian/Ubuntu): Package management commands.yum(Red Hat/Fedora): Package management commands.
GitHub is a web-based platform for version control using Git. To interact with GitHub repositories from the command line, you'll use Git commands in conjunction with GitHub-specific commands. Here are some common GitHub commands:
Cloning a Repository:
To clone a GitHub repository to your local machine:
git clone <repository_url>
Configuring Git:
Set your Git username:
git config --global user.name "Your Name"Set your Git email address:
git config --global user.email "youremail@example.com"
Creating a New Repository on GitHub:
- You can create a new GitHub repository using the GitHub website. There's no direct command-line equivalent for this action.
Adding and Committing Changes:
After making changes to your local repository, you can use Git commands to commit your changes:
git add . git commit -m "Your commit message here"
Pushing Changes to GitHub:
To push your local changes to a GitHub repository:
git push origin <branch_name>
Pulling Changes from GitHub:
To update your local repository with changes from the remote GitHub repository:
git pull origin <branch_name>
Creating a New Branch:
To create a new branch in your local repository:
git checkout -b <new_branch_name>
Switching Branches:
To switch between branches in your local repository:
git checkout <branch_name>
Merging Changes:
To merge changes from one branch into another:
git checkout <target_branch> git merge <source_branch>
Creating Pull Requests:
- You can create pull requests on the GitHub website. There's no direct command-line equivalent for this action.
Viewing Repository Information:
To view information about a remote GitHub repository:
git remote -v
Managing Git Credentials:
GitHub provides a credential helper to store your credentials securely. You can use the following command to enable the credential helper:
git credential reject
These commands assume that you have already set up a connection to a GitHub repository, which typically involves using your GitHub username and an access token or SSH key for authentication. Please note that some actions, like creating repositories or pull requests, are typically performed through the GitHub web interface.
For more detailed information on using Git and GitHub together, consult the GitHub documentation: https://docs.github.com/en/github.



