Skip to main content

Command Palette

Search for a command to run...

Day 12 Task : Cheat Sheet Of Linux and Git Hub

Published
4 min read
Day 12 Task : Cheat Sheet Of Linux and Git Hub

Basics Linux commands

· pwd — Print Working Directory, It will show the path of the current working directory.

· man — Used to display the user manual of any command that we can run on the terminal.

· clear — Clear the terminal screen.

· history — Displays a list of commands used in the terminal session

Command for Directories

· ls — List the Directories and files available in the respective directory.

· cd — Change of directory

mkdir — Make new directory

rmdir — Remove empty directories

Commands for files

· Touch — Change file timestamps or to create an empty file.

· Cat — The cat command is mainly used to read and concatenate files, but it can also be used for creating new files.

· Nano — To create and open a new file**.**

· Vi — Editor tool is an interactive tool as it displays changes made in the file on the screen while you edit the file.

· rm — To remove a file.

· cp — To copy a file or directory.

· mv — To move a file or to rename a file.

· Chmod command : Used to change the users permission of file/directory

Command for file Content

· Head - 10 — Output the first 10 lines of a file.

· Tail -10 — Output the last 10 lines of a file.

· echo — Display a line text.

· more — It will shows file content in partwise & in bottom of screen will show how much % text is there in screen.

· less — Opposite of more command.

Command for system information

· uptime — Tell how long the system has been running.

· free — Display amount of free & used memory in the system.

· ps — Report a snapshot of the current process.

User Permissions

· sudo — acronym for superuser do or substitute user do**,** mostly used for to running programs with the security privileges of another user.

· useradd — useradd is used to create a new account.

· passwd : passwd is used to add new password.

· sudo passwd -l ‘username’ — To change password for particular user.

Command for hard disk

· df — Report file system disk space.

· fdisk — Manipulate disk partition table.

· lsblk — Display details about block devices.

· top — Display linux processe .

Git basics

· git init — Create new local repository.

· git clone <Url> — Clone existing remote repository.

· git add — stage all changes.

· git status — List all new /modified files to be committed.

· git commit -m <message> — Commit staged Changes to local repository.

· git push — Push local commits to remove repository.

· git pull — Download & merge commits from remote repository.

· git log — List version history of current branch.

· git config — global user.name <name> — To set a username.

· git config — global user.email <mail id> — To set a user email.

· git config — list — TO check user configuration details.

Git Branches

· git branch — List all the local branch in current repo.

· git checkout -b <branch-name> — Creates a new branch.

·git checkout <branch-name> — Switch to specified branch & update working directory.

· git merge <branch-name> — Combine specified branch’s history into current branch.

· git stash — To pop the temporarily stacked changes with above command.

· git stash pop -To check order stack-order of stashed file.

· git revert /git reset — To reapply commits on top of another base trip.

· git rebase <base> -List all currently configured remote repositories.

Git Advanced

· git fetch <bookmark> — Download all history from repository bookmark.

· git remote add <alias-name> <url> — Add remote repository url as an alias

· git push <alias> <branch-name> — Push local commit to remote repository.

·git rest <commit> — Undoes all commits after commit, preserving changes locally.

· git reset –hard <commit> — Discard all history and changes back to specified commit.

More from this blog

DevOps

19 posts