[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-573829-105":3,"detail-sidebar-cat-1-en-105":80,"doc-detail-573829-en":126},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","mac-terminal-commands-cheat-sheet-basic-commands-reference","Mac Terminal Commands Cheat Sheet - Basic Commands - Reference","","Mac Terminal Commands Cheat Sheet provides a compact reference of practical command-line usages for macOS. It covers core privilege execution with sudo, terminal history and help lookup, and essential networking tools such as ping, traceroute, SSH, and SSH key management. It also lists process management (ps, top, kill), file searching and text searching (find, grep), Homebrew package commands, disk space utilities, common file operations, permissions, system maintenance, directory navigation, environment variables, and keyboard shortcuts.",{"@graph":14,"@context":72},[15,34,55],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/template/","Template",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/template/general/","General",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/template/mac-terminal-commands-cheat-sheet-basic-commands-reference/573829/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/mac-terminal-commands-cheat-sheet-basic-commands-reference/573829.png","ImageObject",442,249,{"name":42,"@type":43},"eBook King","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-10-15","2026-10-14",true,{"@type":52,"interactionType":53,"userInteractionCount":30},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"How do I run a command with admin privileges in macOS Terminal?","Question",{"text":62,"@type":63},"Use sudo followed by the command and any required arguments, e.g., sudo [command][arguments].","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"Which commands help me inspect system networking and remote connections?",{"text":67,"@type":63},"Use ping [hostname-or-IP] for connectivity checks, traceroute [hostname-or-IP] to view packet paths, and ssh [user]@[hostname-or-IP] to connect via SSH.",{"name":69,"@type":60,"acceptedAnswer":70},"What commands are used for basic file and text operations?",{"text":71,"@type":63},"Use touch to create files, open/cat/less/head to view contents, find to locate files, and grep to search for text within files or command output.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},573829,1792086202,{"code":4,"msg":81,"data":82},"success",[83,88,93,98,103,108,113,118,123],{"id":84,"doc_module":22,"doc_module_name":25,"category_name":85,"show_sort_weight":86,"slug":87},11,"Presentations",90,"presentations",{"id":89,"doc_module":22,"doc_module_name":25,"category_name":90,"show_sort_weight":91,"slug":92},12,"Resumes",80,"resumes",{"id":94,"doc_module":22,"doc_module_name":25,"category_name":95,"show_sort_weight":96,"slug":97},14,"Invoices",70,"invoices",{"id":99,"doc_module":22,"doc_module_name":25,"category_name":100,"show_sort_weight":101,"slug":102},15,"Posters",60,"posters",{"id":104,"doc_module":22,"doc_module_name":25,"category_name":105,"show_sort_weight":106,"slug":107},16,"Social Media",50,"social-media",{"id":109,"doc_module":22,"doc_module_name":25,"category_name":110,"show_sort_weight":111,"slug":112},17,"Forms",40,"forms",{"id":114,"doc_module":22,"doc_module_name":25,"category_name":115,"show_sort_weight":116,"slug":117},18,"Letters",30,"letters",{"id":119,"doc_module":22,"doc_module_name":25,"category_name":120,"show_sort_weight":121,"slug":122},21,"Paper Templates",5,"papers-templates",{"id":124,"doc_module":22,"doc_module_name":25,"category_name":29,"show_sort_weight":4,"slug":125},158,"general-158",{"code":4,"msg":81,"data":127},{"doc_id":78,"user_id":128,"nickname":42,"user_avatar":129,"doc_module":22,"category_id":124,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":130,"file_id":131,"file_url":132,"file_type":133,"file_size":134,"view_count":30,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":22,"language":135,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":136,"faqs":137,"seo_title":138,"seo_description":12,"update_tm":139,"read_time":4},962088006270,"https://ap-avatar.wpscdn.com/davatar_085a072bc5b1113ac321206ff7593b45","Mac Terminal Commands Cheat Sheet  \nBasic Commands  \n\n| sudo [command][arguments] | Run commands as admin. |\n| --- | --- |\n| [command1] | [command2] | Pipe command output. |\n| [command] > /dev/null | Hide command output. |\n| echo [text] | Print text to output. |\n| history | List command history. |\n| history-[x] | Limit history to x items. |\n| ![x] | Run command from history. |\n| !! | Run previous command. |\n| [command] --help | Get help for command. |\n| man [command] | Read manual for command. |\n| exit | Exit session. |\n\nNetwork  \nping [hostname-or-IP] Test remote connection.  \n\n| arp-a | View local network devices. |\n| --- | --- |\n| traceroute [hostname-or-IP] | View path of packets. |\n| ifconﬁg | List network adapters. |\n| ifconﬁg [network-adapter] | See speciﬁc network adapter. |\n| curl-O [URL]/[ﬁle] | Download ﬁle. |\n| ssh [user]@[hostname-or-IP] | Connect via SSH. |\n| ssh-keygen | Generate SSH key. |\n| ssh-copy-id-i [PUB-key][user]@ [hostname-or-IP] | Copy SSH key to remote host. |\n\nProcesses  \n\n| ps-ax | List processes by PID. |\n| --- | --- |\n| ps aux | See more details for processes. |\n| top | Real time processes list. |\n| top-s [seconds] | Adjust top refresh rate. |\n| top-o rsize | Sort top by RAM memory. |\n| top-o cpu | Sort top by CPU. |\n| ps-ax | grep [name-or-PID] | Find processes. |\n| kill [PID] | Kill process. |\n| killall [name] | Kill process by name . |\n\nSearch  \nﬁnd [directory] -name “[ﬁle]” Find ﬁle in directory.  \nﬁnd [directory] -name “*txt” Find ﬁle by incomplete name .  \ngrep \" [text]\" [ﬁle] Look for text in ﬁle.  \n[command] | grep \" [text]\" Look for text in output.  \ngrep-rl \" [text]\" [directory] Look for text in directory ﬁles.  \nHomebrew Commands  \n\n| brew update | Update formulae. |\n| --- | --- |\n| brew upgrade | Upgrade formulae. |\n| brew upgrade [formula] | Upgrade speciﬁc formula. |\n| brew pin [formula] | Prevent formula upgrade. |\n| brew unpin [formula] | Unpin formula. |\n| brew install [formula] | Install formula. |\n| brew uninstall [formula] | Uninstall formula. |\n| brew list--formula | List installed formulae. |\n| brew list--cask | List installed casks. |\n| brew deps [formula] | List formula dependencies. |\n| brew outdated--formula | List outdated formulae. |\n| brew outdated--cask | List outdated casks. |\n| brew doctor | Run troubleshooting. |\n| brew help | Read Homebrew help. |\n| brew cleanup | Perform cleanup. |\n\nFile Size and Disk Space  \ndu See utilized disk space.  \n\n| du-s [ﬁle1][ﬁle2] | See speciﬁc ﬁles' utilization. |\n| --- | --- |\n| du-h | Human-readable format. |\n| du-k | Display disk space in kilobytes. |\n| du-m | sort-nr | Sort by size (descending order) . |\n| df-h | Display free disk space. |\n| df-H | Free space in powers of 1000. |\n\nFile Management  \n\n| touch [ﬁle] | Create empty ﬁle. |\n| --- | --- |\n| open [ﬁle] | Open ﬁle. |\n| cat [ﬁle] | Output ﬁle contents. |\n| less [ﬁle] | See ﬁle contents page by page. |\n| head [ﬁle] | Output ﬁrst 10 lines of ﬁle. |\n| head-n [x][ﬁle] | Print ﬁrst x lines of ﬁle. |\n| nano [ﬁle] | Edit ﬁle in Nano. |\n| echo \" [text]\" >> [path]/ [ﬁle] | Append text to ﬁle. |\n| cat [ﬁle] >> [path]/ [ﬁle] | Append entire ﬁle to ﬁle. |\n| echo \" [text]\" > [path]/ [ﬁle] | Overwrite ﬁle with text. |\n| cat [ﬁle] > [path]/ [ﬁle] | Overwrite ﬁle with ﬁle. |\n| cp [ﬁle][path] | Copy ﬁle. |\n| cp [ﬁle][new-ﬁle] | Make copy in directory. |\n| cp [ﬁle][path]/[new-ﬁle] | Copy ﬁle with diﬀerent name . |\n| cp “[ﬁle]” [path] | Copy ﬁle with spaces in name . |\n| cp [ﬁle1][ﬁle2][ﬁle3][path] | Copy multiple ﬁles. |\n| cp-i [ﬁle][path] | Ask for copy conﬁrmation. |\n| mv [ﬁle][path] | Move ﬁle. |\n| mv [ﬁle][new-ﬁle] | Rename ﬁle. |\n| mv [ﬁle][path]/[new-ﬁle] | Move ﬁle and change name . |\n| mv-i [ﬁle][path] | Ask for move conﬁrmation. |\n| mv *.[extension][path] | Move all with same extension. |\n| rm [ﬁle] | Remove ﬁle. |\n| rm-i [ﬁle] | Conﬁrm before removal. |\n| rm-f [ﬁle] | Force remove ﬁle. |\n| rm [ﬁle1][ﬁle2][ﬁle3] | Remove multiple ﬁles. |\n\nPermissions  \n\n| ls-l [ﬁle] | View ﬁle per","cbCaifUQp6AGfhVL","https://ap.wps.com/l/cbCaifUQp6AGfhVL","pdf",52622,"English","# Basic Commands\n## Network\n## Processes\n## Search\n## Homebrew Commands\n## File Size and Disk Space\n## File Management\n## Permissions\n## System\n## Directory Management\n## Environment Variables\n## Shortcuts","[{\"question\":\"How do I run a command with admin privileges in macOS Terminal?\",\"answer\":\"Use sudo followed by the command and any required arguments, e.g., sudo [command][arguments].\"},{\"question\":\"Which commands help me inspect system networking and remote connections?\",\"answer\":\"Use ping [hostname-or-IP] for connectivity checks, traceroute [hostname-or-IP] to view packet paths, and ssh [user]@[hostname-or-IP] to connect via SSH.\"},{\"question\":\"What commands are used for basic file and text operations?\",\"answer\":\"Use touch to create files, open/cat/less/head to view contents, find to locate files, and grep to search for text within files or command output.\"}]","Mac Terminal Commands Cheat Sheet - Basic Commands - Reference | PDF",1791948063]