Show Local IP

2023-12-23 1 min read Linux Networking
Show local IP You can see the local IP of the machine with the command - ip a. However if you have to use the address in some variable in a scrit. It becomes little tricky, something like Show the interfaces in one line with ‘-o’ Show only IPv4 address’s with ‘-4’ and the command looks like 1 ip -4 -o a show dev eth0|awk '{gsub(/\/.*/,"",$4);print $4}' Replace eth0 with then correct interface name. Continue reading

Openvpn files to nmcli connection

2022-11-12 1 min read Linux Networking
Openvpn files to nmcli connection Many times you get openvpn file and when you want to connect to the VPN server, you have to start the vpn client from the cli. How you wish that this was added to NetworkManager so that you could connect to it with one click. If this is the case, then you can use these commands to do the same ane enjoy :) 1 2 nmcli connection import type openvpn file test. Continue reading

scripting – performance improvement with file open

2020-04-20 2 min read bash Learning Linux
Sometimes just one line of code can make all the difference. I will show you with example. Here is script with 2 functions. Both are writing some lines of text to a file. First function, “a” I have used the redirection to write to file. Function “b”, I have opened a file descriptor with “>” before going into the loop and use that reference for writing to the file. (This concept remains same for any scripting or programming language). Continue reading

ssh trick – ssh to remote host with bastion host

2019-09-16 1 min read bash Learning Linux
Lot of times, you have to ssh to a server with bastion host. If you dont know what is bastion host then see this: Now, in such cases, either you add an entry in “~/.ssh/config” to route the ssh through the bastion host or do ssh to bastion host and then ssh from there to the actual host. But wait, there is always a better way: ssh -t <bastion host> ssh -t <actual host> You can use the usernames as required for the 2 hosts and then you will have to enter passwords, first for the bastion host and then the actual host. Continue reading

terminal.sexy for URxvt

2019-08-19 1 min read Linux
Sometime back I posted about terminal.sexy – make your teminal sexy. I personally use URxvt terminal and hence need the xrdb files to apply the theme. It’s pain to go to the website everytime I want to change my theme and hence I wrote a python script that can use the github repo and convert the files to xrdb files. Here is the link to the script: terminal.sexy script for xrdb
Older posts