What are Linux Commands
- To view what’s written in a file.
The Cat command is used to view the content of the file. It gives content as output.
Syntax: cat file_name

- To remove a Directory/ File
The rm command is used to remove directories and files permanently without moving them to the trash directory. The rmdir command removes empty directories.
Syntax : rm file_name
To create a fruits.txt file and to view the content
ubuntu@ip-172-31-205-241:~$ vi fruits.txt
ubuntu@ip-172-31-205-241:~$ cat fruits.txt
Apple
Mango
Banana
Kiwi
Dragan
Guava
Add content in fruits.txt (One in each line) – Apple, Mango, Banana, Kiwi, Dragan, Guava.
Apple
Mango
Banana
Kiwi
Dragan
Guava
~
~
~
- To Show only the top three fruits from the file.To show only the top three fruits we will use the head command. The Linux head command prints the first lines of one or more files to standard output. By default, it shows the first 10 lines. We can pass a -n, where n shows the specified number of line
Syntax: head -n file_name - To Show only the bottom three fruits from the file to show only the bottom three fruits we will use the tail command. Tail is a command which prints the last few lines (10 lines by default) of a certain file.
Syntax: tail -n file_name

To create another file Colors.txt and to view the content. Commands: vi Colors.txt cat Colors.txt
Add content in Colors.txt (One in each line) – Red, Pink, Blue, Orange, Purple, and Wine.
To find the difference between the fruits.txt and Colors.txt files. To find the difference between the content of two files we can use the diff command.
ubuntu@ip-172-31-205-241:~$ diff fruits.txt colors.txt
1,6c1,6
< Apple
< Mango
< Banana
< Kiwi
< Dragan
< Guava
---
> Red
> Pink
> Blue
> Orange
> Purple
> Wine
ubuntu@ip-172-31-205-241:~$
1- echo – Print any text
ubuntu@ip-172-31-205-241:~$ echo “Hello World”
Hello World
2- grep – Find out the specific word, Find out the root word
Syntax: grep root /etc/passwd
ubuntu@ip-172-31-205-241:~$ grep root /etc/passwd
root:x:0:0:root:/root:/bin/bash
3- sort – Set all files in alphabetical order. for this, we use the colors.txt file and set this file alphabetically.
Syntax : sort colors.txt
ubuntu@ip-172-31-205-241:~$ cat colors.txt
Red
Pink
Blue
Orange
Purple
Wine
ubuntu@ip-172-31-205-241:~$ sort colors.txt
Blue
Orange
Pink
Purple
Red
Wine
4- hostname -i:- This command shows IP address of your machine.
ubuntu@ip-172-31-205-241:~$ hostname -i
172.31.205.241
5- ifconfig – This command shows details of ip address like netmask, prefix, interface, broadcast
Syntax: ifconfig

How to check the version of our operating system(os)
Syntax:- cat /etc/os-release
ubuntu@ip-172-31-11-66:~$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
ubuntu@ip-172-31-11-66:~$
- How to install the software in Linux
when you use this command then all packages are installed in that.
Syntax: yum install httpd -y - We Check service is active or not by using this command
Syntax: service httpd status - The command to activate the service
Syntax: service httpd start - If you want to update the service
Syntax: yum update httpd -y - If you want to remove the service
Syntax: yum remove httpd -y - The command to stop the service
Syntax: service httpd stop - Command to automatically start service in the backend
Syntax: checkconfig httpd on - Command to off service if you have not needed
Syntax: checkconfig httpd off - List of packages that are installed in our machine
Syntax: yum list install
Thank you for reading! Hope you find this article helpful.