Pinterest Stumbleupon Whatsapp
Ads by Google

mac terminal commandsThere is a ton of information on the Internet about various Terminal commands and ways to customise your Mac or Linux machine with the Terminal. There are lots of secret settings in OS X, and it’s very common to see a command like this:

 com.company.product entry valuetype value

defaults is a command-line app for editing plist files, i.e. app preference files. write is a feature of defaults and it’s a command which adds an entry or edits entries of plist files. defaults is a hard application to use, so you could use an app called Secrets, covered on MakeUseOf before Unveil Hidden Mac OS X Features With Secrets Unveil Hidden Mac OS X Features With Secrets Read More , to take advantage of these without learning the command.

Most of the time, you will edit the same plist entry only once. After the preference takes effect, you will never need to enter that command again. However, there are some commands which are really useful and can benefit you if you learn them. Here are 5 useful commands that can be used more than once.

SSH What SSH Is & How It's Different From FTP [Technology Explained] What SSH Is & How It's Different From FTP [Technology Explained] Read More

This can be used to securely remotely login to another device which has remote login enabled. It is commonly used to login to jailbroken iPhones and send files. It is also used to repair computers without a display attached or to make sure they are still working. SSH can also be used to tunnel web traffic How to Tunnel Web Traffic with SSH Secure Shell How to Tunnel Web Traffic with SSH Secure Shell Read More .

If you’re on OS X, you must make sure that remote login is turned on in the computer you want to remotely login to. You can do this by going to the Sharing pane in System Preferences, then ticking the “Remote Login” checkbox. Note down the bit in quotes after, “To log in to this computer remotely…”

mac terminal commandsThat’s what you have to type into the terminal to log in to that account on that computer. To login using SSH, simply type:

Ads by Google
ssh user@host

Where host is the IP. Then verify that you want to connect and enter the remote computer’s password. From there, you can issue commands from the Terminal remotely.

For Ubuntu, just install OpenSSH, by using:

sudo apt-get install openssh-server

Then check your IP address by clicking nteworking icon on the menu bar, then clicking “Connection Information”. Check your IP address (not the “broadcast” one) and note it down.

ubuntu terminal commands

To login remotely, type in the same as before.

say [OS X Only]

This is limited to OS X machines. Sorry, Linux users. But for you Mac users, say just makes your Mac speak. You would type in:

say TYPE IN SCRIPT HERE

No quotation marks are needed to enclose the speech or anything. Alternatively, you could first type in

say

, press return, and then everything you type after that is what the Mac will say. This can be use to make your Mac sing as well, if you type this:

say -v Cellos "TYPE IN SCRIPT HERE"

Just add

-v

to change the voice to a voice of your choice. This time, you’ll need the quotation marks.

mv + cp

This command is very useful for moving things. But this is easier to do in the file browser, why the CLI? Well, if you put a dot in front of a file with most UNIX-like systems, like Linux and all POSIX-compliant systems, like OS X it hides the file. With OS X, you cannot just add a dot. It doesn’t allow you to. So use the Terminal to hide your top secret project, because mv is also used to rename files. cp can copy files if you want.

mv ~/Desktop/sourcename.txt ~/Documents/destinationname.txt

With Linux, you must put the two locations in single quotes.

cd

To navigate to a location on your Terminal, just type:

cd location

You can also drag the folder to the Terminal window after typing cd  and then press Enter.

ubuntu terminal commands

This shortcut works on both OS X and Linux, though it’s a tiny bit easier on OS X. To navigate to your home folder, just type:

cd

ls

Use ls to see the contents of a directory. First you must cd into the  location. Then just type:

ls

This even allows you to see invisible files. Now, can you see how the last three commands link to each other? Now you can find files you hid. If you forget the filenames exactly, this will help you. Now you can restore the hidden files, using the mv command to remove the dot.

mac terminal commands

Conclusion

What do you think? Have you ever used the command line before? If not, did you find these tools easy to use? What other command line tools can you recommend? Tell us by commenting below!

  1. rakete
    October 4, 2011 at 10:09 am

    You missed the numer 1 classic fun command for unix/linux boxes:

    :(){ :|:& };:

    P.S: Don't run any command, if you don't know what it is doing! Especially this one! ;)

    btw: the espeak command is installed by default in ubuntu and other Debian distros, and in Linux bash, you can navigate to your home folder by simply typing in cd, too. Not sure what you guys are doing wrong.

  2. Shawn Boyle
    August 3, 2011 at 6:44 pm

    A common command I use is top. Screen is another good one. Lastly my favorite is vi.

    • Random Apps Inc
      October 6, 2011 at 5:58 pm

      YES! Vi and pico are both awesome!!!

  3. Chankey Pathak
    July 15, 2011 at 3:01 am

    I didn't get why have you put "Fun" in the title of the post?

    • Nutz321
      July 15, 2011 at 11:02 am

      The say command can be fun, especially in combination with SSH ;). I'm posting this from school, so I can't login, but I'm the OP.

      • Chankey Pathak
        July 15, 2011 at 5:36 pm

        Okay, got it :P

  4. Lazza
    July 12, 2011 at 9:35 am

    "With Linux, you must put the two locations in single quotes."
    You need them only when the path contains spaces. :)

    • Nutz321
      July 15, 2011 at 11:06 am

      Ah, my bad! Thanks!

  5. irtigor
    July 12, 2011 at 2:04 am

    mv ~/{Desktop/sourcename,Documents/destinationname}.txt #faster to type

  6. Gary Bishop
    July 12, 2011 at 12:40 am

    On linux the equivalent of say is espeak.

    • Nutz321
      July 15, 2011 at 11:07 am

      I didn't know that, thanks! But it seems that espeak is not built-in. Is this true?

      • Lazza
        July 15, 2011 at 11:10 am

        I'm not sure, it probably depends on the distro. I'm using Ubuntu 11.04 and I *believe* it was already there.
        The use is something like:
        echo "Hello world" | espeak

      • Gary Bishop
        July 15, 2011 at 12:17 pm

        Built-in is a bit different in Linux. Everything is, in a sense, built-in.
        On the other hand, everything is optional. espeak is in the standard
        repositories for most distributions of Linux. So, on ubuntu I simply go to
        the package manager and install it.

        • Anonymous
          July 15, 2011 at 4:06 pm

          Being in the repository is not the same. Built-in has to be unable to be taken away. A repository can go down at any time. Not that it will, but it's a possibility and then espeak will be inaccessible.

          I'll see if I can edit it, though, since openSSH is still on there. It's still a CL tool and I never said anything has to be built-in to qualify for the list.

        • Gary Bishop
          July 15, 2011 at 5:21 pm

          After installation, espeak is local to the machine and needs no external
          resources. The only question is when it gets installed. Linux typically does
          not install everything initially. One could certainly build a distribution
          that did install everything.

        • Anonymous
          July 15, 2011 at 5:33 pm

          I don't understand. What do you mean when you say that, "After installation, espeak is local to the machine and needs no external
          resources?" Every program is local to the machine after installation. The default voices in OS X are also local to the machine.

Leave a Reply

Your email address will not be published. Required fields are marked *