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

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

One liner: To get available virtual memory

vmstat -s -SM | grep "free memory" | awk -F" " '{print$1}'

10 December 2011 · Shafiq Alibhai

Perl – system load

To find the system load use the following perl snippet : System load of last one minute : my $system_load = exec('<a class="zem_slink" title="Uptime" rel="wikipedia" href="http://en.wikipedia.org/wiki/Uptime">uptime</a> | awk -F "load average: " \'{ print $2 }\' | cut -d, -f1'); my $system_load = qx('uptime | awk -F "load average: " \'{ print $2 }\' | cut -d, -f1'); System load of last 5 minutes : my $system_load = exec('uptime | awk -F "load average: " \'{ print $2 }\' | cut -d, -f2'); my $system_load = qx('uptime | awk -F "load average: " \'{ print $2 }\' | cut -d, -f2'); System load of last 15 minutes : my $system_load = exec('uptime | awk -F "load average: " \'{ print $2 }\' | cut -d, -f3'); my $system_load = qx('uptime | awk -F "load average: " \'{ print $2 }\' | cut -d, -f3');

7 September 2010 · Shafiq Alibhai

Preserve File Permissions While Copying Files in Linux

Following is the command : cp -p /aaa/bbb /ccc/ddd

14 June 2010 · Shafiq Alibhai

How to Identify Your Linux Distribution and Version with Simple Commands

If you are using a Linux-based operating system and you want to know which specific distribution and version you have installed, there is a simple command that can help you with that. Just open a terminal window and type the following: cat /etc/issue This will display the name and the release number of your Linux distribution. For example, if you are using Debian 4.0, the output will look like this: ...

23 March 2010 · Shafiq Alibhai