Get a free year on Tuts+ this month when you purchase a Siteground hosting plan from $3.95/mo
The command line can be a scary thing to most designers. This is the first in a collection of quick tips, in which we'll break down the barrier to the command line and show you how to use it to speed up your workflow.
While the command line is only one of many tools that can be used by designers, it's one that crosses platforms and is almost universally available being a pure extension of the operating system. These tips are not created in order to advocate the non-usage of other tools, but rather to offer designers who would like to learn more about the command line a place to start.
Traversing and Simple File Manipulation
In the first part of this series, we will give you a quick introduction to traversing your filesystem, as well as creating, deleting, copying, and moving folders and files.
The following points deal with traversing the file system.
- ls - Listing the files in the current working directory.
- cd <directory> - Changes current working path to <directory>, Where <directory> is a path to a directory.
- .. and . - ".." refers to the parent directory of the current working directory, where "." refers to the current working directory
- ~ - "~" refers to the current user's "Home" directory
Simple File Manipulation
The following points deal with deleting, moving, copying, and creating empty files and folders.
- rm - Remove a file. Pass "-r" for recursive, which removes folders and their children files. Note: this does not send items to the trash; it basically irreversibly deletes them, so be sure you know what you're getting yourself into!
- mv - Moves files and folders. First argument passed is the file/folder to be moved; the second is the location to move it to.
- cp - Copies files. Pass "-r" for recursive, copying a folder and its contents. First argument passed is the file/folder to be copied; the second is the location to copy to.
- touch - Creates a new empty file at the specified location. Passing multiple space-separated values will create a new file for each value.
- mkdir - Creates a new empty directory at the specified location. Passing multiple space-separated values will create a new directory for each value.
That's a Wrap
Feel free to post questions in the comment area. In the next session, we will go over permissions and what it means to be a "sudo" user. Soon after, we'll dive straight into using Git and other tools to quickly set up a project on your local machine (faster than you could through the GUI!).