Cat is a simple way to view the contents of a file. The name is short for “concatenate and display files.” Let’s say you have a file called “test.txt” in your working directory. You think you can delete it, but you’re not sure what the contents of the file are.
Have you ever wanted to find out who is logged onto your Mac? Perhaps you have a multi-user system, or have SSH enabled; either way, you might need to know who is logged in. This simple Terminal command can tell you very easily. Simply head to the command line and type in who. In a blink of an eye, the system will return a list of all the users currently logged on and what date and time they logged in. Pretty nifty, huh?
These two commands are used to move and copy files.The first, mv is used to move files from one location to another. Let’s say that I had a file located in my user folder, but I wanted it moved to a folder called Documents.
Deleting files and folders in Unix can be a little scary, so use caution. Unix doesn’t have a trash bin that your files go to when deleted. Once you invoke the delete command, the files or folders will be gone. Forever. We cannot stress this enough.
This command creates a new folder in the current working directory. So, if you’re in a folder called Documents and you wanted to create a subfolder called “Test”, you could type the following command to create that folder:
Pwd stands for “print working directory.” The working directory is whatever folder you’re currently in, which typically is the receiver of an action (such as directory creation or deleting files inside of a certain directory). So, if you’re ever uncertain about which directory you’re in, just typed pwd and Terminal will spit back to you the directory location.
No, we’re not talking about those old compact discs that people used to listen to, we’re talking about “change directory.” This command does just that. Type this command followed by the name of a directory that you wish to change to, and it’ll change to that directory.