Categories
Mac Samuel

Running List Of Shortcuts In Mac Big Sur 11.2.3

Change Host File:

  • Open up terminal and type: sudo nano /etc/hosts
  • Make the needed change in the file to change the host of a website. This is simply writing the IP address of the server, space, the domain name. So in effect it looks like 000.000.00 domain.com
  • Hit control x to close the file. Press Y plus ENTER to save the changes
  • Type: sudo killall -HUP mDNSResponder followed by Return to flush the DNS cache.
  • navigate to the website you want to see

Change Version of PHP in Use With Laravel Valet:

  • Open terminal and navigate to the project you are working on
  • Type: Valet use php@7.2 (or whatever version of PHP you want to activate)

Serving Local Websites From Nested Folder with Laravel Valet:

  • Open iTerminal and navigate to the subfolder where the site lives
  • run valet link folder-name. This will create a symlink to this site so that you can then open up the web browser and type foler-name.test and the site will serve

Opening files in the finder window:

  • option + space to open the alfred search finder
  • ~ + file name, so for example ~ repos gets me to code repo folder
  • once the folder that you want is visible hit command + enter to open it up in the finder winder

Open MySQL from command line & create a new database:

  • from the terminal window type: mysql (this will login to mysql)
  • then type: create database db-name; (replace db-name with the real name of the database you want to create and then press return to create the DB)
  • Once the database has been created open up sequel pro and input the DB name + root and click connect
  • If you need to import a database from staging or live down to local you can do that by clicking file -> import

Ignore a file in any repo – especially useful it the file has been added to gitignore and it is still tracking changes

git update-index --assume-unchanged -- wp-config.php

or you can run:

git update-index --skip-worktree -- wp-config.php

or for a directory you can run:

git update-index --assume-unchanged -- wp-content/plugins/
git update-index --skip-worktree -- wp-content/plugins/

*If you have a really stubborn file you can use:
git update-index --force-remove wp-config.php

Open up Alias file (or any file) with sublim text from the command line:

  • This is pulled from this video: https://laracasts.com/series/setup-a-mac-dev-machine-from-scratch/episodes/7
  • Once you follow the steps in that video you can then run the following command to open the alias file in sublime: subl . ~/.aliases
  • This command can be used to open any file as well just replyce the ~/.aliases with “filename”
  • ***If ever having trouble opening files up with subl . then just open up transmit and the .aliases file will be right there in the local root and just right click and open it up with sublime***

Open up Alias file with Vim

  • vim ~/.aliases
  • press shift i to start inserting new lines
  • when done and ready to save press esc then shift :
  • to quit without saving type q then hit enter
  • to quit and save press wq and then hit enter

Take a screenshot and copy to the clipboard

control + command + shift + 4