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 ...

XMLLINT for HTML: Cleaning up the HTML Code

Getting That MESS Cleaned Up! In an earlier post, we learned about xmllint .  Today, I want to talk about cleaning up the code for an HTML file. When we have an xml file, xmllint is used.  For an html file, we use the following command in the command line: xmllint --html <filename goes here>         Here is an actual command on my command line for running xmllint for my StedmanLesson10.html file. In the photo above, you see that I start off the command with xmllint. The next thing is a space and then a --html.  The two -- are two hyphen-minus characters that are used to specify long options (Basically there are options that can be used within xmllint.  The two hyphen-minus characters are saying an option is going to be used.  In this case, that option will be html - because we are going to do an xmllint on an html file). After that you see a space and then the name of the html file I want t...

GIT Commands: Pull, Add, Commit, Push.....and sometimes Revert

Pull, Add, Commit, Push ...... then Repeat We talked about GIT, GIT Hub , and the three different areas GIT works in.  Now it is time to talk about some of the most used GIT commands.   I am currently working with a team on a project called Stedman.  We are all using the GIT Hub server to track our work as we make changes to the files within the Stedman project.   Many changes can be made by other members of the team, from the time I sign off to the time I sign back on.  How do I get the changes they made to a file I need to work on, onto my computer? ENTER GIT COMMANDS : 1.  The first thing I do is goto my command window on my computer and navigate to the directory where the file I want to work in is located (this will be a directory that is being tracked by GIT).   *If you need a quick refresher:  cd file_name   will take you through each of your directories until you reach your desired loca...