Your command line welcomes you with a prompt. Default OSX terminal may look like this. PS1 is the variable used by your shell to determine your command line prompt RPS1 determines your right hand prompt. Note, you can always `echo` this variable to see what these are currently set to. By default, mine is set to…
All posts in Unix
Delete files by filename with “find”
When you upload photos multiple times, the computer can start numbering the photos. IMG_A becomes IMG_A 1 and IMG_A 2 and IMG_A 3. Using a wildcard * and specifying the ending space and number will help you select the files. For example: Find all the files that end in “space”1.JPG find -name ‘* 1.JPG’ * Have a look at the…
Set up your programming environment
*wip Must have for your Mac Get homebrew – no longer drag an icon to install Homebrew – “the missing package manager for macOS” will make it so much easier to download, upgrade and maintain your packages. It will install packages super transparently in /usr/local/Cellar/* and symlink commands to /bin. Must have for node.js nvm a…
Weather reports from your terminal with curl
What is curl? curl is a program that is included in your Mac OSX distribution used for transferring data from or to a server. It uses many supported protocols (HTTP, HTTPS, FTP, SMTP and more). Do you have curl? Find the location of the curl program (executable) with $ which curl. This will return /usr/bin/curl if…
How to protect your files from deletion
I wrote about this before, but its important enough to write twice How to revoke write permissions to a directory How to revoke your own user permissions $ chmod u-w dirname How to delete all permissions from anyone on your system $ chmod a-w dirname removing write access on a file does not stop it from…
Intro to OSX File Management Commands
Filenames can have spaces! So when you deal with them either surround the filename with apostrophes like this: “my file name.txt” or escape the spaces my\ file\ name.txt. Otherwise, don’t create new file names with spaces or escape characters to keep your sanity. Wildcards * greedy wildcard ? single character wildcard [] single character list of wildcards {} pattern list of…
Intro to your OS X Filesystem and Permissions
How to find home note: as a user of the system you will be given a user directory under the Users directory $ echo $HOME How to go to the home directory choices: $ cd $HOME, $ cd ~, $ cd, and $ cd then drag your home directory from your Finder window How to go to the…
Mac Unix Command Basics for Beginners
These are useful unix commands that are entered through a Terminal shell prompt. These commands are actually names of Unix programs that usually sit in a folder called /bin where am i? pwd How to check the current directory $ pwd learn more about anything – man How to bring up the manual page for a command:…
Top 10 bash_profile aliases
You are operating with limited time and limited brain power to finish your programs with enough time to go outside and breath fresh air Knowing this, its way too tedious to type out commands like git diff –cached which can be shortcut to gdc with an alias. An alias will allow you to create shortcuts with your own command…
Symbolic Links, symlinks, files that point to files
Sometimes, when working with directories and files, we want to reference the same file in a different directory. This is most apparent when you want to upload dotfiles and config on github so you can backup and pull down these onto any computer. Lets get started and you’ll see how my setup will help your…