Hello Everyone,
#day3
Basics Linux command
As a challenge #90daysofdevops under Shubham Londhe
#devops #90daysofdevops #trainwithshubham #awscloud
To view what's written in a file.
The
cat
command is used to display the contents of a file on the terminal. For example, to view the contents of a file namedhello.txt
, run the following command:
To change the access permissions of files.
The
chmod
command is used to change the access permissions of files. For example, to give the owner of a file read, write, and execute permissions and everyone else only read and execute permissions, run the following command:
To check which commands you have run till now.
The
history
command is used to show a list of all the commands you have run in the current terminal session. For example:
To remove a directory/ Folder.
The
rmdir -r
command is used to remove an empty directory or folder. For example, to remove a directory namedLinux
, run the following command:
To create a fruits.txt file and to view the content
The
touch
command is used to create a new file. For example, to create a file namedfruits.txt
, run the following command.You can use the
cat
command to view the contents of the newly created file:Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
The
vim
command is used to add content to a file. For example, to add the words "Apple", "Mango", "Banana", "Cherry", "Kiwi", "Orange", and "Guava" to the file nameddevops.txt
, one on each line, run the following commands:To Show only Top three fruits from the file.
The
head
command is used to display the first few lines of a file. For example, to show only the top three fruits from thedevops.txt
file, run the following command:To Show only Bottom three fruits from the file.
The
tail
command is used to display the last few lines of a file. For example, to show only the bottom three fruits from thedevops.txt
file, run the following command:
To create another file Colors.txt and to view the content.
You can create another file named
Colors.txt
using thetouch
command:Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.
To view the contents of the newly created file, use the
cat
command:
To find the difference between fruits.txt and Colors.txt file.
use diff command to difference between two files.