Linux
It provides services for applications and manages computer hardware. It's a platform to run desktops, embedded systems, and servers. It is made up of several different components working together to form an Operating System which is organized into layers. Each layer interacts with the other to provide its functionality.
There are over a thousand Linux commands and it would be hard to remember them all. You can always search for them online and as you use them you will become familiar with them. Below are some of the common commands that a DevOps Engineer will come across.
Commands | Description |
ls | Lists files and directories in the current directory |
pwd | Prints the current working directory |
cd | Changes the current working directory |
mkdir | Creates a new directory |
mv | Moves or renames files or directories |
rm | Removes files or directories |
touch | Creates an empty file |
cat | Concatenates and displays files |
clear | To clear the terminal screen of all previous output |
echo | To print a message or value to the terminal |
whoami | To display the username of the current user |
tar | Compresses and decompresses files and directories |
grep | To search for a specified pattern in one or more text files |
head | To display the first few lines of a text file |
tail | To display the last few lines of a text file |
diff | To compare the contents of two text files and display the difference between them. |
sort | To sort the lines of a text file |
chmod | Changes the permissions of a file or directory |
chown | Changes the owner of a file or directory |
sudo | Runs a command with administrative privileges |
useradd | To create a new user account |
usermod | To modify an existing user account |
passwd | To set or change the password of a user account |
exit | To close a terminal session or shell |
vim | The text editor in Linux, that is used to create and edit text files |
awk | Tool in Linux that is used to manipulate and process text files. |
If you would like to see the above commands used in action, see the below blogs on Linux:
Git
As described by [git-scm.com] - "Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency."
It allows developers to track changes to their code over time and collaborate with other developers on the same project by providing features for sharing and merging code changes. When multiple developers are working on the same project, each developer can create a separate local repository and make changes without affecting the main codebase. Git offers tools to integrate these independent changes into a unified codebase and resolve any conflicts that may arise.
There are many Git Commands that are out there and it would be hard to remember them all. You can always search for them online and as you use them you will become familiar with them. Below are some of the common commands that a DevOps Engineer will come across.
Commands | Description |
git clone | Creates a copy of a remote repository on the local machine. |
git status | Shows the current state of the repository, including any uncommitted changes |
git add | Adds a file or directory to the staging area |
git commit | Commits the staged changes with a commit message |
git push | Pushes local changes to a remote repository |
git remote add origin | used to add a remote repository to your local Git repository |
git push origin main | Used to push the commits made in the local main branch to the remote repository called the origin |
git init | Initializes a new Git repository in the current directory |
git branch | Lists all branches in the repository |
git config --global user.name | Used to set your Git username. This username will be associated with the commits you make to your Git repositories |
git config --global user.email | Used to set your Git email address. This email address will be associated with the commits you make to your Git repositories |
git config --list | Used to view the Git configuration settings for your local Git installation. These settings can include your username, email address, default text editor, and more |
git log --oneline | Used to view the commit history of a Git repository in a simplified format. Each commit is displayed on a single line with the first few characters of its commit hash and its commit message |
git revert | Reverts a commit by creating a new commit that undoes the changes in the specified commit |
git reset | Removes a file from the staging area |
git rebase | Used to apply a sequence of commits from one branch to another branch. It rewrites the project history by applying the changes of the rebased branch on top of the target branch. This results in a cleaner and more linear history |
git merge | Merges the specified branch into the current branch |
git checkout -b <branch> | Creates & switches to the "newly created" branch |
git checkout | Switches to a different branch |
git stash | Used to temporarily save changes that are not yet ready to be committed, allowing you to switch branches or perform other actions without losing your work |
git cherry-pick | Used to apply a specific commit from one branch to another. This command is useful when you want to apply changes made in a specific commit on one branch to another branch without merging the entire branch |
git pull | Fetches and merges change from a remote repository into the local repository |
git diff | Shows the changes between the working directory and the repository. |
If you would like to see the above commands used in action, see the below blogs on Git:
I appreciate your busy time reading this short blog. As I continue with my journey to learn and acquire the skill set of a DevOps Engineer, I will share what I learn. Thank you.
Happy Learning!
Sam Samarullah
#git #github #linux #linux commands #devops #devopstools