top of page

Linux - Commands Part 3

  • Writer: Mukesh Chanderia
    Mukesh Chanderia
  • Feb 13, 2021
  • 1 min read

Updated: Aug 21, 2021

Semicolon is used to run multiple command in single line


[root@localhost ~]# touch file1 ; mkdir Dir1


Keyword "tac" is used to read reverse.


Note : Cat /Tac


root@localhost ~]# cat -n mukesh.txt

1 Hello Ji

2 Tuse Great Ho

3 You Can

4 You Will

5 Great


[root@localhost ~]# tac mukesh.txt

Great

You Will

You Can

Tuse Great Ho

Hello Ji


Now to put sequence number with cat "-n" but with tac we need to use "nl" command


[root@localhost ~]# nl mukeshji.txt

1 this is India Web Server

2 this is US Web Server


nl stands for number of lines in a file


root@localhost ~]# tac mukesh.txt | nl

1 Great

2 You Will

3 You Can

4 Tuse Great Ho

5 Hello Ji


To find out top three and bottom 3 command


Use Head and Tail Commands


root@localhost ~]# head -n 3 /etc/passwd

root:x:0:0:root:/root:/bin/bash

bin:x:1:1:bin:/bin:/sbin/nologin

daemon:x:2:2:daemon:/sbin:/sbin/nologin


[root@localhost ~]# tail -n 3 /etc/passwd

postfix:x:89:89::/var/spool/postfix:/sbin/nologin

tcpdump:x:72:72::/:/sbin/nologin

mukesh:x:1000:1000:Mukesh:/home/mukesh:/bin/bash


Tail command is used to read logs

tail -F /var/log/message



ECHO : It is used to print file.


root@localhost ~]# echo "Alpha Beta Gamma"

Alpha Beta Gamma


To add output to existing file use ">"


[root@localhost ~]# echo "this is India Web Server" > mukesh.txt


To Append use ">>"

root@localhost ~]# echo "this is US Web Server" >> mukesh.txt


Echo can also be used to create empty file

echo > mukesh.txt



 
 
 

Recent Posts

See All
Wireshark

1. What is Wireshark? Wireshark is a network packet capture tool . It shows every packet of data moving through your network. Think of it...

 
 
 
MultiCast In ACI

Understanding Multicast in Cisco ACI 1. Multicast Traffic Flow in ACI In ACI, multicast traffic is primarily managed within Bridge...

 
 
 
Quality of Service (QoS) in Cisco ACI

Configuring Quality of Service (QoS)  in Cisco ACI (Application Centric Infrastructure)  involves creating and applying QoS policies that...

 
 
 

Commenti


Follow me

© 2021 by Mukesh Chanderia
 

Call

T: 8505812333  

  • Twitter
  • LinkedIn
  • Facebook Clean
©Mukesh Chanderia
bottom of page