Last active
February 8, 2018 03:58
-
-
Save evanhutomo/b11756a6b4891628aa03 to your computer and use it in GitHub Desktop.
bash note for personal use
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fix MAMP common issue, myslq wont start but apache is start | |
killall -9 mysqld | |
# check bash type | |
/usr/bin/printenv | |
# node and npm path, write on .bash_profile | |
echo 'export PATH=$PATH:/usr/local/bin' >> $HOME/.bash_profile | |
# uninstall npm package | |
npm -g uninstall <name> --save # globally | |
npm uninstall <name> --save # locally | |
# see all installed packages | |
dpkg -l | |
# change keyboard layout | |
https://www.raspberrypi.org/forums/viewtopic.php?f=6&t=5278 | |
# setup wifi via terminal | |
http://www.howtogeek.com/167425/how-to-setup-wi-fi-on-your-raspberry-pi-via-the-command-line/ | |
# configure network interface | |
ifconfig | |
# open wifi manager raspberry pi | |
wpa-gui | |
# get more detail wireless interfaec | |
iwlist | |
# automatic configuration sudo apt-get install | |
# if we facing error like E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. | |
dpkg --configure -a | |
# fix broken package | |
apt-get install -f | |
# to customize prompt mac | |
1. nano .bash_profile | |
2. add line | |
export PS1="<string_that_you_want>" | |
3. save | |
# mount usb | |
# 1. after you plug usb on raspi, if there no autorun, run this command | |
ls -l /dev/disk/by-uuid/ | |
# then check if there was a "sda", thats your usb FD | |
# 2. create mount point | |
sudo mkdir /media/[name_up2u] | |
# 3. manually mount the drive | |
sudo mount /dev/sda/ /media/usb/ -o uid=pi,gid=pi | |
# 4. open window form terminal | |
xdg-open /media/[name_up2u] | |
# 5. unmount | |
umount /media/usb | |
# open current directory on mac | |
open . | |
# delete all files in this current path except file with *txt | |
find . -type f -not -name '*txt' | xargs rm | |
# connect mysql | |
mysql -u root -p | |
# download file on vps | |
scp {user}@{server}:{remote file} {local destination directory} | |
vice versa if you want to upload | |
# check current type of shell | |
echo $0 | |
or | |
ps -p $$ | |
# check current shell path | |
echo $SHELL | |
# steps to change your shell into zsh | |
http://sourabhbajaj.com/mac-setup/iTerm/zsh.html | |
# make a bash script | |
1. write a #!/bin/bash on the top of the line | |
2. write down your script | |
3. save it on /usr/local/bin with <filename>.sh | |
4. chmod u+x <filename>.sh, so your file could be execute | |
5. check your PATH in .bash_profile, are the /usr/local/bin been writed down on your PATH chains. | |
# GITHUB pull, remove, and push edit | |
cd /tmp | |
git clone /your/local/rep # make a temp copy | |
cd rep | |
git rm -r * # delete everything | |
cp -r /your/local/rep/* . # get only the files you want | |
git add * # add them again | |
git status # everything but those copied will be removed | |
git commit -a -m 'deleting stuff' | |
cd /your/local/rep | |
git push | |
# cek SSH di ~/ | |
ls -al ~/.ssh | |
# copy something to clipboard, in this case I wanna to copy my SSH | |
pbcopy < ~/.ssh/id_rsa.pub | |
# reset commit | |
git reset HEAD~ | |
# reset commit dalam keadaan kalau di current local repo masih ada commit | |
git reset --hard HEAD~1 | |
# Executing BASH file (.sh) | |
chmod +x 'path/yourscript.sh' | |
./yourscript.sh | |
# Create CSR | |
openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment