More and more web tools and your work flow are moving to the command line. Tools like Grunt, Bower, Yeoman, Sass/Compass and many more now live on the command line. While some of them have GUI interfaces, most stay where they began.
If you are fairly new to web development, and you are looking to take your skills to the next level, the command line is going to become your friend(or foe) fairly quickly. It is something that is pretty new to me as well. So lets take a look at some of the most basic unix commands and how you might use them. And in future posts we will explore more complex commands and usages. Please note that these commands are for a unix environment, most of these will not work for windows, sorry.
ps. If you are not familiar with unix, take a look at this wikipedia article to get a better understanding of the environment you will be working in!
Navigation
ls
ls
is used to list the directory. This is pretty simple, but useful.
$ ls
Adobe Acrobat XI Pro Downloads Pictures
Applications Dropbox Public
Box Documents Library Samsung
Desktop Movies Sites
Documents Music
There are some useful flags that come along with ls
. ls -l
will print out the directory in long format. Using the ls -a
tag will print out any .
files. Flags can be used like ls -l -a
, or if you are using more than one flag, you can string them together. Like such ls -la
. Want to know what is in a directory which out moving into it? ls -la Sites/
, this will list the files in that directory.
pwd
This is a simple command, it just prints out the present working directory, so if you get lost you can use pwd
and it will let you know where you currently are in the system.
cd
Listing the directory is no good unless you can go somewhere. That is where cd
comes in. cd
is used to change directories. Something to note is that when you start up a new terminal you are in your home folder. This will usually be /Users/yourname
using the ls
or pwd
you can get an idea of where you are and where you want to go. It is as simple as using the cd
like such cd Desktop/Projects/
, to move back a directory you would use ..
$ cd Desktop/Projects
$ pwd
$ /Users/Rchristiani/Desktop/Projects
$ cd ..
$ pwd
$ /Users/Rchristiani/Desktop
You can also use the ..
in a more complex manner, something like:
$ pwd
$ /Users/Rchristiani/Desktop/Projects/SomeSite/js
$ cd ../../
$ pwd
$ /Users/Rchristiani/Desktop/Projects
Also if you know that using cd ../..
gets you to a certain point you can then go into a folder, cd ../../newsite
. If you are not sure what the directory you need to into is called, double tapping the tab key will work like the ls
command.
These are a few of the most basic commands you might use. Next time I will look into at some more advanced commands and usage!
Pingback: Getting started with Grunt and Sass - Ryan Christiani | Front-End Dev()
Pingback: Advanced Beginner Command Line Commands - Ryan Christiani | Front-End Dev()
Pingback: Getting started with Gulp and Sass - Ryan Christiani - Front-End Developer - Ryan Christiani – Front-End Developer()