0% found this document useful (0 votes)
17 views33 pages

Linux & Git Cheat Sheet

The document provides a comprehensive list of common Linux commands and Git commands, detailing their functionalities. Each command is briefly described, covering file management, system monitoring, and version control operations. The commands are organized into sections for easy reference.

Uploaded by

h8295383
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views33 pages

Linux & Git Cheat Sheet

The document provides a comprehensive list of common Linux commands and Git commands, detailing their functionalities. Each command is briefly described, covering file management, system monitoring, and version control operations. The commands are organized into sections for easy reference.

Uploaded by

h8295383
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

1.

ls Command
List files and directories.

2. cd
Change directory.

Swipe
3. pwd
Print current working directory.

4. mkdir
Create a new directory.

Swipe
5. rm
Remove files and directories.

6. cp
Copy files and directories.

Swipe
7. mv
Move/rename files and directories.

8. touch
Create an empty file or update file
timestamps.

Swipe
9. cat
View the contents of a file.

10. head
Display the first few lines of a file.

Swipe
11. tail
Display the last few lines of a file.

12. ln
Create links between files.

Swipe
13. find
Search for files and directories.

14. chmod
Change file permissions.

Swipe
15. chown
Change file ownership.

16. chgrp
Change group ownership.

Swipe
17. umask
Set default file permissions.

18. tar
Create or extract archive files.

Swipe
19. gzip
Compress files.

20. zip
Create compressed zip archives.

Swipe
21. ps
Display running processes.

22. top
Monitor system processes in real-time.

Swipe
23. kill
Terminate a process.

24. pkill
Terminate processes based on their name.

Swipe
25. pgrep
List processes based on their name.

26. grep
Used to search for specific patterns or
regular expressions in text files or streams
and display matching lines.

Swipe
27. uname
Print system information.

28. whoami
Display current username.

Swipe
29. df
Show disk space usage.

30. du
Estimate file and directory sizes.

Swipe
31. free
Display memory usage information.

32. uptime
Show system uptime.

Swipe
33. lscpu
Display CPU information.

34. lspci
List PCI devices.

Swipe
35. lsusb
List USB devices.

36. ifconfig
Display network interface information.

Swipe
37. ping
Send ICMP echo requests to a host.

38. netstat
Display network connections and statistics.

Swipe
39. ssh
Securely connect to a remote server.

40. scp
Securely copy files between hosts.

Swipe
41. wget
Download files from the web.

42. curl
Transfer data to or from a server.

Swipe
Git Commands
1. git init
Initializes a new Git repository in the current
directory.

2. git init <directory>


Creates a new Git repository in the specified
directory.

Swipe
3. git clone
This Clones a repository from a remote
server to your local machine.

4. git clone –branch


<branch_name> <repository_url>
Clones a specific branch from a repository.

Swipe
5. git add
Adds a specific file to the staging area.

6. git add . or git add –all


Adds all modified and new files to the
staging area.

Swipe
7. git status
Shows the current state of your repository,
including tracked and untracked files,
modified files, and branch information.

8. git status –ignored


Displays ignored files in addition to the
regular status output.

Swipe
9. git diff
Shows the changes between the working
directory and the staging area (index).

10. git diff <commit1> <commit2>


Displays the differences between two
commits.

Swipe
11. git commit
Creates a new commit with the changes in
the staging area and opens the default text
editor for adding a commit message.

12. git commit -a or git commit –all


Commits all modified and deleted files in the
repository without explicitly using git add to
stage the changes.

Swipe
13. git restore <file>
Restores the file in the working directory to its
state in the last commit.

14. git reset <commit>


Moves the branch pointer to a specified
commit, resetting the staging area and the
working directory to match the specified
commit.

Swipe
15. git rm <file>
Removes a file from both the working
directory and the repository, staging the
deletion.

16. git branch


Lists all branches in the repository.

Swipe
19. git merge <branch>
Merges the specified branch into the current
branch.

20. git log


Displays the commit history of the current
branch.

Swipe
21. git fetch
Retrieves change from a remote repository,
including new branches and commit.

22. git pull


Fetches changes from the remote repository
and merges them into the current branch.

Swipe
23. git push
Pushes local commits to the remote
repository.

24. git revert <commit>


Creates a new commit that undoes the
changes introduced by the specified
commit.

Swipe
25. git rebase <branch>
Reapplies commits on the current branch
onto the tip of the specified branch.

26. git remote


Lists all remote repositories.

Swipe

You might also like