Mount a network share on linux
On linux you have the ability to mount network share as they were part of your local storage , On debian , you need to have a package named cifs-utils specialised to mount network share. after...
View ArticleGrep a line before or after a match in bash
Sometime when you grep a file on Linux you need to not only display the line where the result is found but also several lines before or after the match. Grep as a useful function permitting you to do...
View ArticleLinux epoch time or Unix time
If you need a convenient way to store the date in a database you will certainly use the unix format. it’s very convenient because it doesn’t change notation from country to country. You can later...
View ArticlePing a complete /24 subnet with one bash line
if you need to know what devices are currently connected on the same network as you , there is no very simple way , you could use the command arp -a to see your arp table but it’s not always up to date...
View ArticleThe new Orange pi Zero Plus 2 |allwinner h3, 512mb, 4K hdmi, 8gb emmc
orange pi is an awesome sbc manufacturer known for excellent hardware and awful software support. I’m a very happy owner of the first generation orangepi zero witch I use as a headless Linux server...
View ArticleRenewing your IP address on Linux with dhclient
Let’s say you need to change you ip address because there was a change on the network and now ip settings changed, you can at anytime request with the command : ‘dhclient‘ a new address to a dhcp...
View ArticleUsing sed to delete a word from a string
For example in a bash script you need to delete one or more word from the string , you can use sed to do just that sed -e "s/word to delete//g" sed is searching for “word to delete” and replacing it...
View ArticleLinux : make an USB bootable thumb with an ISO file
you downloaded the iso of some distrib and you want to make a flash thumbdrive bootable by writing the ISO on the thumb , a simple copy and paste is not going to work : On linux , there is a very...
View ArticleExtract values separated by character ( : , . – )
In a bash script if you find yourself with values presented that way Hello:345:18.5:TRUE:000 you might want to keep only the second or third of this values that are separated by the : character like...
View Articlebash : Put the source of a webpage in a variable
When you do some bash scripting , this is often useful to get data from webserver because they are a very simple way to exchange data from computer from computer. to put the data that’s available on a...
View ArticleDisplay your current external IP address with WGET
To know your ip address , you can use the command ifconfig You will know the ip address for each of your network interfaces. But if you are not directly connected to the internet and use a Gateway...
View ArticleBash : Reuse the last argument
Let’s say you are waiting for a host to come back online . to ssh into it you launch a little ping 192.168.1.33 To see when the host return online , when the host finally ping , you can ctrl+c to kill...
View ArticleLinux : Sort a list of IP address
like we saw previously in that article , it’s possible to ping an entire /24 subnet with a little convenient command. 64 bytes from 192.168.1.21: icmp_seq=1 ttl=64 time=0.163 ms 64 bytes from...
View ArticleBASH : Delete the last X chars from a string
When you scrap data in HTML , it’s common , depending on the quality of you regex to end up with a string with some useless character at the end (Or the Beginning), If you string looks like that : My...
View ArticleRe-apply .bashrc
After you made some changes on your .bashrc file (like creating some new aliases) You will notice that the changes are not applied upon the saving of the .bashrc file After having saved the file ,...
View ArticleUNPROTECTED PRIVATE KEY FILE fix
If you try to connect using a key system on ssh instead of a classic password login, you might encounter this error message. $ ssh -i ~/.ssh/id_rsa.pub root@host.com...
View ArticleBash : Delete some characters from a file with TR
in this little example of usage of the command tr we want to clean a file so the values contained in it can be used Example File <10> <23> <34> <78> <44> <12>...
View ArticleCreate a simple reverse shell using bash
In some cases you need to send to a distant person or computer a shell. For example, I have trouble getting a Cisco router to work correctly. And know somebody that will find and fix the issue for you...
View ArticleUse AWK to display x-th and y-th lines after a regex match
In a script you might be interested to keep 2 or more lines after a regex match , the line that interest you are not always going to be right after the match , the first one might be X lines after the...
View ArticleExtract values separated by character ( : , . – )
In a bash script if you find yourself with values presented that way Hello:345:18.5:TRUE:000 you might want to keep only the second or third of this values that are separated by the : character like...
View Article