The 44 most useful Mac Terminal commands!

  • Por Sophia Silva
  • 23/12/2022 às 21:15 atualizado em (23/12/2022 às 21:15)
  • 6min de leitura

Using the Windows terminal (popularly known as the Command Prompt) and Linux is a common task for users of these systems, not least because the available commands are very useful on several occasions. The Mac and Macbook also have a command terminal, but most users of Apple computers have a certain fear and tend to be afraid of doing something wrong with the software. It turns out that the Mac’s Terminal is there to make using the device easier and can be used to your advantage in any situation.

To use it, just search for “Terminal” in Spotlight search. Pretty simple, isn’t it?! If you want to make good use of this tool, you can even check out some of the most useful commands below!

1. Is

intro to mac terminal

This command lists the name of the files in the directory currently being used.

2. cd “directory name”

Use this command to go to another directory. Just type in the directory’s name without the quotation marks by the side of the command and hit Enter.

3. cd ..

This command helps you go one directory up from the one you’re using right now. AKA, the previous directory.

4. cd

When typing this in without anything at the side in the Mac Terminal, you’ll be taken to the currently used directory.

5. pwd

mac terminal

This command shows the currently used directory path on the Terminal.

6. mkdir “directory name”

To make a new directory, use this command and type in its name right at the side (without quotation marks).

7. rmdir “directory name”

Use this command to delete an empty directory. Just type in its name (without quotation marks) right at the side of the command before hitting Enter.

8. cp

This very simple command helps you in copying one or more files quickly. Just type in its name at the side of the command before hitting Enter.

9. chmod

If you want to change the access permissions of one of your files, just use this command.

10. diff

mac tips

This Mac Terminal command will compare the differences between two previously selected files.

11. more “file name”

This command displays a text file one page at a time. In this case, you have to press the space key to see the next page or the Q key to exit the display screen.

12. mv “file name”

This command helps you to rename a file easily. You can also use it to move the file around to other locations.

14. rm “file name”

This command is very simple and only serves to delete the file you name.

15. Control+C

commands to use

This command simply terminates most of the operations being performed.

16. date

Enter this command in the Mac Terminal to have the current date and time displayed directly in the Terminal.

17. echo

The “echo” command is for anything after it to be repeated one more time.

18. help

When typing “help” in the Terminal, a small list of useful commands will appear on the screen.

19. history

The “history” command can be very useful, as it displays the last commands that were typed in the Terminal.

20. pico

Macbooks

This command opens a simple text editor if you ever need one.

21. ps

This simple command serves to display all processes and operations that are currently active.

22. sudo

This command is to allow you to perform certain tasks for which your account does not have permission. You will still need to enter the administrator password.

23. defaults write com.apple.finder AppleShowAllFiles TRUE

This slightly longer command is for all hidden files on your Mac to be displayed normally. To disable this, just change TRUE to FALSE at the end of the command.

24. defaults write com.apple.screencapture type file-extension

In general, Mac screenshots are saved in PNG format, but you can change that with the above command in the Mac Terminal. Just change the “file-extension” to the extension of the type of file you want the photos to be saved. Just put the three-letter extension, like JPG or PDF, depending on what you want to use.

25. say Hello World!

mac computers

This command is more funny than useful, as it only serves to make the Mac say a few words.

26. defaults write com.apple.dashboard devmode YES

This command is for placing your Mac’s dashboard widgets directly on your computer’s desktop. To reverse this, just replace YES with a NO at the end of the command.

27. alloc

This command can be extremely useful as it displays your Mac’s used and free memory.

28. caffeinate

This Mac Terminal command is to prevent the Mac from going into hibernation or sleep mode when not being used for some time.

29. cal

This simple command shows the Mac calendar automatically.

30. crontab

new macbook

With this command, you can schedule another command to be activated specifically at another time or day.

31. clear

This command simply serves to clear the Terminal screen. Quite handy if you’ve been using the software for some time.

32. dc

Use this command to quickly display and use a calculator.

33. curl

This command basically serves to transfer information from one server to another.

34. cut

Use this command to split a file into several parts.

35. df

Mac Terminal update

Use this command to display the free hard disk storage on the Mac Terminal screen.

36. ditto

This command can be used to copy selected files and folders.

37. dsenableroot

This command is used to allow root access to the computer. Use it with caution.

38. last

This command displays the last user to log in to the Mac in question.

39. locate “file name”

This command can be used to find miscellaneous files on the computer. Just put the file name next to the command.

40. lpr

Use this command to print a previously selected file.

41. mdfind

Mac Terminal codes

You can use this command in the Mac Terminal to quickly open the Spotlight search and do a search there.

42. open

This command is simply for opening a file, folder, URL, or application on your Mac. Just specify the name of whatever you want to open next to the command before hitting Enter.

43. passwd

This command can be used to change the password for one of the Mac users in question.

44. ping

Use this command to do a quick check of your internet connection. It can be very useful if you notice a slowdown on the network.

Did you like these tips about the Mac Terminal?

So, was our list useful for you? If so, share this article with other Mac users in your midst to help them out!