Archival Notice
This guide was written as a sysadmin reference cheatsheet for legacy CentOS 7, VMware ESXi 6.5, and 7zip CLI utilities. Please note that command parameters and underlying script wrappers may vary across newer software releases. Please adapt syntax to your specific operational requirements.
Every systems administrator maintains a personal collection of indispensable CLI commands, automation one-liners, and configuration cheatsheets. Having instant access to exact command parameters saves critical time during infrastructure outages or complex maintenance windows.
In this definitive cheatsheet, I have consolidated four essential sysadmin operational workflows: managing VMware ESXi licenses and VM inventories via vim-cmd, automating IPsec/L2TP VPN server deployments, splitting and updating large archives using 7za, and executing advanced domain scraping scripts using awk and grep.
1. VMware ESXi CLI Administration Cheatsheet (vim-cmd)
When logged into the ESXi shell directly, vim-cmd provides low-level administrative control over your hypervisor inventory and licensing.
Querying and Assigning ESXi License Keys
# Display active license details
vim-cmd vimsvc/license --show | egrep "name|serial:"
# Assign new enterprise license key and verify
vim-cmd vimsvc/license --set XXXXX-XXXXX-XXXXX-XXXXX-XXXXX && vim-cmd vimsvc/license --show | egrep "name|serial:"
Generating Bulk VM Summary Reports
Iterate through all active virtual machines on your hypervisor and output a clean summary report containing vCPU allocation, VM name, and IP addressing:
for i in `vim-cmd vmsvc/getallvms | grep -v Vmid | awk '{print $1}'`; do
vim-cmd vmsvc/get.summary $i | egrep "numCpu|name|ipAddress"
echo "---------"
done
Configuring PowerShell Global Web Proxies
When automating vSphere environments via PowerCLI behind corporate proxy servers, configure global web proxy pass-through:
export HTTP_PROXY=http://east-dc1-proxy1.induslevel.com:8000
export HTTPS_PROXY=http://east-dc1-proxy1.induslevel.com:8000
[System.Net.WebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy("http://east-dc1-proxy1.induslevel.com:8000")
[System.Net.WebRequest]::DefaultWebProxy.BypassProxyOnLocal = $true
2. Automated IPsec / L2TP VPN Deployment Cheatsheet
To provision a secure IPsec/L2TP VPN server on CentOS 7 instantly without manual IPSec configuration editing, utilize the automated setup-ipsec-vpn wrapper script.
# Download automated IPsec VPN setup script
wget https://raw.githubusercontent.com/hwdsl2/setup-ipsec-vpn/master/vpnsetup_centos.sh
# Configure environment variables with secure credentials
export YOUR_IPSEC_PSK="Randompskkey"
export YOUR_USERNAME="wazeem"
export YOUR_PASSWORD="Randompassword"
# Execute automated installation script
sudo -E bash vpnsetup_centos.sh
3. 7zip CLI Archive Management Cheatsheet (7za)
When backing up large virtual machine disks or configuration directories, standard tar commands cannot easily split files into multi-volume chunks or update existing archives in place.
1. Creating Multi-Volume BZip2 Split Archives (1GB Chunks)
Compress directory u/ into 1000MB split archive files (myzip.zip.001, myzip.zip.002):
# Create 1000MB split zip archive using BZip2 compression
7za a -v1000m -tzip -mm=BZip2 /u/compressed-kb/myzip.zip u/
2. Updating Existing Archives In-Place (Zero Compression Mode)
Update an existing split archive with modified files without recompressing data (-mx=0):
# Update archive in place
7za u -v1000m -tzip -mm=BZip2 -mx=0 /u/compressed-kb/myzip.zip u/
3. Extracting Multi-Volume Split Archives
To extract split archives, point 7za to the first volume file (.001). It will automatically detect and assemble all subsequent volumes:
# Extract multi-volume archive
7za x myzip.zip.001
4. Advanced Text Processing and Domain Scraping Cheatsheet
When parsing large web scraping dumps or syslog files, awk and grep provide absolute flexibility for data normalization and filtering.
1. Filtering and Cleaning Domain Dumps
Extract valid .com domains from an HTML dump, strip unwanted HTTP prefixes, remove numeric digits, and strip dashes:
# Extract .com domains and strip prefixes
cat 02-21-2021-COM.php | grep ".com" | grep -v http | grep -v '=' > domain.txt
# Strip numeric digits and dashes
cat domain.txt | grep -v '[0-9]' | grep -v '-' > withoutdashes.txt
2. Sorting Domains by String Length
Sort a domain list by exact character length in ascending or descending order:
# Sort domains by string length (Descending)
awk '{ print length($0) " " $0; }' withoutdashes.txt | sort -r -n | cut -d ' ' -f 2-
# Sort domains by string length (Ascending)
awk '{ print length($0) " " $0; }' withoutdashes.txt | sort -n | cut -d ' ' -f 2- > sorted.txt
3. Granular Character Length Filtering (awk and grep)
Extract domains matching exact character length constraints:
# Extract domains between 3 and 8 characters in length
awk 'length >= 3 && length <= 8' domain.txt
# Extract domains exactly 10 characters in length using grep regex anchoring
grep -x '.\{10\}' domain.txt
# Extract domains exactly 9 characters in length without numbers or dashes
cat domainlist.txt | grep -v '[0-9]' | grep -v '-' | awk 'length == 9' >> clean-9char-domains.txt
Cheatsheet Active
By maintaining this collection of sysadmin one-liners, you can execute complex virtualization, tunneling, archiving, and text processing workflows with absolute speed and precision!
References
- VMware ESXi vim-cmd Command Reference
- Automated IPsec VPN Server Deployment Script
- 7zip Command Line Syntax Reference