Day 12 Task: Cheat Sheet

Day 12 Task: Cheat Sheet

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 -

  1. ls : List files and directories in the current directory.

  2. pwd: Print the current working directory.

  3. cd: Change the current directory.

  4. mkdir: Create a new directory.

  5. rmdir: Remove a directory (only if it's empty).

  6. rm: Remove files or directories.

  7. cp: Copy files and directories.

  8. mv: Move or rename files and directories.

  9. touch: Create an empty file or update the access/modification timestamp.

  10. cat: Concatenate and display the contents of a file.

  11. more or less: Display file content one screen at a time.

  12. head: Display the beginning lines of a file.

  13. tail: Display the ending lines of a file.

  14. diff: To find the difference between 2 files.

  15. grep: Search for a pattern in a file.

  16. find: Search for files and directories based on various criteria.

  17. chmod: Change file permissions.

  18. chown: Change file ownership.

  19. chgrp: Change group owner.

  20. ps: Show the currently running processes.

  21. kill: Terminate processes based on their Process ID (PID).

  22. df: Display disk space usage.

  23. du: Show the disk usage of files and directories.

  24. man: Display the manual page for a specific command.

  25. whoami: show the current logged-in username

  26. uname: show the name of Kernel(OS)

  27. uname -r: show the version of the kernel

  28. clear: use to clear the screen

  29. history: show list of previously used command

  30. crontab -e: to add commands in crontab so that they will run on schedule.

  31. useradd "user_name": To add a user.

  32. id user_name: To check the id of any username.

  33. passwd user_name: To set a password of any username.

  34. usermod -u new_id user_name: To change the id of any username.

  35. usermod -g new_id user_name: To change the group id of any username.

  36. groupadd -g new_grp_id new_grp_name: To create a new group.

  37. usermod -l new_user_name old_user_name: To change the username of any user.

  38. userdel -r user_name: To delete any user.

  39. getfacl: To get the current ACL on any file/directory.

  40. setfacl: To add, modify or delete ACL on any file/directory.

  41. apt-get install packagename: To install any package.

  42. systemctl options packagename: To manage system services.

  43. systemd options packagename: To init system and system manager.

Git-GitHub commands -

  1. git init: To initialize git repository.

  2. git config --global user.name: To set the name which will be displayed as author name.

  3. git config --global user.email: To set the email which will be displayed as author email.

  4. git add filename: To add changed files to the staging area.

  5. git commit -m "message": To commit the staged files with an appropriate message.

  6. git status: To check the status if any files are in the staging area or have been committed.

  7. git log: To check all the commits along with the message and author details.

  8. git checkout -b branchname: To make a new branch and switch to it.

  9. git branch: To list down all the branches in your repository.

  10. git remote add origin <remote repository URL>: To connect a local repo to your remote repo after initializing git.

  11. git remote -v: To verify the connection between local and remote repo.

  12. git pull origin branch_name: To pull the data from the remote repo to the local repo.

  13. git push origin branchname: To push the committed code to your remote repo.

  14. git clone <remote repository URL>: To clone a remote repo to your local repo.

  15. git revert commit_id: To reverse the changes and delete the commit history.

  16. git reset - To reverse the change done on a branch or a file.

  17. git rebase branch_name: To integrate changes from one branch to another, and the logs get modified.

  18. git merge branch: To merge Git branches while the logs of commits on branches remain intact.

  19. git stash: To temporarily save changes you have made in your working directory, without committing them.

  20. git stash list: To list down the stashed file changes.

  21. git stash pop: To get back the stashed data.

  22. git stash drop: To discard all the stashed changes.

  23. 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