Get the list of zombie processes:
ps aux | awk '{if($8=="Z") print}'
Get the parent process of each of the processes listed above (second column)
ps -o ppid= -p 490392
Kill the parent process from the above output
sudo kill -9 3167559
Get the list of zombie processes:
ps aux | awk '{if($8=="Z") print}'
Get the parent process of each of the processes listed above (second column)
ps -o ppid= -p 490392
Kill the parent process from the above output
sudo kill -9 3167559
If you would like to split a large zip file with 7zip, in 1GB files for example, you can use the following
7z -v1g a documents_multipart.7z dir/
You have single line output that contains multiple strings (could be output from a kubectl that gives all the instance names) and you want to convert it to text that can be used as the a variable enclosed by double quotes, one string on one line and separated by commas.
So having the string in a file called input.txt:
a b c
you want to convert it to the following and save it in another file called output.txt
"a",
"b",
"c"
You can use the following:
cat input.txt | tr ' ' '\n' | sed 's/^/"/g' | sed 's/$/",/g' > output.txt
which will first replace the spaces separating the strings to newlines, and then use two passes with sed, in the first adding the first quote, and the second adding the second quote and the comma.
Use the following to convert a timestamp to a date in Linux bash
date -d @1636995741 Mo 15 Nov 2021 18:02:21 CET
To find your current resolution in a Linux shell you can use:
xdpyinfo | grep dim
dimensions: 3840×3600 pixels (1015×951 millimeters)
To use OR when you are doing a grep search use the \| characters to separate the items you are searching for.
cat text_to_search_in | grep 'first\|second\|third'
You want to update your dns resolution locally after some change in DNS.
You want to do this because your local dns cache still holds the old information about the domain. For example using your local dns and the google one returns two different results
host changed_domain.com returns the old ip host changed_domain.com 8.8.8.8 returns the new ip.
Check your systemd-resolved is active:
sudo systemctl is-active systemd-resolved active
Get some statistics:
sudo systemd-resolve --statistics Transactions Current Transactions: 0 Total Transactions: 38818 Cache Current Cache Size: 73 Cache Hits: 21120 Cache Misses: 19745 DNSSEC Verdicts Secure: 0 Insecure: 0 Bogus: 0 Indeterminate: 0
Flush the cache (make the Current Cache Size above 0)
sudo systemd-resolve --flush-caches
Check the cache again (should be 0 now):
sudo systemd-resolve --statistics ransactions Current Transactions: 0 Total Transactions: 38818 Cache Current Cache Size: 0 Cache Hits: 21120 Cache Misses: 19745 DNSSEC Verdicts Secure: 0 Insecure: 0 Bogus: 0 Indeterminate: 0
Information taken from https://www.techrepublic.com/article/how-to-flush-the-dns-cache-on-linux/
Using the asdf version manager to manage versions of various binaries like terraform, vault or packer is easily done by following the instructions below:
asdf plugin add terraform asdf install terraform latest asdf global terraform 0.14.9 asdf list terraform 0.14.9 terraform --version Terraform v0.14.9
Problem
You would like to rename multiple files, replacing some text with something else (like replacing Pixies_The with Pixies).
Solution
Install the rename utility
sudo apt install rename
and replace the text as follows
cd folder_to_rename_files rename 's/Pixies_The/Pixies/g' **
To get or set in environment variables the platform information of a system you can use the following:
export ARCH=$(case $(arch) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(arch) ;; esac) export OS=$(uname | awk '{print tolower($0)}')
Taken from the installation instructions of the Operator SKD here: https://master.sdk.operatorframework.io/docs/installation/