How to echo a tab in bash?
Answer:
In Bash script, if you want to print out unprintable characters such as tab, you need to use -e flag together with the echo command.
E.g.
echo -e "\tfoo\tbar"
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to echo a tab in bash?
Answer:
In Bash script, if you want to print out unprintable characters such as tab, you need to use -e flag together with the echo command.
E.g.
echo -e "\tfoo\tbar"
Send ARP REQUEST to a neighbour host in Linux
Answer:
The arping command allow you to Ping destination on device interface by ARP packets, using source address source.
E.g.
# arping -U 192.168.1.5
The above command send an Unsolicited ARP request to update neighbours' ARP caches.
Output the last N bytes of a file in Linux
Answer:
In previous article, we have shows how to print the first N bytes of a file in Linux. But how to print the last N bytes of a file instead?
Solution:
# tail --byte 4 input.txt
...
The above command print the last 4 bytes of the file input.txt
Print the first N bytes of a file in Linux
Answer:
To print the first N bytes of a file in Linux, you can try the following method:
# head --byte 4 input.txt
...
The above command print the first 4 bytes of the file input.txt
Simple environment variable usage in Linux
Answer:
In Linux, the most basic way to set an environment variable is use the "=" operator.
For example:
# foo=bar
# echo $foo
bar