Linux Cheat Sheet
Linux is a free and open-source operating system that is widely used for a variety of tasks, from web servers to desktop computers. Here are some commonly used Linux commands to get you started:
File Management
ls: List the files in the current directory
cd: Change the current directory
mkdir: Create a new directory
touch: Create a new file
cp: Copy a file
mv: Move a file
rm: Remove a file
chmod: Change the permissions of a file or directory
chown: Change the owner and group of a file or directory
ln: Create a symbolic link
rmdir: Remove an empty directory
System Information
uname -a: Display system information
df: Display disk space usage
top: Display the processes running on the system
free: Display memory usage information
uptime: Display the system uptime
vmstat: Display virtual memory statistics
htop: A more advanced version of top
iostat: Display input/output statistics
User Management
whoami: Display the current user
sudo: Execute a command as the root user
adduser: Add a new user
passwd: Change the password for the current user
useradd: Add a new user
userdel: Delete a user
usermod: Modify a user account
groups: Display the groups a user belongs to
Process Management
ps: List the processes running on the system
kill: Terminate a process
bg: Run a process in the background
fg: Bring a background process to the foreground
killall: Terminate all processes with a specific name
jobs: Display the jobs in the current shell session
nohup: Run a command immune to hangups
Text Processing
grep: Search for a string in a file
sed: Stream editor for filtering and transforming text
awk: A powerful text processing tool
cut: Cut out specific fields from a file
awk: A powerful text processing tool
sort: Sort the contents of a file
uniq: Remove duplicate lines from a file
Networking
ping: Test the connection to a network host
ifconfig: Display network interface information
nslookup: Query the DNS for a host name or IP address
netstat: Display network connections and information
route: Display or manipulate the IP routing table
traceroute: Trace the route to a network host
host: Query a DNS server for information
Git/GitHub Cheat Sheet
Git is a popular version control system for software development, and GitHub is a web-based platform for hosting Git repositories. Here are some commonly used Git and GitHub commands to get you started:
Git Commands
git init: Initialize a new Git repository
git clone: Clone an existing repository
git add: Add files to the staging area
git commit: Save changes to the repository
git push: Push changes to a remote repository
git pull: Pull changes from a remote repository
git branch: Manage branches in a Git repository
git checkout: Switch between branches in a Git repository
git merge: Merge two branches together
git diff: View the differences between two sets of files
git log: View the commit history of a Git repository
git status: Check the status of the current repository
git rm: Remove files from the repository
git stash: Temporarily save changes that are not yet ready to be committed
git tag: Tag specific commits in the repository
git revert: Revert changes to a previous commit
git reset: Reset the repository to a specific commit
GitHub Commands
gh repo create: Create a new repository on GitHub
gh repo fork: Fork an existing repository on GitHub
gh issue create: Create a new issue on GitHub
gh pull-request create: Create a new pull request on GitHub
With these commands, you should have a good starting point for using Linux and Git/GitHub. Remember, there's always more to learn and discover, so feel free to dive deeper and explore all that these powerful tools have to offer.
"Bringing Linux and GitHub Together: A Step-by-Step Guide to Setting Up Your First Repository"
GitHub is a popular platform for version control and collaborative software development. By connecting your Linux system to GitHub, you can easily store, manage, and track changes to your code. In this article, we will guide you through the process of creating a GitHub account, creating a repository, and making your first commits and pushes to the repository.
Step 1: Create a GitHub Account
To start, you will need to create a GitHub account. Go to the GitHub website and sign up for a free account by entering your email address and choosing a username and password.
Step 2: Create a GitHub Repository
Once you have created your GitHub account, you can create a new repository. A repository is a location where you can store your code and track changes to it over time. To create a new repository, click the "New repository" button on your GitHub dashboard. Give your repository a name, a description (optional), and select the repository visibility (public or private).
Step 3: Connect Your Linux System to GitHub
To connect your Linux system to GitHub, you need to install Git, the version control system that GitHub uses. If you don't already have Git installed on your system, you can install it using your Linux distribution's package manager. For example, on Ubuntu, you can install Git using the following command:
sudo apt-get install git
Step 4: Configure Git on Your Linux System
Once you have installed Git, you need to configure it with your GitHub username and email. You can do this using the following commands:
git config --global user.name "Your GitHub username"
git config --global user.email "Your GitHub email address"
Step 5: Clone the Repository to Your Linux System
With Git configured, you can now clone your repository to your Linux system. A clone is a local copy of your repository that you can work with. To clone your repository, use the following command, replacing <repo_name> with the name of your repository:
git clone https://github.com/<username>/<repo_name>.git
Step 6: Make Your First Commit and Push to GitHub
Now that you have a local copy of your repository, you can make changes to it and push those changes back to GitHub. To make a change, open the repository in your favorite text editor, make the change, and save the file. Then, use the following commands to add the change, commit the change, and push the change to GitHub:
git add <filename> git commit -m "Your commit message" git push
And that's it! You have successfully connected your Linux system to GitHub, created a repository, and made your first commit and push. With these basic steps, you can now use GitHub to manage and track changes to your code, collaborate with others, and share your projects with the world.