Shutdown Proxmox VM using CLI

If you’re looking to shut down a virtual machine running on a Proxmox Virtual Environment (PVE), you can use the Proxmox command-line interface (CLI) to accomplish this task quite effectively. The command for shutting down a VM in Proxmox is qm shutdown, followed by the ID of the virtual machine you’d like to shut down. Here’s how to do it: Access the Server: First, log in to your Proxmox server via SSH. ...

17 October 2023 · 2 min · 226 words · Me

How to count number of words in a pdf file from Linux cli

Using pdftotext: Installation: If it’s not installed, you’ll need to install the poppler-utils package which includes pdftotext. sudo apt install poppler-utils or yum install poppler-utils depending on your distribution. Usage: Once installed, you can convert a PDF to text and then count the words as follows: pdftotext input.pdf - | wc -w Here, input.pdf is your source PDF file, and wc -w counts the number of words. The - in pdftotext specifies that the output should be sent to stdout, which is then piped into wc. ...

5 September 2023 · 3 min · 528 words · Me

How to avoid other pods from being scheduled on your node in Kubernetes

Kubernetes is a powerful platform for managing containerized applications across a cluster of nodes. However, sometimes you may want to have more control over which pods are scheduled on which nodes, for various reasons such as performance, security, or cost. What are taints and tolerations? Taints and tolerations are a feature of Kubernetes that allow you to mark nodes with certain attributes or conditions, and then specify which pods can or cannot be scheduled on those nodes based on those attributes or conditions. Taints are applied to nodes, and tolerations are applied to pods. ...

13 July 2023 · 4 min · 650 words · Me

How to get a remote server SSL certificate

openssl s_client -connect {HOSTNAME}:{PORT} -showcerts

15 June 2021 · Shafiq Alibhai

Replace all dots in filenames except the extension on Linux

for f in .; do pre="${f%.}"; suf="${f##.}"; mv -i -f -- "$f" "${pre//./_}.${suf}"; done

21 January 2021 · Shafiq Alibhai

Count number of directories in the current directory using Linux cli

ls -1 | wc -l

14 July 2020 · 1 min · 5 words · Shafiq Alibhai

Count number of files in a directory using Linux cli

ls -l . | egrep -c '^-'

14 July 2020 · Shafiq Alibhai

Fix casks with `depends_on` that reference pre-Mavericks

If you get an error of the type Error: Cask 'hex-fiend-beta' definition is invalid: invalid 'depends_on macos' value: ":lion", where hex-fiend-beta can be any cask name, and :lion any macOS release name, run the following command: /usr/bin/find "$(brew --prefix)/Caskroom/"*'/.metadata' -type f -name '*.rb' -print0 | /usr/bin/xargs -0 /usr/bin/perl -i -pe 's/depends_on macos: \[.*?\]//gsm;s/depends_on macos: .*//g' This will remove all depends_on macos references of installed casks.

18 May 2020 · Shafiq Alibhai

How to run VLC player as root user

sed -i 's/geteuid/getppid/' /usr/bin/vlc Explanation: The initialization script check if the UID is equals to zero. Zero is reserved for the root user. Using sed to replace geteuid for getppid fools the initialization script because it is always > 0. While running the VLC as root is not recommended, it works. Be aware of the risks and obviously do not do it for production environments.

18 May 2020 · Shafiq Alibhai

NPM update all globally installed packages

npm update -g

22 December 2018 · Shafiq Alibhai