{"id":307241,"date":"2021-07-24T15:00:00","date_gmt":"2021-07-24T12:00:00","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/16-terminal-commands-that-every-mac-user-should-know\/"},"modified":"2021-07-24T15:00:00","modified_gmt":"2021-07-24T12:00:00","slug":"16-terminal-commands-that-every-mac-user-should-know","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/","title":{"rendered":"#16 Terminal Commands That Every Mac User Should Know"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2704b60166a\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2704b60166a\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Use_Terminal_to_Execute_Commands\" >Use Terminal to Execute Commands<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Use_Flags_to_Modify_Commands\" >Use Flags to Modify Commands<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Change_Directory_cd\" >Change Directory: cd<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#List_Files_Folders_ls\" >List Files &amp; Folders: ls<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Copy_cp\" >Copy: cp<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Move_and_Rename_mv\" >Move and Rename:\u00a0mv<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Make_a_New_Directory_mkdir\" >Make a New Directory: mkdir<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Delete_Files_Folders_rm\" >Delete Files &amp; Folders: rm<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Display_Disk_Usage_Free_Space_du_df\" >Display Disk Usage &amp; Free Space: du\u00a0&amp; df<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Find_a_File_find\" >Find a File: find<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Open_a_File_open\" >Open a File: open<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Edit_a_File_nano\" >Edit a File: nano<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Run_as_Super_User_sudo\" >Run as Super User: sudo<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Show_the_Working_Directory_pwd\" >Show the Working Directory: pwd<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Show_Running_Processes_top\" >Show Running Processes: top<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Terminate_a_Process_kill\" >Terminate a Process: kill<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Learn_More_about_a_Command_man\" >Learn More about a Command: man<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/buradabiliyorum.com\/en\/16-terminal-commands-that-every-mac-user-should-know\/#Do_More_with_Homebrew\" >Do More with Homebrew<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#16 Terminal Commands That Every Mac User Should Know&#8221;<\/strong><\/p>\n<div>\n<img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage alignnone size-full wp-image-731744\" srcset=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/macbook-keyboard.jpg?width=398&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 400w, https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/macbook-keyboard.jpg?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 1200w\" sizes=\"auto, 400w, 1200w\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/macbook-keyboard.jpg?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"A backlight MacBook keyboard.\" width=\"1200\" height=\"675\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Are you afraid of the Mac command line? Learning a few simple commands can help you build your confidence and shed that fear. You might even discover that you enjoy working in a command-line environment!<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Use_Terminal_to_Execute_Commands\"><\/span>Use Terminal to Execute Commands<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p> Your Mac comes with an <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a> called Terminal under Applications &gt; Utilities. This is how you execute commands on your Mac using the command line. Launch Terminal by finding it in the Utilities folder or by searching for it using Spotlight, and then familiarize yourself with the interface.<br \/>\nMany of the shortcuts that you use in other apps will work here. You can open multiple tabs with Command+T or a new Terminal window with Command+N. Cut, copy, and paste all work as expected, and you can drag any file or folder into the Terminal window to im<a href=\"https:\/\/buradabiliyorum.com\/en\/category\/social-mediaa\/\" data-internallinksmanager029f6b8e52c=\"1\" title=\"Social Media\" target=\"_blank\" rel=\"noopener\">media<\/a>tely skip to that directory.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-729288 size-full\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/Screen-Shot-2021-05-19-at-12.31.04-e1622242987439.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Mac Terminal (Blank)\" width=\"650\" height=\"173\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>We\u2019ll cover some of the most basic Mac terminal commands here. These will be familiar to you if you\u2019ve ever used the Linux command line, too.<\/p>\n<p>When we\u2019re done, you might want to learn\u00a0how to lock your Mac from the Terminal, or even how to shut it down with a simple command.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Use_Flags_to_Modify_Commands\"><\/span>Use Flags to Modify Commands<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Most commands can be appended with a flag in the form of a hyphen and a letter to access different functions. For example, the <code>-R<\/code> flag applies a command recursively so that it applies to a directory, all files and folders within that particular directory, all files and folders inside those folders, and so on.<\/p>\n<p>The flag always appears after the command. For example: <code>rm -i &lt;location&gt;<\/code>. In this example, <code>rm<\/code> is the delete command, the <code>-i<\/code> flag instructs the process to ask for user confirmation, and <code>&lt;location&gt;<\/code> would be replaced with the file or folder\u2019s location on the drive.\u00a0Flags are case-sensitive.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Change_Directory_cd\"><\/span>Change Directory: <code>cd<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:\u00a0<\/strong><code>cd \/folder\/<\/code><\/p>\n<p>Use the <code>cd<\/code> command to change directories. For example: <code>cd \/Volumes\/Elements\/<\/code> to access an external drive called \u201cElements.\u201d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729289\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/cd_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"cd macOS Terminal Command\" width=\"1140\" height=\"147\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>You can use shortcuts to quickly skip to certain directories. For example, running <code>cd ~<\/code>\u00a0will take you to the Home directory for the current user.\u00a0You can also use <code>cd\/<\/code> to get to the root of the drive, <code>cd..<\/code> to move up one directory, or <code>cd..\/..<\/code> to move up two directories.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"List_Files_Folders_ls\"><\/span>List Files &amp; Folders: <code>ls<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:<\/strong> <code>ls \/folder\/<\/code><\/p>\n<p>Also useful in navigating your drive, <code>ls<\/code> can be used to list the contents of the current directory simply by executing the command. Append it with a location on the drive to specifically target that directory.<\/p>\n<p>You can add flags to the ls command to get different results. For example, use <code>-C<\/code> to get a multi-column output, <code>-S<\/code> to sort by size, <code>-lt<\/code> to sort by date modified, <code>-la<\/code> for detailed contents including hidden files, or <code>-lh<\/code> to create a list with readable file sizes.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729290\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/ls_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"ls macOS Terminal Command\" width=\"1140\" height=\"241\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Remember, you can also use the same location shortcuts that you\u2019d use with the cd command (e.g. <code>ls ~<\/code> ) to quickly jump around.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Copy_cp\"><\/span>Copy: <code>cp<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:<\/strong> <code>cp file.txt \/destination\/<\/code><\/p>\n<p>Use <code>cp<\/code> to initiate the copy command, add a flag where required, and then enter the target file or folder, followed by a space, and then add the destination folder.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729291\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/cp_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"cp macOS Terminal Command\" width=\"1140\" height=\"125\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>If you\u2019re copying a single file, you can use the <code>cp<\/code> command without a flag as per the example shown above. If you want to copy a directory, you\u2019ll need to use the <code>-R<\/code> flag to indicate that all files and folders in the directory are to be included. For example: <code>cp -R \/folder\/ \/destination\/<\/code> .<\/p>\n<p>You can even include multiple files in a single copy command. For example: <code>cp file1.txt file2.txt file3.txt \/destination\/<\/code>.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Move_and_Rename_mv\"><\/span>Move and Rename:\u00a0<code>mv<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:<\/strong><code>mv file.txt \/destination\/<\/code><\/p>\n<p>Move works almost identically to copy as shown above, except that there\u2019s no need to add a recursive flag when moving directories. You can add an <code>-i<\/code> flag to the command to require confirmation before moving since the mv command will overwrite any files in the destination by default.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729292\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/mv_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"mv macOS Terminal Command\" width=\"1140\" height=\"127\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>You can use <code>mv<\/code> to rename files too by \u201cmoving\u201d a file to the same directory. For example: <code>mv oldfilename.txt newfilename.txt<\/code>.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Make_a_New_Directory_mkdir\"><\/span>Make a New Directory: <code>mkdir<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:<\/strong><code>mkdir &lt;name&gt;<\/code><\/p>\n<p>If you want to create a new directory, use the <code>mkdir<\/code> command, followed by the name of the directory that you want to create. You can create multiple directories by separating the names with spaces. For example: <code>mkdir folder1 folder2 folder3<\/code>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729293\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/mkdir_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"mkdir macOS Terminal Command\" width=\"1140\" height=\"131\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>If you want to create a folder with a space in the name, make sure that you put the folder name in quotations. For example,\u00a0<code>mkdir \"my folder\"<\/code>.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Delete_Files_Folders_rm\"><\/span>Delete Files &amp; Folders: <code>rm<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:<\/strong> <code>rm &lt;file&gt;<\/code><\/p>\n<p>The <code>rm<\/code> command deletes files or folders immediately without asking you for confirmation first. You can add the <code>-i<\/code> flag to require user confirmation whenever using it, which should help prevent mishaps.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729294\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/rm_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"rm macOS Terminal Command\" width=\"1140\" height=\"158\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>You can delete multiple files at once by appending more filenames to the end of the command. For example: <code>rm file1.txt file2.txt file3.txt<\/code>.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Display_Disk_Usage_Free_Space_du_df\"><\/span>Display Disk Usage &amp; Free Space: <code>du<\/code>\u00a0&amp; <code>df<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:<\/strong> <code>du \/destination\/<\/code><\/p>\n<p>Use the <code>du<\/code> command to calculate disk usage in the location specified thereafter. For a far more useful readout, run <code>du -sh \/destination\/<\/code> instead to provide a human-readable total of disk usage for a specified location.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729295\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/du_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"du macOS Terminal Command\" width=\"1140\" height=\"165\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Similarly, you can use <code>df -h<\/code> to calculate disk space, or use the <code>-H<\/code> flag to display total disk space in \u201cmetric\u201d storage units (e.g. 1000MB per GB as opposed to 1024MB per GB).<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Find_a_File_find\"><\/span>Find a File: <code>find<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:<\/strong> <code>find \/location\/ -name &lt;file&gt;<\/code><\/p>\n<p>This command can help you locate files on your disk. Follow the <code>find<\/code> command with the location of the directory that you want to search in, the <code>-name<\/code> flag, and then the name of the file that you want to find.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729296\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/find_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"find macOS Terminal Command\" width=\"1140\" height=\"730\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>You can always use a wildcard <code>*<\/code> to search partial filenames. For example,\u00a0<code>find \/location\/ -name '*.png'<\/code>\u00a0would find all files with the .PNG extension in the specified location.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Open_a_File_open\"><\/span>Open a File: <code>open<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:<\/strong> <code>open &lt;file&gt;<\/code><\/p>\n<p>You can use the <code>open<\/code>\u00a0command to open files or directories simply by specifying the path or path with filename thereafter. Open multiple directories or files by chaining them at the end of the command. For example,\u00a0<code>open file1.txt file2.txt file3.txt<\/code>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729297\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/open_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"open macOS Terminal Command\" width=\"1140\" height=\"101\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>You can also open files in specific applications using the -a flag, followed by the name of the application (or the path to the .APP file if you know it). For example: <code>open -a Preview file.pdf<\/code>.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Edit_a_File_nano\"><\/span>Edit a File: <code>nano<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:<\/strong> <code>nano &lt;file&gt;<\/code><\/p>\n<p>nano is a basic open-source text editor included with macOS for editing files within the Terminal. You can edit text-based files, including system files, using the <code>nano<\/code> command, followed by the filename.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729298\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/nano_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"nano macOS Terminal Command\" width=\"1140\" height=\"730\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Once you\u2019re in nano, pay attention to the commands at the bottom of the screen, which involve the control key. To save a file, hit Control+O (known as \u201cWrite Out\u201d) or quit without saving using Control+X.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Run_as_Super_User_sudo\"><\/span>Run as Super User: <code>sudo<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:<\/strong> <code>sudo &lt;command&gt;<\/code><\/p>\n<p>The <code>sudo<\/code> prefix is used to execute a command as a \u201csuper user,\u201d also known as root or admin. Once you\u2019ve entered a command prefixed by <code>sudo<\/code>, you\u2019ll be required to enter your administrator password to execute it.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729299\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/sudo_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"sudo macOS Terminal Command\" width=\"1140\" height=\"137\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Some commands require root access in order to work. If you want to edit a system file, for example, you might need to use <code>sudo nano &lt;file&gt;<\/code> in order to save your changes.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Show_the_Working_Directory_pwd\"><\/span>Show the Working Directory: <code>pwd<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:<\/strong> <code>pwd<\/code><\/p>\n<p>To display the current directory that you\u2019re in (or \u201cprint working directory\u201d), you can use the <code>pwd<\/code> command. This is especially useful for printing a path that you can later copy and paste.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729300\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/pwd_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"pwd macOS Terminal Command\" width=\"1140\" height=\"168\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Show_Running_Processes_top\"><\/span>Show Running Processes: <code>top<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:<\/strong> <code>top<\/code><\/p>\n<p>To see a list of currently running processes and how much CPU and memory they\u2019re currently using, execute\u00a0<code>top<\/code>. By default, the process will display all processes by CPU usage, with the process id or <code>PID<\/code>\u00a0displayed alongside each entry.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729301\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/top_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"top macOS Terminal Command\" width=\"1140\" height=\"730\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>You can hit \u201cQ\u201d to get back to the command line when you\u2019re done.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Terminate_a_Process_kill\"><\/span>Terminate a Process: <code>kill<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:<\/strong> <code>kill &lt;PID&gt;<\/code><\/p>\n<p>To kill a process, you\u2019ll first need to run the top command to find its process ID (or <code>PID<\/code>). You can then use the <code>kill<\/code> command, followed by the number displayed alongside the process. For example: <code>kill 1569<\/code>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729302\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/kill_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"kill macOS Terminal Command\" width=\"1140\" height=\"165\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Learn_More_about_a_Command_man\"><\/span>Learn More about a Command: <code>man<\/code><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Example usage:<\/strong> <code>man &lt;command&gt;<\/code><\/p>\n<p>Each command on this list has a manual associated with it that explains exactly how to use it and what the different flags do, along with some more exotic examples of the commands being used.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-729303\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/man_command.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"man macOS Terminal Command\" width=\"1140\" height=\"674\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>For example, the <code>top<\/code> command has a lot of flags and other modifiers, which you can read about using: <code>man top<\/code>. If you want to master the command line, use of the <code>man<\/code> command is vital.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Do_More_with_Homebrew\"><\/span>Do More with Homebrew<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>These commands are useful to know in an emergency. For example, you can\u2019t run Finder to <span class=\"htgeditornotesel\">copy files from your Mac\u2019s drive in recovery mode<\/span>, but you <em>can<\/em> manually copy files using Terminal if you know how to do it.<\/p>\n<p>If you want to get more use out of Terminal, consider using Homebrew to download and install software directly from your Mac\u2019s command line.<\/p>\n<\/div>\n<p><script>\n setTimeout(function(){\n  !function(f,b,e,v,n,t,s)\n  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n  n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n  if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n  n.queue=[];t=b.createElement(e);t.async=!0;\n  t.src=v;s=b.getElementsByTagName(e)[0];\n  s.parentNode.insertBefore(t,s) } (window, document,'script',\n  'https:\/\/connect.facebook.net\/en_US\/fbevents.js');\n   fbq('init', '335401813750447');\n   fbq('track', 'PageView');\n  },3000);\n<\/script><\/p>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.howtogeek.com\/729038\/16-terminal-commands-every-mac-user-should-know\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#16 Terminal Commands That Every Mac User Should Know&#8221; Are you afraid of the Mac command line? Learning a few simple commands can help you build your confidence and shed that fear. You might even discover that you enjoy working in a command-line environment! Use Terminal to Execute Commands Your Mac comes with an app&#8230;<\/p>\n","protected":false},"author":1,"featured_media":307242,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2021\/05\/macbook-keyboard.jpg?height=200p&trim=2,2,2,2","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-307241","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/307241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=307241"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/307241\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/307242"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=307241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=307241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=307241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}