Basic Linux Commands for DevOps

Basic Linux Commands for DevOps

Checking the Current working directory

pwd

Listing the files

ls

Listing all the files including Hidden Files

ls -a

Listing all the files including hidden files with permission details

ls -la

Create a nested directory A/B/C/D/E

mkdir -p DevOps/AWS/Jenkins/Ansible

To view what's written in a file.

cat Filename

To change the access permissions of files.

To check which commands you have run till now.

history

To remove a directory/ Folder.

rm -R directory

To create a fruits.txt file and to view the content.

#To create the fruits.txt
touch fruits.txt
vi fruits.txt
#Put the Fruits Names
cat fruits.txt

Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.

touch devops.txt
vi devops.txt
cat devops.txt

To Show only the top three fruits from the file

head -3 devops.txt

Show only the bottom three fruits from the file.

tail -3 devops.txt

To create another file Colors.txt and to view the content. Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.

#create the file
touch Colors.txt
#add the color name
vi Colors.txt

To find the difference between fruits.txt and Colors.txt file.

diff Colors.txt devops.txt

Did you find this article valuable?

Support Know Cloud by becoming a sponsor. Any amount is appreciated!