Day:12 Task:
Linux, Git, GitHub Command

Day:12 Task: Linux, Git, GitHub Command

Let's go through some Linux, Git, and Git-Hub useful Command

What is the command?

A command is a specific instruction given to a computer application to perform some kind of task or function.

Linux Commands:

  1. ls - The most frequently used command in Linux to list directories

    Syntax: ls

  2. pwd - Print working directory command in Linux

    Syntax: pwd

  3. cd - Linux command to navigate through directories

    Syntax: cd [dir-name]

  4. mkdir - Command used to create directories in Linux

    Syntax: mkdir [new-dir-name]

  5. rmdir - Command used to permanently delete an empty directory

    Syntax: rmdir [dir-name]

  6. mv - Move or rename files in Linux

    Syntax: mv [source] [destination]

  7. cp - Similar usage as mv but for copying files in Linux

    Syntax: cp <source> <destination>

  8. rm - Delete files or directories

    Syntax: rm [file/dir-name]

  9. touch - Create blank/empty files

    Syntax: touch [new-file-name]

  10. ln - Create symbolic links (shortcuts) to other files

    Syntax: ln [target-file] [link-name]

  11. cat - Display file contents on the terminal

    Syntax: cat [file-name]

  12. clear - Clear the terminal display

    Syntax: clear or keyboard key cnt+l

  13. echo - Print any text that follows the command

    Syntax: echo "text"

  14. less - Linux command to display paged outputs in the terminal

    Syntax: less [file-name]

  15. man - Access manual pages for all Linux commands

    Syntax: man [command-name]

  16. uname - Linux command to get basic information about the OS

    Syntax: uname

  17. whoami - Get the active username

    Syntax: whoami

  18. tar - Command to extract and compress files in Linux

    Syantx: tar [options] [archive-file]

  19. grep - Search for a string within an output

    Syntax: grep [pattern] [file-name]

  20. head - Return the specified number of lines from the top

    Syantx: head [file-name]

  21. tail - Return the specified number of lines from the bottom

    Syantx: tail [file-name]

  22. diff - Find the difference between two files

    Syantx: diff [file-name-1] [file-name-2]

  23. cmp - Allows you to check if two files are identical

    Syantx: cmp [file-name-1] [file-name-2]

  24. comm - Combines the functionality of diff and cmp

    Syantx: comm [file-name-1] [file-name-2]

  25. sort - Linux command to sort the content of a file while outputting

    Syantx: sort [file-name]

  26. export - is bash shell BUILTINS commands, which means it is part of the shell. It marks an environment variables to be exported to child processes.

    Syantx: export name[=value]

  27. zip - To create a zip files in Linux

    Syntax: zip [options] zip file files_list

  28. unzip - Unzip files in Linux

    Syntax: unzip [zip-file-name]

  29. ssh - Secure Shell command used in Linux to connect remote server

    Syntax: ssh -i [key-name] user_name@host(IP/Domain_name)

  30. service - Linux command to start and stop services

    Syntax: service [service-name] [start/stop/status/enable]

  31. ps - Display active processes

    Syntax: ps

  32. kill and killall - Kill active processes by process ID or name

    Syntax: ps [Process-ID/name]

  33. df - Display disk filesystem information

    Syntax: Syntax: df

  34. mount - Mount file systems in Linux

    Syntax: mount -t [type] [device dir]

  35. chmod - Command to change file permissions

    Syantx: chmod [permissions] [file-name]

  36. chown - Command for granting ownership of files or folders

    Syantx [chown owner_name] [file_name]

  37. ifconfig - Display network interfaces and IP addresses

    Syantx ifconfig

  38. traceroute - Trace all the network hops to reach the destination

    Syantx traceroute [route]

  39. wget/curl - Direct download files from the internet

    Syantx: weget/curl [request-url]

  40. ufw - Firewall command

    Syantx: ufw [allow] [port]

  41. iptables - Base firewall for all other firewall utilities to interface with

  42. apt, pacman, yum, rpm - Package managers depending on the distro

    Syntax: sudo apt/pacman/yum/rpm

  43. sudo - Command to escalate privileges in Linux

    Syantx: sudo

  44. cal - View a command-line calendar

    Syantx: cal

  45. alias - Create custom shortcuts for your regularly used commands

    Syantx: alias [name]=[value]

  46. dd - Majorly used for creating bootable USB sticks

  47. whereis - Locate the binary, source, and manual pages for a command

    Syntax: whereis [file-name]

  48. whatis - Find what a command is used for

    Syantx: whatis [command-name]

  49. top - View active processes live with their system usage

    Syantx: top

  50. useradd and usermod - Add a new user or change existing users data

    Syantx: sudo useradd [new-user-name]

    Syantx: sudo usermod [change-data]

  51. passwd - Create or update passwords for existing users

    Syantx: sudo passwd [user-name]

Git And GitHub Commands:

  1. git config: It is used to set the name of the author and the email address which you want your commitment to addressing.

    Syntax: git config –global user.name “[user-name]”

    Syntax: git config –global user.email “[email address]”

  2. git init: It is used to start a new git repository. This is generally used at the beginning.

    Syntax: git init [repo name]

  3. git clone: This command is used to clone or copy a repository from a URL. This URL generally is a GitHub, bitbucket server, a stash, or any other version control and source code management repository holding service.

    Syntax: git clone [URL]

  4. git add: It is used to add a file to the staging area. Instead of choosing a single file name, you can also choose to give all filenames with an *.

    Syntax: git add (filename)

    Syntax: git add *

  5. git commit –m: It is used to snapshot or record/save a file in its version history permanently.

    Giving a message text at the end of the commit command helps in identifying the details about the commit code.

    Syntax: git commit –m [type in a message]

  6. git commit –a: This commit command is used to commit any such file which has been added as a result of the git add command. It is also responsible for committing any other files to which you have brought a change to since then.

    Syntax: git commit -a

  7. git diff: As the name suggests, this command is used to display all the differences between the files until the changes have not yet been staged.

    Syntax: git git diff

  8. git diff –staged: It is used to display all the differences between staging area files and the latest version, which might be present.

    Syntax: git diff -staged

  9. git diff [first branch] [second branch]: This is a very effective command as it is used to display the differences present between the two branches.

    Syntax: git diff [first branch] [second branch]

  10. git diff [commit-id-1] [commit-id-2]: This is a very effective command as it is used to display the differences present between the two commits.

    Syntax: git diff [commit-id-1] [commit-id-2]

  11. git reset [file]: This command, as the name suggests, is used to unstage a file. Even though it unstages the file, still the contents of the file have stayed intact.

    Syntax: git reset [file]

  12. Git reset [commit]: It is used to undo all the changes that have been incorporated as a part of a commit after a specified commit has taken place. This helps in saving the changes locally on the computer.

    Syntax: git reset [commit]

  13. Git reset –hard [commit]: This command is used to discard all the history and takes us to the last specified commit.

    git reset –hard [commit]

  14. Git status: This is one of the most frequently used as this is used to list down all the files which are ready to be committed.

    git status

  15. Git rm: As in Unix, rm is used to remove; in the same way, rm is used to delete the file from the present working directory and is also used to stage the deletion process.

    Syntax: git rm [file]

  16. Git log: This is used for listing down the version history for the current working branch.

    Syntax: git log

  17. Git log --online: This is used for listing down the version history for the current working branch with short information.

    Syntax: git log

  18. git log –follow: This is similar to that of git log with the additional difference that it lists the version history for a particular file, which often includes the renaming of the file also.

    Syntax: git log –follow [file]

  19. git show: This is used to display the metadata and all the content related changes of a particular commit.

    Syntax: git show [commit]

  20. git tag: This is used to give particular tags to the code commits.

    Syntax: git tag [commit-id]

  21. git branch: Git branch command is used to list down all the branches that are locally present in the repository.

    Syntax: git branch

  22. Git branch [branch-name]: This is used to create a new branch.

    Syntax: git branch [branch-name]

  23. git branch -d [branch name] This command deletes the feature branch.

    Syntax: git branch -d [branch-name]

  24. git checkout This command is used to switch from one branch to another.

    Syntax: git checkout [branch-name]

  25. git checkout -b [branch name]This command creates a new branch and also switches to it.

    Syntax: git checkout -b [branch-name]

  26. git merge

    git merge [branch name]This command merges the specified branch’s history into the current branch.

    Syntax: git merge [current-branch-name]

  27. git remote This command is used to connect your local repository to the remote server.

    Syntax: git remote add [Remote Repo Link]

  28. git remote: This git command lists all the remote connections of your local repository that you have with the other repositories.

    Syntax: git remote

  29. git push This command sends the committed changes of the master branch to your remote repository.

    Syntax: git push [Repo-url] master

  30. git push –all [variable name]This command pushes all branches to your remote repository.

    Syntax: git push [Repo-url]

  31. git push [variable name] :[branch name]This command deletes a branch on your remote repository.

    Syntax: git push [Repo-url] [branch-name]

  32. git pull This command fetches and merges changes on the remote server to your working directory.

    Syntax: git pull [Repo-url]

  33. git stash This command temporarily stores all the modified tracked files.

    Syntax: git stash save

  34. git stash popThis command restores the most recently stashed files.

    Syntax: git stash pop

  35. git stash[stash-id]This command restores the specific stashed files.

    Syntax: git stash [stash-id]

  36. git stash list This command lists all stashed changesets.

    Syantx: git stash list

  37. git stash dropThis command discards the most recently stashed changeset.

    Syantx: git stash drop

Thank you for reading the article

Happy Learning!

#linux #git #github #devops