Table of Contents
Python's website has a MacOS Python 3 installer we can download and use. If we use the package installation, a python3 fill will be at available in /usr/local/bin/.
Open ~/.bash_profile file.
vi ~/.bash_profile
Then put the alias as follows:
alias python='python3'
Now save the file and then run the ~/.bash_profile file.
source ~/.bash_profile
Congratulation !!! Now, you can use python3 by typing python.
python --version
Python 3.7.3
https://ss64.com/osx/
Amazon Corretto 21 is installed in /Library/Java/JavaVirtualMachines/.
sudo nano ~/.bash_profile
//or
/usr/libexec/java_home --verbose
export PS1="[Amin $]> "
alias python='python3'
export MYSCRIPTS="/Users/mohamed/amroot/env"
export JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-25.jdk/Contents/Home
export M2_HOME=/Users/mohamed/amroot/sw/apache-maven-3.8.1
# Setting PATH for Python 3.8
# The original version is saved in .bash_profile.pysave
PATH="${MYSCRIPTS}:/Library/Frameworks/Python.framework/Versions/3.11/bin:$M2_HOME/bin:$JAVA_HOME/bin:${PATH}"
export PATH
export COLOR_NC='\e[0m' # No Color
export COLOR_BLACK='\e[0;30m'
export COLOR_GRAY='\e[1;30m'
export COLOR_RED='\e[0;31m'
export COLOR_LIGHT_RED='\e[1;31m'
export COLOR_GREEN='\e[0;32m'
export COLOR_LIGHT_GREEN='\e[1;32m'
export COLOR_BROWN='\e[0;33m'
export COLOR_YELLOW='\e[1;33m'
export COLOR_BLUE='\e[0;34m'
export COLOR_LIGHT_BLUE='\e[1;34m'
export COLOR_PURPLE='\e[0;35m'
export COLOR_LIGHT_PURPLE='\e[1;35m'
export COLOR_CYAN='\e[0;36m'
export COLOR_LIGHT_CYAN='\e[1;36m'
export COLOR_LIGHT_GRAY='\e[0;37m'
export COLOR_WHITE='\e[1;37m'
export PS1="[${COLOR_YELLOW}Amin \[${COLOR_GREEN}\]$\[${COLOR_WHITE}\]]> "
alias python='python3'
export MYSCRIPTS="/Users/mohamed/amroot/env"
export JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-25.jdk/Contents/Home
export M2_HOME=/Users/mohamed/amroot/sw/apache-maven-3.8.1
# Setting PATH for Python 3.8
# The original version is saved in .bash_profile.pysave
PATH="${MYSCRIPTS}:/Library/Frameworks/Python.framework/Versions/3.11/bin:$M2_HOME/bin:$JAVA_HOME/bin:${PATH}"
export PATH
sudo nano ~/.zshrc
export PS1="%F{blue}% amin: %F{green} $>%f"
Do you hate having to do mkdir something and then cd something? Add this function definition to your ~/.zshrc
mkcd () {
mkdir -p $@ && cd ${@:$#}
}
In a new shell session (or re-load your config in your existing session with source ~/.zshrc) you can simply just do
mkcd something
brew install putty
This will also install puttygen. To get puttygen to output a .PEM file:
puttygen privatekey.ppk -O private-openssh -o privatekey.pem
The private key must have tight security settings otherwise SSH complains. Make sure only the user can read the key.
chmod go-rw privatekey.pem
IP Tables https://www.howtogeek.com/177621/the-beginners-guide-to-iptables-the-linux-firewall/killall NotificationCenter
$> security find-generic-password -wa "wifinetworkname"
$> security find-generic-password -wa "wifinetworkname" | pbcopy
copy to clip board: cmd + ctrl + Shift + 4
edit file /etc/pam.d/sudo
sudo nano /etc/pam.d/sudo
Add Line
auth sufficient pam_tid.so
Issue : when i sudo and give my finger scan i do get to root but terminal gets switched to sh instead of .zshrc and i loose all the prompt formating like so
Last login: Tue Nov 21 20:09:35 on ttys001
amin: $>sudo su
after finget scan auth
%F{blue}% amin: %F{green} $>%f
Cause :
issue with your shell prompt and environment variables not loading correctly when switching to the root user with sudo after using fingerprint authentication is related to how the root user's shell is configured. By default, the root user typically uses a different shell than your regular user.
FIX
Check the Shell for the Root User:
To determine the shell used by the root user, you can execute the following command: sudo echo $SHELL
Update Root User's Shell:
If the root user is using a different shell (e.g., /bin/sh) and you want it to use the same shell as your regular user (/bin/zsh), you can change the root user's shell using the chsh command. For example:
sudo chsh -s /bin/zsh root
Configure Root User's Shell:
After changing the root user's shell, you may want to copy your custom .zshrc configuration to the root user's home directory (typically /root) if you want the same prompt and environment settings to apply to the root user.
sudo cp ~/.zshrc /root/. ( Linux)
sudo cp ~/.zshrc /var/root/ ( MAC)
You can just use exec to replace your current shell with a new shell:
Switch to bash:
exec bash
Switch to zsh:
exec zsh
With your `kill -9` command, you needed to specify that `kill -9` forcefully kills a process without giving it a chance to gracefully exit/terminate.
You never NEVER want to use `kill -9` for ending just any process. Using regular `kill` will at least give the process a chance to clean up after itself. If you use `kill -9` you could run the risk of heaps of memory being stuck in RAM or open files that couldn't close, which could cause further processes hanging, like Finder trying to figure out why a file is open and not able to be accessed.
Create a new file, curlt, somewhere in your executable path, i have env folder mapped to path so i create this file there and paste in:
#!/bin/bash
curl -w @- -o /dev/null -s "$@" <<'EOF'
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n time_total: %{time_total}\n
EOF
i gave execute perm to the file after cd to the env dir :
chmod 755 *
Then call it the same way as the alias:
curlt www.ameen.guru
$> youtube-dl -f bestvideo+bestaudio <URL>
for file in *.jpg; do convert $file resize 50% small-$file; done
convert is imagemagick command , it can resize based on % or resolution e.g 1920 ( will maintain aspect ratio)
dns-sd -Q domain.com
Terminal 1
sudo su dns-sd -Q domain.com
terminal 2
sudo su killall -HUP mDNSResponder