Linux Commands
Linux-Base
# : root user
$ : normal users
/ : root directory
~ : home directory
man : access manual pages for all Linux commands
uname : show name of kernel (OS)
uname -r : show version of kernel
clear : clear screen
whoami : show currently login user name
history : show list of previously used commands
date : show time and date
cal : show this month's calendar
lastlog : details of a recent login of all users
df : shows the amount of free space on a file system
head : shows the top N lines of the file (maximum 10)
tail : shows the bottom N lines of the file (maximum 10)
cd ~ or cd : change the directory to the home directory
cd - : Go to the last working directory.
cd .. : change the directory to one step back
cd ../.. : Change directory to 2 levels back
users : display the username of all users currently logged on the system
useradd : add new user
usermod : change existing users details
Chmod : change the access permissions of files and directories
Chown : change the file Owner or group
passwd : change the password for user
userdel & groupdel: to delete the user & group
Network
ping : check the connectivity of host
sudo : allows regular users to run programs with the security privileges of the superuser
ssh : secure shell command
ftp : Opens an ftp connection to a host
File management
ls : long listing format of the files and directories with extra information
pwd : present working directory
touch : to create a file
mkdir : to make a directory in a specific location
rm & rmdir : used to remove a file & directory
cp : copy files from one directory to another
mv : move or rename files
cat : view the content inside the file
echo : print any text
grep : Searches for a pattern in a file or a stream of text
find : Searches for files and directories
awk : Processes text files and data streams
diff : find the difference between files
mount : mount file systems
umount : unmount file systems
vim or nano : to create a file and edit it
service : to start and stop services
tar : creates and extracts archive files
gzip : compresses and decompresses files
unzip : uncompresses archive files
crontab : schedules commands (specially backup) to be executed automatically
apt,pacman,yum,rpm: package managers used for diff. linux flavors
Process Management
ps : shows the running processes
kill : kill active processes by process ID or name
top : view active processes live with their system usage
Don't stop guys, let's go for the Git sheet!!
Git download for the system: git-scm.com/downloads
How to check its version : git --version
Git Commands
(Basic and Advanced)
Manage Repository
git init : initialize an empty Git repository
git clone <url> : cloning/copying an existing Git repository via URL
git remote add origin <remote_git_url> : add remote origin url
git remote remove origin : delete remote origin url
git remote -v : shows remote repository url's
Setup for Git users
Configuring user information across local repositories
git config --global user.name "<user_name>" : set global username
git config --global user.email "<email_address>" : set global email
git config --global color.ui auto : set automatic command line coloring
Staging & Snapshot
Working with snapshots and the Git staging area
git status : shows the status of git repository, no untracked files
git add <file_name> : adding files(untracked) into files(staged) of current branch
git add . : add all current directory files(untracked) of current branch
git commit -m "<message>" : commit all staged files of curent branch
Branch & merge
git branch : shows all branches with * at active branch
git branch <branch_name> : creates a branch without switching to it
git checkout -b <branch_name> : creates a new branch and switch to that new branch
git switch <branch_name> : swithces to another branch from current branch
git checkout <branch_name> : switches to another branch form current branch
git branch -d <branch_name> : removes a branch from git
git branch -D <branch_name> : force or confirm the deletion of a branch from git
git merge <branch_name> : merges changes from another branch into the current branch
git rebase <branch_name> :
Synchronize with Git Repo
git fetch : fetch all the remote branches
git push origin <branch_name> : push local changes to remote branch
git pull origin <branch_name> : pull remote changes to local branch
Git-Logs
git log : shows logs of current branch events with more info
git log --oneline : shows logs of branch events in one line
git reflog : shows logs in simple way
Conflicts resolution
git log --merge : produce the list of commits which causing the conflict
git diff : identifies difference between the states repository or files
git checkout : undo the changes made to the file
git reset --mixed : undo changes to the working directory and staging area
git reset : undo local changes to the state of a Git repo.
git reset --hard : resets the current branch tip, and also deletes any changes in the working directory and staging area
git merge --abort : exit from merging process and return to the step before merging starts
git revert <commit hash>: rolls back to previous commit on current branch
git restore <file_name> : brings back deleted files(committed)
Stashing
git stash : takes uncommitted changes (both staged and unstaged), saves it for later, and then reverts them from working copy.
git stash list : shows list of stashed items
git stash apply : saves the uncommitted changes locally, allowing you to make changes, switch branches, and perform other Git operations
git stash clear : clear the stashed items
git stash pop : popping an item from stash
git stash drop : delete most recent stash
Cherrypick & squash
git cherry-pick : picking one commit from one branch to another & also useful for undoing changes
git squash : combines multiple commits into one
Thanks for watching and learning with patience with me!!
Also for your valuable time.
Keep hustling, learning and staying healthy.