If you open the root of your Mac’s hard drive, you’ll see four very neatly organized folders: Applications, Library, System, and Users. But there is much, much more hidden from you, that your Mac needs to do what it does. Do you need to know what any of them are? Absolutely not. But you’re a geek, and you’re curious, so lets find out anyway. Continue reading
Here’s a Terminal feature for all you multi-taskers out there who want to be more efficient.
Have you ever run a command in the Terminal, then selected and copied it so you can paste it into another app? You can do it much more easily by appending “| pbcopy” at the end of your command.
uptime | pbcopy
Will run the uptime command, and the results will be automatically added to the clipboard.
In past lessons, we talked about logging into the command line, and using sudo. When you open the terminal or otherwise access the command line, the Terminal app will automatically log you in as the person you are currently logged into your Mac as. In other words, if you’re logged into your Mac as John, when you open the Terminal, you’ll be logged into the command line as John. The prompt will tell you what computer you’re on, and who you’re logged in as:
Here you can see that my computer name is Dora, I’m currently in my home folder (that’s what the ~ is for) and I’m logged in as overstim.
But sometimes you want to log in as a different user. Continue reading
Lesson 10! This is exciting. Ten fingers, ten toes, OS X, ten lords a-leaping… I thought I should do something special for lesson ten. Today were going to learn how to get ULTIMATE COSMIC POWER with just four little letters:
Everything you do in the command line is text-based, of course, but did you know you can also create and edit text files right in the command line? It’s true, there are a whole slew of text editors built right into the command line.
This is by no means complete list, but some of the tools I like best.
Reading text files:
less filename.txt more filename.txt tail filename.txt cat filename.txt
Less will open and display the first screen-full of a text file. You can use the down arrow to scroll down and see more, or the up arrow to scroll back. Press q to quit and return to the command line.
Okay, let’s get right to it! Last week you learned how to go to a specific folder, and how to look at what’s inside a certain folder. Today we’re going to talk about copying, moving, renaming and deleting files.
Nothing new today, I just wanted to post a little handy reference for all the things we’ve covered so far.
I was planning on mentioning these tricks in a later post, but my good friend Hank made me see that this is the perfect time. Today I’ve got one problem, and three shortcuts for you.
Ever notice that email addresses and web sites never have spaces in them? Spaces are a problem in Unix. Let’s say you had a folder called “Important stuff” and you wanted to look inside. You’d probably try typing
Lion-Apps:~ fmcadmin$ ls Important stuff
But you’d get an error:
Lion-Apps:~ fmcadmin$ ls Important stuff ls: Important: No such file or directory ls: stuff: No such file or directory
See what happened? It thought that Important and stuff were two different folders, and you wanted to look inside each. This is why “old schoolers” never use spaces in file and folder names. But all is not lost, it’s actually easy to deal with spaces in two different ways: just use quotes, or a black slash.
Where are you? In your cubicle, in an office, in your living room, a public library, on a blimp? Okay, probably not on a blimp. But you are somewhere right now, as you read this. You can look around and figure it out. And if you opened a window on your Mac, you would know where you were as well, because it would say so at the top of the window, like this:
But where are you when you open the Terminal? Turns out, it’s right there in front of you as well, you just may not have noticed, or known how to read it. Open a new Terminal window and don’t type anything, just look at the text to the left of your cursor. This is called the prompt:
And this is actually a lot of useful information in a little place. The lion-Apps: is the computer you’re on. That might be obvious, I mean, its sitting right there on your desk in front of you, right? But when you start logging into machines remotely, that can be a very helpful reminder. That little squiggle, ~, is called a tilde, and it tells you what folder you’re in. More on that in a second. fmcadmin is the user you’re logged in as. And finally, the $ tells us we are using the bash shell. There are different shells out there, but you really don’t need to worry about that at this point. All Macs use the bash shell by default.
Okay, wait, tilde? Whats that? Well, in order to explain that, we need to take a step back and talk about paths. A path is like a set of directions to get somewhere.