Cmd.gs

my digital notepad

cmd: bashtop

August 07, 2020 — cmcipriano

a cool replacement for top or htop

to install, make sure you have homebrew, if not you got to install it. $: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

then, install python3 $: brew install python3

and some dependencies $: brew install bash coreutils gnu-sed git osx-cpu-temp

some more dependencies $: python3 -m pip install psutil

now, let's install it for real $: git clone https://github.com/aristocratos/bashtop.git
$: cd bashtop
$: sudo make install

to remove, just do $: sudo make uninstall

Tags: terminal-commands, monitoring

cmd: nano

August 02, 2020 — cmcipriano

here is a neat way to implement syntax highlighting and line numbers in nano

first you need to install the latest nano, you can do this via brew $: brew install nano

then export the binary path $: nano ~/.bash_profile

then append this line export PATH="/usr/local/bin:$PATH"

this line should give you access to the installed nano app

run this command to install the syntax highlighter $: curl https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh | sh

once done, edit your .nanorc $: nano ~/.nanorc

then append this line to the bottom of the file set linenumbers

here are some other setting you might want to implement as well set tabsize 4
set tabstospaces
set autoindent
set smooth
set atblanks
set constantshow
set mouse
set softwrap
set showcursor
set trimblanks
set nonewlines

Tags: terminal-commands, text-editor, code-editor

cmd: starship

July 28, 2020 — cmcipriano

a simple way to colorize your bash terminal. $: brew install starship

once installed, edit your .bash_profile or .bash_rc $: nano ~/.bash_profile

or $: nano ~/.bash_rc

then add this line eval "$(starship init bash)"

Tags: terminal-commands

cmd: speedtest

July 21, 2020 — cmcipriano

install speedtest, so you can perform speed-test on your commandline interface $: brew tap teamookla/speedtest

then install speedtest app $: brew install speedtest

to run this app, simply call speedtest on your terminal $: speedtest

Tags: terminal-commands

cmd: vagrant

July 20, 2020 — cmcipriano

to install Vagrant, you need to get VirtualBox first on your system $: brew cask install virtualbox

install Vagrant $: brew cask install vagrant

then the Vagrant Manager $: brew cask install vagrant-manager

here are some commands:

initialize: $: vagrant init generic/debian10

start the vm: $: vagrant up

ssh to the vm: $: vagrant ssh

halt/stop the vm: $: vagrant halt

suspend the vm: $: vagrant suspend

destroy the vm: $: vagrant destroy

note: you would need to perform the above commands inside the vm's directory.

Tags: terminal-commands

cmd: wp-cli

July 14, 2020 — cmcipriano

install wordpress-cli from commandline $: curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

make it executable $: chmod +x wp-cli.phar

the put it on your binary folder $: mv wp-cli.phar /usr/local/bin/wp

for additional help, here is the bash autocomplate $: curl -O https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash

make it an executable $: chmod +x wp-completion.bash

then put it on your bash autocomplete directory $: mv wp-completion.bash /usr/local/etc/bash_completion.d

Tags: terminal-commands, wordpress

cmd: googler

July 14, 2020 — cmcipriano

search google using commandline, you may want to install googler. $: brew install googler

see options $: googler --help

Tags: terminal-commands, google

cmd: brew

July 14, 2020 — cmcipriano

install brew $: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

once brew is installed, you can now install applications using brew $: brew install {app}

to search for an application $: brew search {app}

to update $: brew update

to upgrade $: brew upgrade

to uninstall $: brew remove {app}

to clean up $: brew cleanup

to check for installed packages $: brew deps --tree --installed

Tags: terminal-commands

cmd: wdiff

July 14, 2020 — cmcipriano

do a colored diff result using wdiff.

to use $: wdiff one.txt two.txt --no-common -n -w $'\033[30;41m' -x $'\033[0m' -y $'\033[30;42m' -z $'\033[0m'

Tags: terminal-commands

How: SSL checking

July 14, 2020 — cmcipriano

This is how to check if the SSL certificate matches the private key.

for SSL certificate $: openssl x509 -noout -modulus -in file.crt | openssl md5

for RSA private key $: openssl rsa -noout -modulus -in file.key | openssl md5

for CSR $: openssl req -noout -modulus -in file.csr | openssl md5

make sure the md5 hash would all be the same.

Tags: terminal-commands

cmd: nmap

July 13, 2020 — cmcipriano

calculate all the ips on a cidr using nmap $: nmap -sL {*} | grep 'Nmap scan report' | awk '{print \$NF}' | cut -d '(' -f 2 | cut -d ')' -f 1

where {*} is the CIDR

Tags: terminal-commands

cmd: find

July 13, 2020 — cmcipriano

some useful find commands.

Remove all empty files $: find . -size 0 -delete

Remove all .DS_Store files $: find . -name '.DS_Store' -type f -delete

Remove all files that are more than 30 days old $: find . -ctime +30

Tags: terminal-commands