Skip to main content

New DevOps Skills I Learned Today





I know I said my next post would be about XML, but I wanted to go ahead and share this cool thing I just learned about Unix and using my terminal on my MacBook Pro, as well as some basic refresher points.

1.  Create Images from another image
 I never knew about "shift-command-4".  When you press these keys, a little circle with a cross in the middle (it kind of looks like a compass) appears where your mouse pointer is on the screen.  If you position that "compass" to the top left of a picture you want to create (from another image) and then hold the mouse down and drag it to the bottom right corner of the image and then release the mouse, that image you just outlined will be saved to your desktop!  Pretty cool huh? 

2.  Four different ways of naming files   
     So there are four different ways of naming files CORRECTLY.  I say correctly because if you are like me, naming files on your computer the same way you would write it out on paper makes sense right?  Well...not to computers.  It is never good to use spaces or special characters when naming files because it could cause problems.  So what CAN you use?  You can use a hyphen(-), underscore(_), camelCase, or PascalCase to separate your words.  As you can see, I gave you an example of what camelCase is and what PascalCase is.  For me personally, I prefer PascalCase.  It visually makes the most sense to me. 

3.  How to create directories and move files into directories using the mouse.
     Even though I already knew how to create a new file and move files around in my finder, the cool thing I learned today was being able to directly click and drag a file from my desktop right into the directory I wanted it to go in while my finder window was open.  It sure does save a lot of time when there are multiple files to move around.  Another cool thing is to two-finger click on my mac mouse pad while I am on my desktop and options will pop up.  One of those options is to create a "new folder".

4.  Rename files using the Mac mouse trackpad
     If you two finger click down on the track pad on the file you want to rename, options will pop up.  One of those options is to rename your file.  If you click that option, the previous name will be highlighted, and you will be able to rename your file.  
    
5.  Create Directories and move files into directories using the terminal
     Okay... now for a little fun stuff.  I don't know why, but I found this to be really cool.  Instead of making folders and files in my finder, I was taught by my teacher/mentor/profesor/prof/magister 😏
how to make files and folders using the Unix language in my terminal!!!  
      *  Create a NEW folder/directory:   
             In order to create/make a new folder/directory, I used the "mkdir" command.   So if I wanted to create/make a new folder called "Pina Coladas", I would type:  mkdir PinaColadas  (notice how I have it in PascalCase?  Remember we cannot use spaces between words when naming files/folders/etc.).   
      * Create an empty file (for purposes of testing):
           To create an empty file named "TestFile" for the purpose of testing, I need to type: 
touch TestFile     This will give me an empty folder.  To remove/delete it, I will need to do the steps below to remove it.  
       * To change into a directory:
          To change into a directory (meaning to go into a directory) I will need to type the change directory command, which is:  cd  .  So to change into the PinaColadas directory, I would type:  cd PinaColadas   .
       * To back out of a directory:
           To back out of the current directory to return to the parent directory, I will need to type:  
cd ..

6.  Rename and remove files using the terminal
       *  Rename a folder/directory:
            What if I want to change the name of the folder: "PinaColadas" to "FavoriteDrinks"?  I would use the "move" command.  I know that sounds confusing, but I am telling the computer that I am moving a "what"(file) to a "what"(file).  The computer will not be able to locate a folder/directory with FavoriteDrinks because I do not have one, so it will automatically know that I am renaming it by "moving" it to the new name.  So I would type:  mv PinaColadas FavoriteDrinks
       * Remove/delete a directory/file:
           What if I want to delete/remove my FavoriteDrinks folder/directory completely?  I would need to use the "remove" command.  To do that I need to type: rmdir FavoriteDrinks    however, if I want to remove the PinaColadas FILE, then I need to type:  rm PinaColadas 

Follow me as I learn to build my website bit by bit!    IronTreeDev.com

Photo Credit:  Photo by Hannah Joshua on Unsplash

Comments

Popular posts from this blog

XPATH and XPATH Expressions In XMLLINT

XPATH And XPATH Expressions Earlier, I told you about xmllint and xmllint for html files .  Let's say you just want to parse the <span> tags within your html file or just your <span lang="el"> tags? Enter:  Xpath. Xpath is yet another option available within the xmllint language. Remember, an Xpath is used to navigate through elements and attributes in xml and html documents.  Xpath uses Xpath Expressions to select nodes or node sets within a document. Example 1 .  Looking for all of the <span> tags within an html document. xmllint -- html -- xpath " // span" StedmanLesson10.html xmllint = This tells the command line that we are going to be using the xmllint language. space = because we always have space in between commands -- = Remember, these are the two hyphen-minus characters that we need to tell the command line that we are going to use an xmllint option. html = This is the xmllint option we want to

Back To The Basics

Click photo above to see photo clearly  It's Been A LOOONG Minute since I have coded!!   Even so, I decided to give JavaScript another try.  I always seem to do good and then when I get to this one area, I always seem to hit a brick wall.  Well....nothing like getting back up and trying again right?   I decided to try Rithm School's online JavaScript Fundamentals FREE course .  I have never joined their school but their free courses tend to explain things in a way my brain understands it.  💁 To let you know how much I have forgotten in the coding world, I couldn't even remember how to write the basic commands for an HTML document! Yesterday I started the fundamentals free course and I am so glad that I did.  Because of time, I only made it through the JavaScript History and Setup chapter, but that chapter was enough to get my memory flowing again!   It started to feel familiar and I quickly remembered why I enjoyed coding so much.  Yesterday and this morning, I just erased

SCP: Secure Copy Protocol

SCP = Secure Copy Protocol.  What is it and why is it important?   SCP provides a secure way to transfer files from one computer to another. For the project that I'm working on, I needed to SCP (send a copy) the XML files, as well as the image files, from my computer to my EC2 Instance (my web server).  Once done,  my teacher was be able to view my work via my website. Here are the steps to do this: 1.  Open two command windows (the program for my computer is called Terminal). 2.  Let's say the file I want to send is called "SallysFirstDate.xml" and it is located in the "tomy" folder.  Here is where that file lives: /Documents/path/tomy/SallysFirstDate.xml I need to first issue the command to "change directory"(cd) through each folder until I reach the folder that my file is located in.   It would look like this: cd /Documents THEN I need to "cd" again into the "path" folder: cd path THEN I need to "c