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
PBR Concepts

What is a Health Group? A Health Group  is a configuration object used to group specific PBR destination interfaces—typically the consumer and provider interfaces of the same service node (such as a f

 
 
 
Active/Standby F5 Across Different ACI Pods

Normal L3Out vs Floating L3Out Explained Understanding Cisco ACI Multi-Pod Architecture In a Cisco ACI Multi-Pod design: Each Pod has an independent IS-IS control plane Endpoint learning is maintained

 
 
 
Multi-site Traffic Flow

This article explains how traffic flows between Endpoint Groups (EPGs) across multiple sites in Cisco ACI using Nexus Dashboard Orchestrator (NDO). We will walk through three common design scenarios a

 
 
 

Comments


Follow me

© 2021 by Mukesh Chanderia
 

Call

T: 8505812333  

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