Linux: Find Files by Name & Grep Contents

The Linux find command can be used for searching files and directories and performing subsequent operations on them.

If you use the find command to recursively search for some files and then pipe the result to the grep command, by doing this you will actually parse the file paths/names but not their contents.

This short note shows how to recursively find files by name and grep their contents for some word or pattern. (more…)

Jenkins: List All Jobs – Groovy Script

The easiest way to get a list of all Jenkins jobs is by executing an appropriate Groovy script using a Jenkins script console feature.

This note shows two examples of Groovy scripts for listing the Jenkins jobs.

The first script simply prints the list of all Jenkins jobs while the second one additionally lets you to identify how the last build of each job was triggered, e.g. manually by user, triggered by commit, by schedule etc. (more…)

Umount: Force – Target | Device is Busy

An umount command is used to unmount a device/partition by specifying the path to the directory where it has been mounted.

Sometimes, when you run the umount command you may receive the “target is busy” or “device is busy” errors indicating that there is some process that is using the mounted filesystem or the remote file server is not responding for some reason.

Luckily, it is possible to run the umount command forcefully and this short note shows how to do this safely. (more…)

IP2Host: Get Hostname from IP – Command Line

A reverse name resolution zone file is used to translate an IP address in a particular namespace into a fully qualified domain name (FQDN).

If this file has been configured on a name server, it becomes possible to find a hostname from an IP address.

This note shows how to get a hostname from an IP address from the command line in Windows, Linux or MacOS using the nslookup command.

Cool Tip: How to setup a reverse name resolution! Read more →

Find Hostname from IP

Execute the nslookup command as follows from a terminal in Linux/MacOS or from a command prompt (CMD or PowerShell) in Windows to find the hostname by IP:

$ nslookup 192.168.0.15
- sample output -
Server:  router.net.infra
Address: 192.168.0.1

Name:    my-box-hostname.net.infra
Address: 192.168.0.15

The command above performs the reverse lookup and converts the IP address to hostname by querying the name server for the 15.0.168.192.in-addr.arpa record.

Screen: Rename Session

A named screen session can be started by using the screen -S <sessionName> command.

If you start a simple screen session, by default, it will be named as something like 55355.pts-0.hostname.

No matter how the screen session has been started, it can be easily renamed at any time.

This short note shows how to rename a GNU screen session in Linux. (more…)

What Active Directory Groups Am I In?

If your computer is running in a corporate environment, one day you may wonder which Active Directory (AD) groups your current user is a member of.

The easiest way to see what AD groups i am a member of is by executing the appropriate commands from a command prompt (CMD or PowerShell) and this short note shows how to do this. (more…)

Ansible Playbook “Dry Run” – Check Mode

An Ansible’s “dry run” or check mode feature is just a simulation of the execution of the ansible-playbook command.

When the ansible-playbook command is executed in the check mode, it will not make any changes on a target system.

With the Ansible’s “dry run” feature you can see if the target system is getting changed or not before actually applying the playbook and making any changes on the target host. (more…)