Basic Linux Commands for DevOps Engineers

Basic Linux Commands for DevOps Engineers

Today we are going to see the basic Linux commands for DevOps Engineers.

Linux basic commands :

date:- Which specifies the current date

pwd:- Print working Directory / Present Working Directory

mkdir:- To create a directory

ls:- To list all the directories and files.

cd:- To navigate among the directories

cd . :- To navigate to the current directory

cd .. :- To navigate to the previous directory //Absolute and Relative Path A absolute path is the complete reference path of the directory A relative path is where you specify the folder where you are currently residing.

touch:- We created an empty file

cat:- To view the data in a file

cat > :- To create a new file

echo:- To create a new file and specify the data in the command itself.

Note:- If you are creating files of the same name:- ->You will not get any error ->But previous file data will be lost

Note:- Editors are used to edit the existing data, With this we will be able to make sure that the previous data is not lost nano editor, vim editor... (nano file_name)

vi <file_name>:- This will open the file in the vi editor

ls -l:- Long listing

ls -a:- List of all files including hidden ones

ls -t:- List all the files concerning time

ls -r:- List all the files in reverse

ls -R:- Lists all the files and directories that are present in the present working directory

Note:- There are two types of links

  1. Soft Link: ln -s filename new-filename
  1. Hard Link: ln filename new-filename

cp:- Copying a file from one place to another:- cp file_name /Path/ mv:- Moving a file from one place to another /Renaming the files mv file_name /Path/

alias:- This helped to specify the keyword for a specific command How to make alias permanent ->Go to .bashrc ->add the command -> execute the file(source ~/.bashrc)

man:- Is used to get info about a particular command

head -n:- Is used to give the top 10 records(10 being default)

tail -n:- Is used to specify the bottom 10 records

whoami:- Will give you the use

who :- Also does the same thing

name:- Gives details of the OS

hostname:- Will give you the hostname on terminal

sudo su:- To enter into an administrative mode

exit:- To get into the user mode

sudo apt-get update(Ubuntu) sudo yum update(Centos)

Ex: sudo apt-get install apache2

wget:- is used to download a package or a file from the internet(link of the file)

ps -a:- Will show the process running in the Linux operating system.

history:- That gives you all the commands that you have executed recently.