đFinally we have completed Linux đ§,Git & GitHub đ.
â¨Let's make a cheat-sheet for all commands of Linux , Git &GitHub that we have learned so far .
Linux Commands:-
1. ls - List Contents of a Directory
The ls command is used to list the contents of a directory. By default, it displays the names of files and directories within the specified location. When used with the -l option, it provides additional information such as permissions, owner, size, and last modified date for each file.
2. sudo - Execute with Superuser Privileges
The sudo command is used to execute a specific command with superuser privileges. This allows a user to perform actions that require administrative access. It's a crucial command for making system-level changes.
3. pwd - Print Working Directory
The pwd command prints the current working directory, showing you the path of the directory you are currently in. This is helpful for maintaining awareness of your location in the filesystem.
4. cat - Concatenate and Display Files
The cat command is used to display the content of files on the terminal. It can also be used to concatenate multiple files. Various options like -b, -n, -s, and -E allow you to manipulate the output, including line numbering and displaying the end of lines.
5. Vim - Text Editor with Multiple Modes
Vim, short for "Vi Improved," is a powerful text editor used in Linux. It operates in three primary modes:
Normal mode: For navigating and editing text.
Insert mode: For entering and editing text.
Command mode: For issuing commands to save or quit the editor.
6. grep - Search for Strings in Text
The grep command is used to search for specific strings or words within text files. It functions similarly to a "Find" operation, allowing you to locate and display lines containing the specified text.
7. sort - Sort Results and Files
The sort command arranges data either alphabetically or numerically. Flags like -r, -f, and -n allow you to customize the sorting process, including reverse order and case-insensitive sorting.
8. tail - Display the End of a File
The tail command is used to display the last few lines of a file. By default, it shows the last ten lines, but you can specify the number of lines to display.
9. chmod - Change Access Permissions
The chmod command is crucial for changing the access permissions of files and directories, allowing you to specify who can read, write, or execute them.
10. chown - Change File Owner or Group
The chown command is used to change the ownership of a file or directory. This is essential for managing permissions and access control.
11. ping - Check Host Response
The ping command is used to check if a host is responding by sending network packets to it. It's a fundamental tool for network troubleshooting.
12. lsof - List Open Files
lsof stands for "list open files" and is used to display all files currently open on a Linux system. This is helpful for identifying which processes are using specific files.
13. ifconfig - Configure Network Interfaces
The ifconfig command is used to configure network interfaces on a Linux system. It allows you to view and modify network settings.
14. id - Find User and Group Information
The id command is used to retrieve information about users and groups, including their numeric IDs (UID or GID). It's valuable for understanding user and group associations.
15. cut - Extract Fields from Text
The cut command is used to extract specific fields or columns from a file or standard input. It is often combined with other commands for more complex text processing tasks.
16. sed - Stream Editor
sed, or "stream editor," is a powerful tool for performing text transformations on input files. It's particularly useful for batch text editing.
17. diff - Find Differences Between Files
The diff command is used to find differences between two text files. It highlights changes, making it valuable for code and configuration comparisons.
18. history - View Command History
The history command allows you to view a list of previously executed commands, making it easier to recall and reuse past commands.
19. find - Search for Files and Directories
The find command is used to search for files and directories based on specific criteria. It's invaluable for locating and managing files on a system.
20. free - Display System Memory Information
The free command provides information about system memory usage, including the amount of free and used memory, swap memory, and kernel buffers.
21. ssh - Secure Shell
The ssh command is used to connect to remote hosts securely. It allows users to log in to a remote system and execute commands remotely.
22. ssh-keygen - Generate SSH Key Pairs
ssh-keygen is used to generate public and private key pairs for secure authentication, enabling passwordless remote connections.
23. nslookup - DNS Lookup Tool
nslookup, short for "Name Server Lookup," is a tool used to check DNS hostnames and IP addresses. It's essential for troubleshooting network-related issues.
24. curl - Transfer Data Using Various Protocols
curl is a versatile tool for transferring data to or from a server using various protocols, including HTTP, HTTPS, and FTP. It's commonly used for automating web-related tasks.
25. tr - Translate or Delete Characters
The tr command, short for "translation," is used to translate or delete characters in a text stream. It's a handy tool for text manipulation.
26. apt-get - Package Management in Debian-Based Systems
The apt-get command is used to manage packages on Debian-based Linux systems. It allows you to install, update, and remove packages and repositories.
27. df and du - Disk Space and Usage
The df command displays available disk space and usage information, while the du command reports the size of directory trees and their contents.
28. htop - Real-Time System Resource Monitoring
htop is a real-time system resource monitoring tool that provides an interactive view of processes, system load, and resource utilization.
29. ps - Display Process Information
The ps command is used to display information about running processes. Various options allow you to customize the output to your needs.
30. kill - Terminate Processes
The kill command is used to terminate processes manually by sending a specific signal to them.
Git and Github commands:-
git init
Usage: git init [repository name]
This command is used to start a new repository.
git clone
Usage: git clone [url]
This command is used to obtain a repository from an existing URL.
git add
Usage: git add [file]
This command adds a file to the staging area.
Usage: git add *
This command adds one or more to the staging area.
git commit
Usage: git commit -m â[ Type in the commit message]â
This command records or snapshots the file permanently in the version history.
Usage: git commit -a
This command commits any files youâve added with the git add command and also commits any files youâve changed since then.
git diff
Usage: git diff
This command shows the file differences which are not yet staged.
Usage: git diff âstaged
This command shows the differences between the files in the staging area and the latest version present.
Usage: git diff [first branch] [second branch]
This command shows the differences between the two branches mentioned.
git status
Usage: git status
This command lists all the files that have to be committed.
git rm
Usage: git rm [file]
This command deletes the file from your working directory and stages the deletion.
git log
Usage: git log
This command is used to list the version history for the current branch.
Usage: git log âfollow[file]
This command lists version history for a file, including the renaming of files also.
git branch
Usage: git branch
This command lists all the local branches in the current repository.
Usage: git branch [branch name]
This command creates a new branch.
Usage: git branch -d [branch name]
This command deletes the feature branch.
git checkout
Usage: git checkout [branch name]
This command is used to switch from one branch to another.
Usage: git checkout -b [branch name]
This command creates a new branch and also switches to it.
git merge
Usage: git merge [branch name]
This command merges the specified branchâs history into the current branch.
git remote
Usage: git remote add [variable name] [Remote Server Link]
This command is used to connect your local repository to the remote server.
git push
Usage: git push [variable name] master
This command sends the committed changes of master branch to your remote repository.
Usage: git push [variable name] [branch]
This command sends the branch commits to your remote repository.
Usage: git push âall [variable name]
This command pushes all branches to your remote repository.
Usage: git push [variable name] :[branch name]
This command deletes a branch on your remote repository.
git pull
Usage: git pull [Repository Link]
This command fetches and merges changes on the remote server to your working directory.