Table of contents
Git Cheatsheet
Command | Description |
git init | Initialize a new git repository |
git clone [url] | Clone a remote repository |
git status | Check the status of the repository |
git add [file] | Add changes to the staging area |
git commit -m "[message]" | Commit changes with a message |
git push [remote] [branch] | Push changes to a remote repository |
git pull [remote] [branch] | Pull changes from a remote repository |
git branch | List all local branches |
git branch [name] | Create a new branch |
git checkout [name] | Switch to a different branch |
git merge [branch] | Merge changes from another branch |
git log | Show commit history |
git reset --hard [commit] | Reset the repository to a previous commit |
git revert [commit] | Create a new commit that reverses the changes of a previous commit |
git stash | Save changes without committing |
git stash apply | Apply the saved changes |
git tag [name] | Create a new tag for a commit |
git remote add [name] [url] | Add a new remote repository |
git remote -v | List all remote repositories |
git remote set-url [name] [new-url] | Change the URL of a remote repository |
Linux cheatsheet
Command | Description | Examples |
cd | Change directory | cd /home/user/ , cd .. |
ls | List directory contents | ls , ls -l , ls -a |
mkdir | Create a new directory | mkdir new_dir |
rmdir | Remove a directory | rmdir dir_to_remove |
rm | Remove files | rm file_to_remove , rm -r dir_to_remove |
cp | Copy files/directories | cp file_to_copy new_file , cp -r dir_to_copy new_dir |
mv | Move/rename files/directories | mv old_file new_file , mv dir_to_rename new_dir_name |
touch | Create an empty file or update modification time of a file | touch new_file , touch existing_file |
cat | Display contents of a file | cat file_to_display |
head | Display first few lines of a file | head file_to_display |
tail | Display last few lines of a file | tail file_to_display |
grep | Search for a pattern in a file | grep "pattern" file_to_search , grep -i "pattern" file_to_search |
ps | Display information about active processes | ps , ps -ef |
top | Display information about active processes in real-time | top |
kill | Terminate a process | kill process_id , kill -9 process_id |
chmod | Change permissions of a file/directory | chmod u+x file_to_modify , chmod 755 dir_to_modify |
sudo | Execute a command with superuser privileges | sudo command_to_execute |
ping | Test network connectivity | ping host_to_ping |
ifconfig | Display network interface information | ifconfig |
ssh | Connect to a remote system over SSH | ssh user@host |
Advanced Linux
Command | Description |
awk | A programming language used for text processing and data extraction |
sed | A stream editor used for manipulating text |
grep | Searches for a pattern in a file or input |
find | Searches for files and directories in a specified location |
xargs | Executes commands based on standard input arguments |
cut | Cuts specified columns from a file |
sort | Sorts a file |
uniq | Filters out repeated lines in a file |
tar | Compresses and archives multiple files |
gzip | Compresses a single file |
zip | Compresses and archives multiple files |
dd | Copies and converts data from one file or block device to another |
screen | A terminal multiplexer that allows multiple sessions in a single terminal window |
cron | A scheduling daemon that executes commands at specified intervals |