Get your local IP address like pro


In shell scripts if you need to get you local IP address corresponding to your hostname then you can use this command

image ordering by Original Date Time using bash script


Here is the script: #!/bin/bash - #=============================================================================== # # FILE: # # USAGE: ./ # # DESCRIPTION: # # OPTIONS: --- # …

Disk usage by file type


Trying to find the total usage for each of the file types by extension, then here is a quick bash function for you : disk_usage_type () { find . -name '*'$1 -ls | awk ' BEGIN{ a[0]="Bytes"; a[1]="KB"; …

How to verify sha256sum for multiple file or one file.


So, lets say you have downloaded the SHA256SUMS files. This file contains the sha256sum for multiple files and you want to compare the values for only one or some of them, then the simplest thing you …

Get count of lines in scripts (shell)


If you have tried to get the count of lines in file, the you would know about “nl” or “wc -l”. But as you are aware these give you number of lines with other details as well and you need to post …

bash – expand shell variables ( bash bug resolved )


As you would have noticed in the recent versions of bash, expansion does not work properly when expanding directory names. So, for something like this cd $varname if you press tab, then variable name …

ShellCheck – check basic POSIX shell script errors


Here is description of the tool: […] To install dnf install ShellCheck And just run the tool on the script to get the common errors.

evvsubst – substitute variables in text in shell


First you need to install gettext, which by the way might be already installed, however you can install with dnf install gettext Details of the package: […] Usage examples:

ionice – renice you IO activity for the process.


ionice is utility provided by the package util-linux. Description of util-linux: […]  […] With the help of this utility, you can set the scheduler priority for your IO scheduling upto …

ssh authorized keys – limit ssh session to custom command


If you want a ssh key to be able to run a custom command only and nothing beyond that, then you can use the “command” option in the authorized_keys file of ssh.  For example, to limit user to run only …

nice little bash function to search for running processes


Here is a nice little handy function that I use very regurlarly. You can use this function with parameter to just grep for that or just type psa to see all the running processes. Just put this in your …

bash – refer the first parameter from last command quickly


To refer to first parameter from the last command quickly, you can use !^ Note: This can also be referred as “!!:1“

This website uses cookies to ensure you get the best experience on our website. Learn more Got it