{"id":28039,"date":"2022-03-02T09:33:29","date_gmt":"2022-03-02T09:33:29","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=28039"},"modified":"2022-12-23T06:48:22","modified_gmt":"2022-12-23T06:48:22","slug":"top-51-linux-commands-for-daily-use","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/top-51-linux-commands-for-daily-use\/","title":{"rendered":"Linux Tutorials: 51 commands for daily use"},"content":{"rendered":"<p>This article provides practical examples for 51 most frequently used commands in Linux<\/p>\n<p>This is by no means a comprehensive list, but it should give you a jumpstart on some common Linux commands. You can bookmark this article for your future reference.<\/p>\n<ol>\n<li>\n<h6><strong>ls command<\/strong><\/h6>\n<\/li>\n<\/ol>\n<p>List files and folders in the current directory.<\/p>\n<p>Parameters<\/p>\n<p>\u2013l<\/p>\n<p>to list the content as a detailed list.<\/p>\n<p>-a<\/p>\n<p>Display all files (hidden + non-hidden).<\/p>\n<p><strong>You can combine parameters like this:<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-28040 size-full\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/Capture.png\" alt=\"\" width=\"583\" height=\"103\" \/><\/p>\n<h6>2.<strong>cd Command<\/strong><\/h6>\n<p>Change directory from the current directory to another one.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-28041 size-full\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/Capture-1.png\" alt=\"\" width=\"579\" height=\"95\" \/><\/p>\n<h6>3.<strong>cp Command<\/strong><\/h6>\n<p>Copy the source to target.<\/p>\n<p>Parameters<\/p>\n<p>-i<\/p>\n<p>Interactive mode means waiting for the confirmation if there are files on the target, it will be overwritten.<\/p>\n<p>-r<\/p>\n<p>Recursive copy means include subdirectories if they found.<\/p>\n<p><strong>Example<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-28044 size-full\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/Capture-2.png\" alt=\"\" width=\"582\" height=\"95\" \/><\/p>\n<p>4<strong>. mv Command<\/strong><\/p>\n<p>Move the source to target and remove the source.<\/p>\n<p>Parameters<\/p>\n<p>-i<\/p>\n<p>Interactive mode means to wait for the confirmation if there are files on the target, it will be overwritten.<\/p>\n<p><strong>Example<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-28045 size-full\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/Capture-3.png\" alt=\"\" width=\"577\" height=\"100\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>5<strong>.rm Command<\/strong><\/p>\n<p>Delete file or directory, and you must use \u2013r in case you want to delete a\u00a0directory.<\/p>\n<p>Parameters<\/p>\n<p>-r<\/p>\n<p>Recursive delete means delete all subdirectories if found.<\/p>\n<p>-i<\/p>\n<p>Interactive means wait till confirmation<\/p>\n<p>6.<strong><code>mkdir<\/code>\u00a0 Command &#8211; <\/strong>create or make new directories.<\/p>\n<p><strong>7.rmdir command &#8211; <\/strong>Delete a directory<\/p>\n<p>8. <strong><code>ip command<\/code>\u00a0\u2013\u00a0<\/strong>from Iproute2, a collection of utilities for controlling TCP\/IP networking and traffic control in Linux.<\/p>\n<p>9.<strong><code>df command<\/code>\u00a0\u2013<\/strong>\u00a0display disk space usage.<\/p>\n<p>10.<strong><code>du command<\/code>\u00a0\u2013\u00a0<\/strong>estimate file space usage.<\/p>\n<p>11.<strong>\u00a0<code>free command<\/code>\u00a0\u2013<\/strong>\u00a0display memory usage.<\/p>\n<p>12.<strong><code>scp command\u00a0<\/code>\u00a0\u2013\u00a0<\/strong>securely Copy Files Using SCP, with examples.<\/p>\n<p>13. <strong><code>find command\u00a0\u00a0<\/code>\u00a0\u2013<\/strong>\u00a0locates files based on some user-specified criteria.<\/p>\n<p>15. <strong><code>ncdu command<\/code>\u00a0\u2013\u00a0<\/strong>a disk utility for Unix systems.<\/p>\n<p>16. <strong><code>pstree command<\/code>\u00a0\u2013<\/strong>\u00a0display a tree of processes.<\/p>\n<p>17. <strong><code>last command<\/code>\u00a0\u2013<\/strong>\u00a0show a listing of last logged-in users.<\/p>\n<p>18. <strong>\u00a0<code>w command<\/code>\u00a0\u2013<\/strong>\u00a0show a list of currently logged-in user sessions.<\/p>\n<p>19. <strong><code>grep command<\/code>\u00a0\u2013<\/strong>\u00a0Search a file for a pattern of characters, then display all matching lines.<\/p>\n<p>20. <strong>halt command &#8211;\u00a0<\/strong><\/p>\n<p>Shuts down\u00a0the system, but make sure to close all of your files to avoid data loss.<\/p>\n<p>That was just some of the leading Linux commands.<\/p>\n<p>Notice\u00a0that, if you forget any command parameters, \u00a0just type the command with \u2013 -help as a parameter, and it will list the used parameters, so you don\u2019t have to remember all those parameters at the beginning.<\/p>\n<p>21. <strong>reboot command &#8211; Reboot the system immediately. Just type reboot.<\/strong><\/p>\n<p>22. <strong><code>uptime command<\/code>\u00a0\u2013<\/strong>\u00a0shows system uptime and load average.<\/p>\n<p>23. <strong><code>top command<\/code>\u00a0\u2013\u00a0<\/strong>shows an overall system view.<\/p>\n<p>24. <strong><code>vmstat command<\/code>\u00a0\u2013\u00a0<\/strong>shows\u00a0system memory, processes, interrupts, paging, block I\/O, and CPU info.<\/p>\n<p>25. <strong><code>htop command<\/code>\u00a0\u2013<\/strong>\u00a0interactive process viewer and manager.<\/p>\n<p>26. <strong><code>dstat command<\/code>\u00a0\u2013<\/strong>\u00a0view processes, memory, paging, I\/O, CPU, etc., in real-time. All-in-one for vmstat, iostat, netstat, and ifstat.<\/p>\n<p>27. <strong><code>iftop command<\/code>\u00a0\u2013<\/strong>\u00a0network traffic viewer.<\/p>\n<p>28. <strong><code>nethogs command<\/code>\u00a0\u2013<\/strong>\u00a0network traffic analyzer.<\/p>\n<p>29. <strong>passwd command<\/strong>\u00a0&#8211; Used to change your user password.<\/p>\n<p>30. <strong>du command &#8211;\u00a0<\/strong><\/p>\n<p>Calculates the disk usage of a file or a directory.<\/p>\n<p>Parameters<\/p>\n<p>-h<\/p>\n<p>Display human-readable form.<\/p>\n<p>-s<\/p>\n<p>Summarize the output total size.<\/p>\n<p>Example<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-28046 size-full\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/Capture-4.png\" alt=\"\" width=\"577\" height=\"106\" \/><\/p>\n<p>31. <strong>less command-<\/strong> Displays file content with a scroll screen so you can navigate between pages using PgUp, PgDn, Home, and End.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-28047 size-full\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/Capture-5.png\" alt=\"\" width=\"585\" height=\"95\" \/><\/p>\n<p>32. <strong>cat command &#8211; <\/strong>Display file content to screen without limits.<\/p>\n<p>Example<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-28048 size-full\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/03\/Capture-6.png\" alt=\"\" width=\"579\" height=\"92\" \/><\/p>\n<p>33. <strong>date command<\/strong> &#8211; Simply prints today\u2019s date. Just type date on the shell.<\/p>\n<p>34. <strong>tar command<\/strong> &#8211;<\/p>\n<p>Combines several files into an archive and compression if you want.<\/p>\n<p>Parameters<\/p>\n<p>-c<\/p>\n<p>Create a new archive.<\/p>\n<p>-z<\/p>\n<p>Compress the archive using gzip package.<\/p>\n<p>-j<\/p>\n<p>Compress the archive using the bzip2 package.<\/p>\n<p>-v<\/p>\n<p>Verbose mode means showing the processed files.<\/p>\n<p>-f<\/p>\n<p>Write the output to a file and not to screen.<\/p>\n<p>-x<\/p>\n<p>35.<strong> updatedb command &#8211; <\/strong>updates the database used by the\u00a0locate command.<\/p>\n<p>36. <strong>locate command &#8211; <\/strong>To find a file in your system, the locate command will search the system for the pattern you provide.<\/p>\n<p>37.<strong> chmod command &#8211;\u00a0<\/strong><\/p>\n<p>Change the permission of a file or directory.<\/p>\n<p>Parameters<\/p>\n<p>The mode which consists of 3 parts,\u00a0<strong>owner<\/strong>,\u00a0<strong>group<\/strong>, and\u00a0<strong>others<\/strong>\u00a0means what will be the permissions for these modes, and you must specify them.<\/p>\n<p>The permission is one of the followings:<\/p>\n<p><strong>Read<\/strong>\u00a0=4<\/p>\n<p><strong>Write<\/strong>\u00a0= 2<\/p>\n<p><strong>Execute<\/strong>\u00a0=1<\/p>\n<p>Every permission represented by a number as shown, and you can combine permissions.<\/p>\n<p>38. <strong>chown command &#8211;<\/strong><\/p>\n<p>Change the owner of a file or directory.<\/p>\n<p>Parameters:<\/p>\n<p>-R<\/p>\n<p><strong>Capital R\u00a0<\/strong>here means to change ownership of all subdirectories if found, and you must use this parameter if you use the command against a directory.<\/p>\n<p>39. <strong><code>gzip command<\/code>\u00a0\u2013<\/strong>\u00a0file compression and decompression.<\/p>\n<p>40. <strong><code>b2zip<\/code>\u00a0\u2013<\/strong>\u00a0similar to gzip. It uses a different compression algorithm.<\/p>\n<p>41. <strong><code>zip command<\/code>\u00a0\u2013<\/strong>\u00a0for packaging and compressing (to archive) files.<\/p>\n<p>42. <strong><code>ps command<\/code>\u00a0\u2013<\/strong>\u00a0information about the currently running processes.<\/p>\n<p>43. <strong><code>cron command<\/code>\u00a0\u2013<\/strong>\u00a0set up scheduled tasks to run.<\/p>\n<p>44. <strong><code>nmcli command<\/code>\u00a0\u2013\u00a0<\/strong>network management.<\/p>\n<p>45. <strong><code>ping command<\/code>\u00a0\u2013<\/strong>\u00a0send ICMP ECHO_REQUEST to network hosts.<\/p>\n<p>46. <strong><code>traceroute command<\/code>\u00a0\u2013\u00a0<\/strong>check the route packets take to a specified host.<\/p>\n<p>47. <strong>\u00a0<code>mtr command<\/code>\u00a0\u2013<\/strong>\u00a0network diagnostic tool.<\/p>\n<p>48. <strong><code>nslookup command<\/code>\u00a0\u2013<\/strong>\u00a0query Internet name servers (NS) interactively.<\/p>\n<p>49. <strong>locate command &#8211; <\/strong>To find a file in your system, the locate command will search the system for the pattern you provide.<\/p>\n<p>50. <strong>Sort by CPU Utilisation:\u00a0<\/strong>Press (Shift+P) to sort processes as per CPU utilization<\/p>\n<p>51. <strong><code>host command<\/code> &#8211; <\/strong>perform DNS lookups in Linux.<\/p>\n<iframe loading=\"lazy\"  id=\"_ytid_62051\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/ZtqBQ68cfJc?enablejsapi=1&autoplay=0&cc_load_policy=0&cc_lang_pref=&iv_load_policy=1&loop=0&rel=1&fs=1&playsinline=0&autohide=2&theme=dark&color=red&controls=1&disablekb=0&\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2><\/h2>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article provides practical examples for 51 most frequently used commands in Linux This is by no means a comprehensive list, but it should give you a jumpstart on some&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-28039","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/28039","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=28039"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/28039\/revisions"}],"predecessor-version":[{"id":29680,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/28039\/revisions\/29680"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=28039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=28039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=28039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}