Creating and using ackrc

2022-04-02 1 min read Learning Ack Grep Fedora

ack is a fantastic replacement for grep and probably much more than grep. Here is what the dnf info has to say about ack

1
2
3
4
5
6
Name         : ack
Architecture : noarch
Summary      : Grep-like text finder
URL          : http://beyondgrep.com/
License      : Artistic 2.0
Description  : Ack is designed as a replacement for grep.

And their websites says -

Designed for programmers with large heterogeneous trees of source code, ack is written in portable Perl 5 and takes advantage of the power of Perl’s regular expressions.

Continue reading

mussh-run-commands-on-multiple-hosts

2022-03-06 1 min read Learning Bash Fedora SSH

mussh allows you to run command/commands on multiple hosts at the same time. If you have farm of server setup with passwordless ssh or with same password (which is generally the case), then using mussh you can either check all the servers for some output or fix something or maybe update all the packages. How cool is that :)

Here is description of this package from dnf repo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
Name         : mussh
Version      : 1.0
Release      : 18.fc35
Architecture : noarch
Size         : 20 k
Source       : mussh-1.0-18.fc35.src.rpm
Repository   : fedora
Summary      : Multihost SSH wrapper
URL          : http://www.sourceforge.net/projects/mussh
License      : GPL+
Description  : Mussh is a shell script that allows you to execute a command or
             : script over ssh on multiple hosts with one command. When possible
             : mussh will use ssh-agent and RSA/DSA keys to minimize the need to
             : enter your password more than once.

virt-install with cloud-init

2022-02-09 2 min read Learning Bash Virtualization Qemu Libvirtd

If you have not heard about cloud-init then you should definately search for it and learn about cloud-config as well. You can find the documentation for cloud-config here. It is used for configuring VMs when running in cloud environments. Specially useful to inject the ssh keys or set the root password but you can do anything in the cloud-config as there is a section where you can run bash commands. While this is useful for cloud instances, you can make use of this feature when running your vm with qemu or libvirtd. All you need to do is either attach a iso disc with user-data and meta-data files in it or even simpler, you can use virt-install command. The command that I use is as follows

Continue reading

Stay safe from phising

2022-02-05 2 min read Learning Bash Phising

Generally when you get a phising mail, the biggest challenge is finding if the site is genuine or not. And URL shortening services do not make it any easy. Earlier I had posted about using curl to expand the url in this post. However you might not be on a Linux terminal all the time (for example - you are checking something on your mobile), in that case what do you do?

Continue reading

Curl to exapnd short url

2022-01-09 1 min read Learning Bash

Many times I receive short urls in mail and other places like chats and messages. I first like to see the destination before I click on the url. I was looking for some way to do this in bash. I realized that this could be very simply done by looking at the Location header in the response from curl.

Example

1
curl -I https://bit.ly/32WwCp4|grep location

and the output should be something like

Continue reading

Sleep infinitely in bash

2021-12-19 1 min read Learning Bash

I am sure that you would have got a lot of instances where you have wanted to sleep for infinity and ended up doing this

1
2
3
4
while [[ 1 ]]
do
	sleep 3600
done

or some other such similar loop to sleep for some time and wrap it in infinite loop.

I learned something new recently and found it very useful. You can do the above with

1
sleep infinity

and you can use that even for a while loop

Continue reading
Older posts Newer posts