Day 12 : Task Completed on Linux & Git-GitHub
Empowering Your Command Line and Version Control Skills: Essential Cheat Sheets for Linux and Git Commands
Table of contents
🔶 Cheat sheet on Linux.
pwd - To check the print working directory. It prints the path of the working directory, starting from the root.
ls - To list directories.
ls -a - To list all files and directories, including hidden files.
mkdir - To make a new directory.
rmdir - To remove a directory/ Folder.
vim - To create a fruits.txt file and to view the content.
cat - To view what's written in a file.
head -3 file_name - To Show only the top three fruits from the file.
tail -3 file_name - To Show only the bottom three fruits from the file.
diff f1 f2 - To find the difference between f1 and f2 files.
chmod - To change the access permissions of files.
chown - The owner of the file or application.
chgrp - The group that owns the file or application.
history - To check which commands you have run till now.
Cron - Cron is generally used for running scheduled backups, monitoring disk space, deleting files periodically which are no longer required, running system maintenance tasks and a lot more.
CronTab - We can define multiple jobs, for their scheduled time and the account under which the job should run.
crontab -e - To select an editor and open corntabEdits a copy of the user's crontab file.
crontab -l \ - Lists the user's crontab file.
crontab -r - Removes the user's crontab file from the crontab directory.
ls -ltr - To see the details of the files.
File permissions:
Read (r) - Allows reading or viewing the content of the file. For directories, it allows listing the contents of the directory.
Write (w) - Permits modifying the file's content or deleting the file. For directories, it allows adding, removing, or renaming files within the directory.
Execute (x) - Enables executing the file if it is a script or a binary executable file. For directories, it allows accessing the contents of the directory.
ACLs - (Access Control Lists) are represented using an extended syntax that includes additional access permissions and qualifiers, such as read-data, write-data, execute, delete, and more.
getfacl - a command displays ACL information.
setfacl - a command that allows you to modify ACLs.
systemctl - is a command-line tool used to control the systemd system and service manager, which is the default initialization system in most modern Linux distributions. It allows users to start, stop, restart, enable, disable, and manage system services, targets (similar to runlevels), and other units managed by systemd.
service - is a legacy command used to control system services in older Linux distributions that do not use systemd as their default initialization system. It is also used in some current distributions for compatibility purposes. While it can perform similar actions to
systemctl
, its syntax and capabilities are more limited.
🔶 Cheat sheet on Git-GitHub.
sudo apt install git: To install it with Ubuntu.
git init: To Initialize a new Git repository in the current directory.
git --version: To confirm that you have installed Git.
git clone <repository-url>: To clone the remote repo to the local repo.
git status: To check the current status of the repo.
git add <file_name>: To add a file to the staging area to be included in the next commit.
git commit -m <Commit Message>: Make a commit by taking the updated working tree contents of the paths specified on the command line.
git push -u origin main: To push the local commits to a remote repository.
git revert <commit-id>: To remove or edit changes you’ve made in the code in previous commits.
git rebase <branch name>: To remove or edit changes you’ve made in the code in previous commits.
git merge: Git merge is a command that allows developers to merge Git branches while the logs of commits on branches remain intact.
git stash: Use git stash to save the changes without committing them.
git log --oneline: To print a single commit in a single line as output when the git log command is executed using this option.
git checkout <branch_name>: Command lets you navigate between the branches created by git branch.
git cherry-pick <commit_id>: To apply changes from a specific commit to the current branch.
git push origin --delete <branch>: To fully delete a remote branch on GitHub.
🔶 Conclusion:
In conclusion, a comprehensive Linux command and Git commands cheat sheet can be an invaluable resource for both beginners and experienced users. Mastering the essential Linux commands empowers users to navigate the Linux environment efficiently, perform file and directory operations, manage processes, and interact with the system effectively. Understanding Git commands is crucial for version control, enabling developers to collaborate, track changes, create branches, merge code, and manage repositories seamlessly.
Stay in the loop with my latest insights and articles on cloud ☁️ and DevOps ♾️ by following me on Hashnode, LinkedIn (https://www.linkedin.com/in/chandreshpatle28/), and GitHub (https://github.com/Chandreshpatle28).
Thank you for reading! Your support means the world to me. Let's keep learning, growing, and making a positive impact in the tech world together.
#Git #Linux Devops #Devopscommunity #90daysofdevopschallenge