Table of contents
Now that we have completed the Linux & Git-GitHub hands-on in the last 11 days, let's make a cheat sheet of all the commands we have used so far.
Linux Commands -
ls
: List files and directories in the current directory.pwd
: Print the current working directory.cd
: Change the current directory.mkdir
: Create a new directory.rmdir: Remove a directory (only if it's empty).
rm
: Remove files or directories.cp
: Copy files and directories.mv
: Move or rename files and directories.touch
: Create an empty file or update the access/modification timestamp.cat
: Concatenate and display the contents of a file.more
orless
: Display file content one screen at a time.head
: Display the beginning lines of a file.tail
: Display the ending lines of a file.diff
: To find the difference between 2 files.grep
: Search for a pattern in a file.find
: Search for files and directories based on various criteria.chmod
: Change file permissions.chown
: Change file ownership.chgrp
: Change group owner.ps
: Show the currently running processes.kill
: Terminate processes based on their Process ID (PID).df
: Display disk space usage.du
: Show the disk usage of files and directories.man
: Display the manual page for a specific command.whoami
: show the current logged-in usernameuname
: show the name of Kernel(OS)uname -r
: show the version of the kernelclear
: use to clear the screenhistory
: show list of previously used commandcrontab -e
: to add commands in crontab so that they will run on schedule.useradd "user_name":
To add a user.id user_name:
To check the id of any username.passwd user_name:
To set a password of any username.usermod -u new_id user_name:
To change the id of any username.usermod -g new_id user_name:
To change the group id of any username.groupadd -g new_grp_id new_grp_name:
To create a new group.usermod -l new_user_name old_user_name:
To change the username of any user.userdel -r user_name:
To delete any user.getfacl:
To get the current ACL on any file/directory.setfacl
: To add, modify or delete ACL on any file/directory.apt-get install packagename:
To install any package.systemctl options packagename
: To manage system services.systemd options packagename
: To init system and system manager.
Git-GitHub commands -
git init
: To initialize git repository.git config --global
user.name
: To set the name which will be displayed as author name.git config --global
user.email
: To set the email which will be displayed as author email.git add filename
: To add changed files to the staging area.git commit -m "message"
: To commit the staged files with an appropriate message.git status
: To check the status if any files are in the staging area or have been committed.git log
: To check all the commits along with the message and author details.git checkout -b branchname
: To make a new branch and switch to it.git branch
: To list down all the branches in your repository.git remote add origin <remote repository URL>
: To connect a local repo to your remote repo after initializing git.git remote -v
: To verify the connection between local and remote repo.git pull origin branch_name
: To pull the data from the remote repo to the local repo.git push origin branchname
: To push the committed code to your remote repo.git clone <remote repository URL>
: To clone a remote repo to your local repo.git revert commit_id
: To reverse the changes and delete the commit history.git reset
- To reverse the change done on a branch or a file.git rebase branch_name
: To integrate changes from one branch to another, and the logs get modified.git merge branch
: To merge Git branches while the logs of commits on branches remain intact.git stash
: To temporarily save changes you have made in your working directory, without committing them.git stash list
: To list down the stashed file changes.git stash pop
: To get back the stashed data.git stash drop
: To discard all the stashed changes.git cherry-pick commit_id
: To select specific commits from one branch and apply them to another branch.
These are all the commands that we used till now. I hope you got to understand.
Thanks for reading!
#devops#90DaysOfDevops#TrainWithShubham
Let's connect on Linkedin - linkedin.com/in/namya-khullar-7b5758200