Tagged: linux

0

WSL2 configuration

X11 forwarding on WSL2 More info here ~/.bashrc export DISPLAY=$(awk ‘/nameserver / {print $2; exit}’ /etc/resolv.conf 2>/dev/null):0 export LIBGL_ALWAYS_INDIRECT=1   Windows links for linux apps in WSL Adds linux GUI application menu to a windows toolbar https://github.com/cascadium/wsl-windows-toolbar-launcher Related posts: Access...

0

Cluster filesystem utilization alerts

This is a quick and raw method to setup alerts when the filesystem fill above threshold. Pre-requisites Monitored filesystems should be consistent, meaning available across all nodes passwordless ssh should be setup between the nodes. Node where the alert script...

0

Check version of installed python packages

Below bash command will let you find the version of packages for your python interpreter. Make sure you are running the correct version of python enterpreter. Update: 2020-05-14 for i in pandas numpy sqlalchemy logging logging.handlers datetime sys re os...

0

Automate ports connectivity check using telnet and timeout

Check ports connectivity using automation with telnet and timeout commands. Timeout will help us not get blocked for a long time. Adjust the timeout value on case to case basis, # vi ~/check_my_server_hostname.sh timeout 2 bash -c “echo ‘exit’ |...

0

Create many files with random content

Source: https://unix.stackexchange.com/questions/199863/create-many-files-with-random-content   For example, Name size file1.01 2K file2.02 3K file3.03 5K etc.   Strategy – 1 #! /bin/bash for n in {1..1000}; do dd if=/dev/urandom of=file$( printf %03d “$n” ).bin bs=1 count=$(( RANDOM + 1024 )) done  ...

0

Download youtube playlist

Setup sudo apt-get install ffmpeg brew install youtube-dl Command youtube-dl –extract-audio –audio-format mp3 -o “%(title)s.%(ext)s” <url to playlist>   References https://askubuntu.com/questions/564567/how-to-download-playlist-from-youtube-dl Related posts: Compiling in $HOME Installing perl modules in non standard directory Bulk add remote host fingerprint in ~/.ssh/known_hosts...

0

Handy bash commands

Top 20 files by size Concatenate multiple files skipping n rows Compress last X days data in one archive Compress files older than X days individually Merging multiple lines Find latest files recursively Get rows starting and ending between a...

0

Bash scripting tricks

Bash tricks Check bash version in script if ((BASH_VERSINFO[0] < 4)) then echo “Sorry, you need at least bash-4.0 to run this script.” exit 1 fi   Reading columns from a file in bash array table_collection=( $(cut -d $’\t’ -f1...

0

AWK Syntax

AWK syntax: awk [-Fs] “program” [file1 file2…] # commands come from DOS cmdline awk ‘program{print “foo”}’ file1 # single quotes around double quotes # NB: Don’t use single quotes alone if the embedded info will contain the # vertical bar...