Posts

Make MacOS zsh shell to be compatible with bash shell commands

Enable it temporarily in current shell / terminal # Load Zsh's native completion system, then load the Bash compatibility bridge autoload -Uz compinit && compinit autoload -Uz bashcompinit && bashcompinit Enable it automatically by adding the above commands to ~/.zprofile or ~/.zshrc file 

Define and Execute custom shell function on Unix Bash or Mac Zsh

Add the below function to ~/.bash_profile or ~/.zprofile file # Continuously print the current timestamp until Ctrl+C is pressed clockon() {     # Clear the screen initially (optional)     clear     echo "Press [CTRL+C] to stop."     echo "------------------------"          while true; do         # \r overwrites the current line instead of scrolling down         printf "\rCurrent Time: %s" "$(date '+%Y-%m-%d %H:%M:%S')"         sleep 1     done } Source the file or close and reopen the Terminal     source ~/.bash_profile  or      source ~/.zprofile List the function available on the shell     compgen -A function | grep 'clockon' Execute the function     clockon  

Apple MacOS allow downloaded programs to run

In MacOS, when we try to run a standalone program or open an app downloaded from Internet, then MacOS's security will prevent us from running the program. In order to execute the program or app, the following commands can be executed in Terminal to remove the quarantine attribute associated with the file. Unblock a standalone program sudo xattr -d com.apple.quarantine /path/to/your/program Unblock an app Recursively remove the attribute in the app bundle sudo xattr -rd com.apple.quarantine /path/to/YourApp.app

Apple MacOS Finder show hidden files and directories

MacOS Finder app has built-in ability to display hidden files and directories, but there is no UI options or settings to toggle the feature on/off. Instead we have to use keyboard shortcut or Terminal command to toggle the display of hidden files and directories. Toggle the display of hidden files or directory using the following shortcut in Finder : Command+Shift+.(dot) key To make the Finder to permanently display hidden files and directory, execute the following command in Terminal defaults write com.apple.Finder AppleShowAllFiles true && killall Finder To make the Finder to permanently hide hidden files and directory, execute the following command in Terminal defaults write com.apple.Finder AppleShowAllFiles false && killall Finder

Ubuntu (Linux) Desktop using RDP GUI with Windows WSL

Image
This article explains the steps to setup Ubuntu virtual machine with Desktop environment on Windows using Window's Subsystem for Linux (WSL) and be able to connect to Ubuntu using Window's builtin Remote Desktop Protocol (RDP) app. Youtube video A step by step visual guide of these steps is available in the below youtube link https://youtu.be/F6quxWDX7Hc Enable WSL on Windows: Enabling the features can be done only using administrator user. In corporate laptop or enterprises, this step is performed by Windows Administrator. Through GUI: Start -> Search -> Turn Windows feature on or off Virtual Machine Platform -> Tick Windows Hypervisor Platform -> Tick Window Subsystem for Linux -> Tick Click OK Wait for some installations to complete Restart Windows Through Terminal: dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart dism /online /enable-feature /featurename:HypervisorPlatform /all /norestart dism.exe /online /enable-feature /f...

Install Java JDK on Linux or MacOS

This article explains the steps involved to install Java JDK on Linux or MacOS. Get the architecture of the Machine from Terminal using: uname -m Create a directory for installation: mkdir -p $HOME/tools/java Download latest java LTS binary: Download java 25 binary for Linux / Mac OS operating system with the correct architecture type to directory $HOME/tools/java Download URL https://adoptium.net/en-GB/temurin/releases?mode=filter&os=any&arch=any Extract and rename java binary: find $HOME/tools/java -type f -name OpenJDK25*.tar.gz | xargs -I {} mv {} $HOME/tools/java/OpenJDK25.tar.gz tar -xvzf $HOME/tools/java/OpenJDK25.tar.gz -C $HOME/tools/java find $HOME/tools/java -type d -name jdk-25* | xargs -I {} mv {} $HOME/tools/java/jdk-25 Make the extracted binaries as executables: chmod a+rwx -R $HOME/tools/java/* Identify the shell used in the Terminal using: echo $SHELL Configure PATH: Add the following lines to $HOME/.bash_profile or $HOME/.bashrc or $HOME/.zprofile based on ...

Maven - Manual installation on Linux or MacOS

This article explains the steps to manually install a specific version of maven downloaded directly from maven website or internal artificatory of an organisation. Create a directory for installation: mkdir -p $HOME/tools/maven Download the binary: From https://maven.apache.org/download.cgi download latest static binary eg: apache-maven-3.9.11-bin.tar.gz to $HOME/tools/maven directory Extract and rename the binary: find $HOME/tools/maven -type f -name apache-maven-*.tar.gz | xargs -I {} mv {} $HOME/tools/maven/apache-maven-bin.tar.gz tar -xvzf $HOME/tools/maven/apache-maven-bin.tar.gz -C $HOME/tools/maven find $HOME/tools/maven -type d -name apache-maven-* | xargs -I {} mv {} $HOME/tools/maven/apache-maven Make files executable: chmod a+rwx -R $HOME/tools/maven/* Identify the shell type: echo $SHELL Configure PATH: Add the following lines to $HOME/.bash_profile or $HOME/.bashrc  or  $HOME/.zprofile  and restart system for the changes to take effect export MAVEN_HOME=$...