index.html 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>๐Ÿญ Bye Bye Mouse</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <style>
  8. :root {
  9. /* MacOS-like Light Theme */
  10. --primary-light: #0070E0;
  11. --accent-light: #FF9500;
  12. --bg-light: #f5f5f7;
  13. --text-light: #333;
  14. --card-light: #ffffff;
  15. --border-light: #e0e0e0;
  16. --code-bg-light: #f8f8f8;
  17. --kbd-bg-light: #f0f0f0;
  18. --kbd-text-light: #222;
  19. --shadow-light: 0 4px 32px rgba(0,0,0,0.07);
  20. /* Linux-like Dark Theme */
  21. --primary-dark: #3AD900;
  22. --accent-dark: #FF7700;
  23. --bg-dark: #0a0a0a;
  24. --text-dark: #e0e0e0;
  25. --card-dark: #1a1a1a;
  26. --border-dark: #333;
  27. --code-bg-dark: #23272e;
  28. --kbd-bg-dark: #222;
  29. --kbd-text-dark: #e0e0e0;
  30. --shadow-dark: 0 4px 32px rgba(0,0,0,0.3);
  31. }
  32. html {
  33. scroll-behavior: smooth;
  34. }
  35. body {
  36. font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Arial, sans-serif;
  37. background: var(--bg-light);
  38. color: var(--text-light);
  39. margin: 0;
  40. padding: 0;
  41. transition: background 0.3s, color 0.3s;
  42. }
  43. body.dark {
  44. font-family: 'Ubuntu Mono', 'Fira Code', monospace;
  45. background: var(--bg-dark);
  46. color: var(--text-dark);
  47. }
  48. header {
  49. background: linear-gradient(90deg, var(--primary-light) 0%, var(--accent-light) 100%);
  50. color: #fff;
  51. padding: 2rem 0 1rem 0;
  52. text-align: center;
  53. position: relative;
  54. }
  55. body.dark header {
  56. background: linear-gradient(90deg, var(--primary-dark) 0%, var(--accent-dark) 100%);
  57. }
  58. .toggle-mode {
  59. position: absolute;
  60. top: 1.5rem;
  61. right: 2rem;
  62. background: rgba(255,255,255,0.15);
  63. border: none;
  64. border-radius: 2rem;
  65. padding: 0.5rem 1.2rem;
  66. color: #fff;
  67. font-size: 1rem;
  68. cursor: pointer;
  69. transition: background 0.2s;
  70. }
  71. .toggle-mode:hover {
  72. background: rgba(0,0,0,0.15);
  73. }
  74. .repo-link {
  75. position: absolute;
  76. top: 1.5rem;
  77. right: 10rem;
  78. background: rgba(255,255,255,0.15);
  79. border: none;
  80. border-radius: 2rem;
  81. padding: 0.5rem 1.2rem;
  82. color: #fff;
  83. font-size: 1rem;
  84. cursor: pointer;
  85. transition: background 0.2s;
  86. text-decoration: none;
  87. display: inline-block;
  88. }
  89. .repo-link:hover {
  90. background: rgba(0,0,0,0.15);
  91. }
  92. h1 {
  93. font-size: 2.5rem;
  94. margin: 0 0 0.5rem 0;
  95. letter-spacing: -1px;
  96. }
  97. .marquee {
  98. font-size: 1.1rem;
  99. color: #fff;
  100. background: rgba(0,0,0,0.08);
  101. padding: 0.5rem 0;
  102. border-radius: 1rem;
  103. margin: 0 auto 1rem auto;
  104. max-width: 600px;
  105. overflow: hidden;
  106. white-space: nowrap;
  107. box-sizing: border-box;
  108. animation: marquee 15s linear infinite;
  109. }
  110. @keyframes marquee {
  111. 0% { text-indent: 100% }
  112. 100% { text-indent: -100% }
  113. }
  114. main {
  115. max-width: 900px;
  116. margin: 2rem auto;
  117. padding: 2rem;
  118. background: var(--card-light);
  119. border-radius: 1.5rem;
  120. box-shadow: var(--shadow-light);
  121. border: 1px solid var(--border-light);
  122. transition: background 0.3s, border 0.3s;
  123. }
  124. body.dark main {
  125. background: var(--card-dark);
  126. border: 1px solid var(--border-dark);
  127. box-shadow: var(--shadow-dark);
  128. }
  129. h2, h3 {
  130. color: var(--primary-light);
  131. margin-top: 2.5rem;
  132. margin-bottom: 1rem;
  133. font-weight: 700;
  134. }
  135. body.dark h2, body.dark h3 {
  136. color: var(--primary-dark);
  137. }
  138. h3 {
  139. font-size: 1.3rem;
  140. margin-top: 2rem;
  141. }
  142. p {
  143. line-height: 1.7;
  144. margin: 1rem 0;
  145. }
  146. ul, ol {
  147. margin: 1rem 0 1rem 2rem;
  148. }
  149. a {
  150. color: var(--primary-light);
  151. text-decoration: none;
  152. transition: color 0.2s;
  153. }
  154. body.dark a {
  155. color: var(--primary-dark);
  156. }
  157. a:hover {
  158. color: var(--accent-light);
  159. text-decoration: underline;
  160. }
  161. body.dark a:hover {
  162. color: var(--accent-dark);
  163. }
  164. .toc {
  165. background: var(--code-bg-light);
  166. border-radius: 1rem;
  167. padding: 1.2rem 1.5rem;
  168. margin-bottom: 2rem;
  169. border: 1px solid var(--border-light);
  170. font-size: 1.05rem;
  171. box-shadow: 0 2px 8px 0 rgba(0,0,0,0.03);
  172. }
  173. body.dark .toc {
  174. background: var(--code-bg-dark);
  175. border: 1px solid var(--border-dark);
  176. }
  177. .toc ol {
  178. margin: 0;
  179. padding-left: 1.2rem;
  180. }
  181. .toc li {
  182. margin-bottom: 0.3rem;
  183. }
  184. code, pre {
  185. font-family: 'Fira Mono', 'Consolas', 'Menlo', monospace;
  186. background: var(--code-bg-light);
  187. color: #2d2d2d;
  188. border-radius: 0.5rem;
  189. padding: 0.2em 0.5em;
  190. font-size: 1em;
  191. transition: background 0.3s, color 0.3s;
  192. }
  193. pre {
  194. display: block;
  195. padding: 1em;
  196. margin: 1.2em 0;
  197. overflow-x: auto;
  198. background: var(--code-bg-light);
  199. color: #2d2d2d;
  200. border: 1px solid var(--border-light);
  201. }
  202. body.dark code, body.dark pre {
  203. background: var(--code-bg-dark);
  204. color: #f7f8fa;
  205. border-color: var(--border-dark);
  206. }
  207. .note {
  208. background: var(--accent-light);
  209. color: #222;
  210. padding: 0.7em 1em;
  211. border-radius: 0.7em;
  212. margin: 1em 0;
  213. font-size: 1.05em;
  214. font-weight: 500;
  215. display: inline-block;
  216. }
  217. body.dark .note {
  218. background: var(--accent-dark);
  219. }
  220. .table-wrap {
  221. overflow-x: auto;
  222. margin: 2em 0;
  223. }
  224. table {
  225. width: 100%;
  226. border-collapse: collapse;
  227. margin: 1.5em 0;
  228. font-size: 1em;
  229. background: var(--code-bg-light);
  230. border-radius: 1em;
  231. overflow: hidden;
  232. box-shadow: 0 2px 8px 0 rgba(0,0,0,0.03);
  233. transition: background 0.3s;
  234. }
  235. body.dark table {
  236. background: var(--code-bg-dark);
  237. }
  238. th, td {
  239. padding: 0.7em 1em;
  240. border-bottom: 1px solid var(--border-light);
  241. text-align: left;
  242. }
  243. body.dark th, body.dark td {
  244. border-bottom: 1px solid var(--border-dark);
  245. }
  246. th {
  247. background: var(--primary-light);
  248. color: #fff;
  249. font-weight: 700;
  250. }
  251. body.dark th {
  252. background: var(--primary-dark);
  253. }
  254. kbd {
  255. background: var(--kbd-bg-light);
  256. color: var(--kbd-text-light);
  257. border-radius: 0.3em;
  258. padding: 0.2em 0.5em;
  259. font-size: 1em;
  260. font-family: inherit;
  261. border: 1px solid var(--border-light);
  262. box-shadow: 0 1px 2px 0 rgba(0,0,0,0.04);
  263. margin: 0 0.1em;
  264. display: inline-block;
  265. transition: background 0.3s, color 0.3s, border 0.3s;
  266. }
  267. body.dark kbd {
  268. background: var(--kbd-bg-dark);
  269. color: var(--kbd-text-dark);
  270. border: 1px solid var(--border-dark);
  271. }
  272. .back-to-top {
  273. display: inline-block;
  274. margin-top: 1.5em;
  275. font-size: 0.95em;
  276. color: var(--primary-light);
  277. text-decoration: none;
  278. border-bottom: 1px dashed var(--primary-light);
  279. transition: color 0.2s, border 0.2s;
  280. }
  281. body.dark .back-to-top {
  282. color: var(--primary-dark);
  283. border-bottom: 1px dashed var(--primary-dark);
  284. }
  285. .back-to-top:hover {
  286. color: var(--accent-light);
  287. border-bottom: 1px dashed var(--accent-light);
  288. }
  289. body.dark .back-to-top:hover {
  290. color: var(--accent-dark);
  291. border-bottom: 1px dashed var(--accent-dark);
  292. }
  293. footer {
  294. text-align: center;
  295. padding: 2rem 0;
  296. margin-top: 2rem;
  297. }
  298. .love-btn {
  299. background: linear-gradient(90deg, var(--primary-light) 0%, var(--accent-light) 100%);
  300. color: white;
  301. padding: 0.8rem 2rem;
  302. border-radius: 2rem;
  303. text-decoration: none;
  304. font-weight: 600;
  305. box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  306. transition: transform 0.2s, box-shadow 0.2s;
  307. display: inline-block;
  308. }
  309. body.dark .love-btn {
  310. background: linear-gradient(90deg, var(--primary-dark) 0%, var(--accent-dark) 100%);
  311. }
  312. .love-btn:hover {
  313. transform: translateY(-2px);
  314. box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  315. text-decoration: none;
  316. }
  317. .theme-indicator {
  318. position: fixed;
  319. bottom: 10px;
  320. right: 10px;
  321. padding: 5px 10px;
  322. border-radius: 3px;
  323. font-size: 12px;
  324. font-family: monospace;
  325. z-index: 1000;
  326. background: var(--primary-light);
  327. color: white;
  328. }
  329. body.dark .theme-indicator {
  330. background: var(--primary-dark);
  331. color: #0a0a0a;
  332. }
  333. @media (max-width: 700px) {
  334. main {
  335. padding: 1rem;
  336. margin: 1rem;
  337. }
  338. .toc {
  339. padding: 1rem;
  340. }
  341. header {
  342. padding: 1.5rem 0 0.7rem 0;
  343. }
  344. .toggle-mode, .repo-link {
  345. position: static;
  346. display: block;
  347. margin: 0.5rem auto;
  348. width: fit-content;
  349. }
  350. h1 {
  351. font-size: 2rem;
  352. }
  353. .marquee {
  354. font-size: 1rem;
  355. max-width: 90%;
  356. }
  357. }
  358. </style>
  359. </head>
  360. <body>
  361. <header>
  362. <a href="https://gitgog.alwaysdata.net/parv.ashwani/ByeByeMouse.git"
  363. class="repo-link"
  364. target="_blank">๐Ÿ“ Repo Link</a>
  365. <button class="toggle-mode" id="toggleModeBtn" aria-label="Toggle light/dark mode">๐ŸŒ™ Dark</button>
  366. <h1>๐Ÿญ Bye Bye Mouse</h1>
  367. <div class="marquee">Because real power users don't double-clickโ€”they type :)</div>
  368. <p style="margin:0.5em 0 0 0; font-size:1.1em; font-weight:500;">Escape the tyranny of the GUI one command at a time! This repo is your golden ticket to slick shell tricks, terminal wizardry, and keyboard-fueled productivity. Unplug that mouse and watch your workflow sprint.</p>
  369. </header>
  370. <main>
  371. <section class="toc" id="quick-links">
  372. <h2 style="margin-top:0;">Quick Links</h2>
  373. <ol>
  374. <li><a href="#copy-a-file">copy a file</a></li>
  375. <li><a href="#duplicate-a-file">duplicate a file</a></li>
  376. <li><a href="#copy-a-directory">copy a directory</a></li>
  377. <li><a href="#duplicate-a-directory">duplicate a directory</a></li>
  378. <li><a href="#move-a-file">move a file</a></li>
  379. <li><a href="#rename-a-file">rename a file</a></li>
  380. <li><a href="#move-a-directory">move a directory</a></li>
  381. <li><a href="#rename-a-directory">rename a directory</a></li>
  382. <li><a href="#merge-directories">merge directories</a></li>
  383. <li><a href="#create-a-new-file">create a new file</a></li>
  384. <li><a href="#create-a-new-directory">create a new directory</a></li>
  385. <li><a href="#show-filedirectory-size">show file/directory size</a></li>
  386. <li><a href="#show-filedirectory-info">show file/directory info</a></li>
  387. <li><a href="#open-a-file-with-the-default-program">open a file with the default program</a></li>
  388. <li><a href="#open-a-file-in-any-application">open a file in any application</a></li>
  389. <li><a href="#zip-a-directory">zip a directory</a></li>
  390. <li><a href="#unzip-a-directory">unzip a directory</a></li>
  391. <li><a href="#peek-files-in-a-zip-file">peek files in a zip file</a></li>
  392. <li><a href="#remove-a-file">remove a file</a></li>
  393. <li><a href="#remove-a-directory">remove a directory</a></li>
  394. <li><a href="#remove-all-files-of-certain-criteria">remove all files of certain criteria</a></li>
  395. <li><a href="#list-directory-contents">list directory contents</a></li>
  396. <li><a href="#tree-view-a-directory-and-its-subdirectories">tree view a directory and its subdirectories</a></li>
  397. <li><a href="#find-a-stale-file">find a stale file</a></li>
  398. <li><a href="#show-a-calendar">show a calendar</a></li>
  399. <li><a href="#find-a-future-date">find a future date</a></li>
  400. <li><a href="#use-a-calculator">use a calculator</a></li>
  401. <li><a href="#force-quit-a-program">force quit a program</a></li>
  402. <li><a href="#check-server-response">check server response</a></li>
  403. <li><a href="#view-content-of-a-file">view content of a file</a></li>
  404. <li><a href="#search-for-a-text-in-a-file">search for a text in a file</a></li>
  405. <li><a href="#search-in-all-files-in-current-working-directory-quickly-entire-disk-in-less-than-15-minutes">search in all files in current working directory, quickly (entire disk in less than 15 minutes)</a></li>
  406. <li><a href="#view-an-image">view an image</a></li>
  407. <li><a href="#show-disk-size">show disk size</a></li>
  408. <li><a href="#check-cpu-usage-processes-and-ram">check cpu usage, processes and RAM</a></li>
  409. <li><a href="#know-whether-your-computer-is-under-load-and-whether-its-due-to-memory-or-cpu">know whether your computer is under load, and whether it's due to memory or CPU</a></li>
  410. <li><a href="#poweroff-or-reboot-your-computer">poweroff or reboot your computer</a></li>
  411. <li><a href="#locate-usb-drives">locate USB drives</a></li>
  412. <li><a href="#unmount-usb-drives">unmount USB drives</a></li>
  413. <li><a href="#format-usb-drives">format USB drives</a></li>
  414. <li><a href="#check-usb-format">check USB format</a></li>
  415. <li><a href="#run-command-on-all-files-of-a-directory">run command on all files of a directory</a></li>
  416. <li><a href="#check-network-connectivity-to-a-remote-address-and-port">check network connectivity to a remote address and port</a></li>
  417. <li><a href="#check-dns-config-of-a-domain">check DNS config of a domain</a></li>
  418. <li><a href="#check-the-ownership-and-registration-of-a-domain">check the ownership and registration of a domain</a></li>
  419. <li><a href="#hotkeys">Hotkeys</a></li>
  420. <li><a href="#i-cant-remember-these-cryptic-commands">I can't remember these cryptic commands</a></li>
  421. </ol>
  422. </section>
  423. <section id="copy-a-file">
  424. <h3>copy a file</h3>
  425. <div class="note">STOP DRAG AND DROPPING A FILE, OR CMD/CTRL + C, CMD/CTRL + V A FILE ๐Ÿ‘Ž</div>
  426. <p>Copy <code>readme.txt</code> to the <code>documents</code> directory</p>
  427. <pre><code>$ cp readme.txt documents/</code></pre>
  428. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  429. </section>
  430. <section id="duplicate-a-file">
  431. <h3>duplicate a file</h3>
  432. <div class="note">STOP RIGHT CLICKING AND DUPLICATE A FILE ๐Ÿ‘Ž</div>
  433. <pre><code>$ cp readme.txt readme.bak.txt</code></pre>
  434. <p>More advanced:</p>
  435. <pre><code>$ cp readme{,.bak}.txt
  436. # Note: learn how the {} works with touch foo{1,2,3}.txt and see what happens.</code></pre>
  437. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  438. </section>
  439. <section id="copy-a-directory">
  440. <h3>copy a directory</h3>
  441. <div class="note">STOP DRAG AND DROPPING A DIRECTORY, OR CMD/CTRL + C, CMD/CTRL + V A DIRECTORY ๐Ÿ‘Ž</div>
  442. <p>Copy <code>myMusic</code> directory to the <code>myMedia</code> directory</p>
  443. <pre><code>$ cp -a myMusic myMedia/
  444. # or
  445. $ cp -a myMusic/ myMedia/myMusic/</code></pre>
  446. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  447. </section>
  448. <section id="duplicate-a-directory">
  449. <h3>duplicate a directory</h3>
  450. <div class="note">STOP RIGHT CLICKING AND DUPLICATE A DIRECTORY ๐Ÿ‘Ž</div>
  451. <pre><code>$ cp -a myMusic/ myMedia/
  452. # or if `myMedia` folder doesn't exist
  453. $ cp -a myMusic myMedia/</code></pre>
  454. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  455. </section>
  456. <section id="move-a-file">
  457. <h3>move a file</h3>
  458. <div class="note">STOP DRAG AND DROPPING A FILE, OR CMD/CTRL + X, CMD/CTRL + V A FILE ๐Ÿ‘Ž</div>
  459. <pre><code>$ mv readme.txt documents/</code></pre>
  460. <p><b>Always</b> use a trailing slash when moving files, <a href="http://unix.stackexchange.com/a/50533" target="_blank">for this reason</a>.</p>
  461. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  462. </section>
  463. <section id="rename-a-file">
  464. <h3>rename a file</h3>
  465. <div class="note">STOP RIGHT CLICKING AND RENAME A FILE ๐Ÿ‘Ž</div>
  466. <pre><code>$ mv readme.txt README.md</code></pre>
  467. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  468. </section>
  469. <section id="move-a-directory">
  470. <h3>move a directory</h3>
  471. <div class="note">STOP DRAG AND DROPPING A DIRECTORY, OR CMD/CTRL + X, CMD/CTRL + V A DIRECTORY ๐Ÿ‘Ž</div>
  472. <pre><code>$ mv myMedia myMusic/
  473. # or
  474. $ mv myMedia/ myMusic/myMedia</code></pre>
  475. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  476. </section>
  477. <section id="rename-a-directory">
  478. <h3>rename a directory</h3>
  479. <div class="note">STOP RIGHT CLICKING AND RENAME A DIRECTORY ๐Ÿ‘Ž</div>
  480. <pre><code>$ mv myMedia/ myMusic/</code></pre>
  481. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  482. </section>
  483. <section id="merge-directories">
  484. <h3>merge directories</h3>
  485. <div class="note">STOP DRAG AND DROPPING TO MERGE DIRECTORIES ๐Ÿ‘Ž</div>
  486. <pre><code>$ rsync -a /images/ /images2/ # note: may over-write files with the same name, so be careful!</code></pre>
  487. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  488. </section>
  489. <section id="create-a-new-file">
  490. <h3>create a new file</h3>
  491. <div class="note">STOP RIGHT CLICKING AND CREATE A NEW FILE ๐Ÿ‘Ž</div>
  492. <pre><code>$ touch 'new file' # updates the file's access and modification timestamp if it already exists
  493. # or
  494. $ > 'new file' # note: erases the content if it already exists</code></pre>
  495. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  496. </section>
  497. <section id="create-a-new-directory">
  498. <h3>create a new directory</h3>
  499. <div class="note">STOP RIGHT CLICKING AND CREATE A NEW DIRECTORY ๐Ÿ‘Ž</div>
  500. <pre><code>$ mkdir 'untitled folder'
  501. # or
  502. $ mkdir -p 'path/may/not/exist/untitled folder'</code></pre>
  503. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  504. </section>
  505. <section id="show-filedirectory-size">
  506. <h3>show file/directory size</h3>
  507. <div class="note">STOP RIGHT CLICKING AND SHOW FILE/directory INFO ๐Ÿ‘Ž</div>
  508. <pre><code>$ du -sh node_modules/</code></pre>
  509. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  510. </section>
  511. <section id="show-filedirectory-info">
  512. <h3>show file/directory info</h3>
  513. <div class="note">STOP RIGHT CLICKING AND SHOW FILE/DIRECTORY INFO ๐Ÿ‘Ž</div>
  514. <pre><code>$ stat -x readme.md # on macOS
  515. $ stat readme.md # on Linux</code></pre>
  516. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  517. </section>
  518. <section id="open-a-file-with-the-default-program">
  519. <h3>open a file with the default program</h3>
  520. <div class="note">STOP DOUBLE CLICKING ON A FILE ๐Ÿ‘Ž</div>
  521. <pre><code>$ xdg-open file # on Linux
  522. $ open file # on MacOS
  523. $ start file # on Windows</code></pre>
  524. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  525. </section>
  526. <section id="open-a-file-in-any-application">
  527. <h3>open a file in any application</h3>
  528. <div class="note">STOP RIGHT CLICKING AND OPEN WITH ๐Ÿ‘Ž</div>
  529. <pre><code>$ open -a appName file</code></pre>
  530. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  531. </section>
  532. <section id="zip-a-directory">
  533. <h3>zip a directory</h3>
  534. <div class="note">STOP RIGHT CLICKING AND COMPRESS DIRECTORY ๐Ÿ‘Ž</div>
  535. <pre><code>$ zip -r archive_name.zip folder_to_compress</code></pre>
  536. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  537. </section>
  538. <section id="unzip-a-directory">
  539. <h3>unzip a directory</h3>
  540. <div class="note">STOP RIGHT CLICKING AND UNCOMPRESS DIRECTORY ๐Ÿ‘Ž</div>
  541. <pre><code>$ unzip archive_name.zip</code></pre>
  542. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  543. </section>
  544. <section id="peek-files-in-a-zip-file">
  545. <h3>peek files in a zip file</h3>
  546. <div class="note">STOP USING WinRAR ๐Ÿ‘Ž</div>
  547. <pre><code>$ zipinfo archive_name.zip
  548. # or
  549. $ unzip -l archive_name.zip</code></pre>
  550. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  551. </section>
  552. <section id="remove-a-file">
  553. <h3>remove a file</h3>
  554. <div class="note">STOP RIGHT CLICKING AND DELETE A FILE PERMANENTLY ๐Ÿ‘Ž</div>
  555. <pre><code>$ rm my_useless_file</code></pre>
  556. <p><b>IMPORTANT</b>: The <code>rm</code> command deletes <code>my_useless_file</code> permanently, which is equivalent to move <code>my_useless_file</code> to Recycle Bin and hit Empty Recycle Bin.</p>
  557. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  558. </section>
  559. <section id="remove-a-directory">
  560. <h3>remove a directory</h3>
  561. <div class="note">STOP RIGHT CLICKING AND DELETE A DIRECTORY PERMANENTLY ๐Ÿ‘Ž</div>
  562. <pre><code>$ rm -r my_useless_folder</code></pre>
  563. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  564. </section>
  565. <section id="remove-all-files-of-certain-criteria">
  566. <h3>remove all files of certain criteria</h3>
  567. <pre><code>$ find . -name "*.bak" -type f -delete</code></pre>
  568. <p><b>IMPORTANT</b>: run <code>find . -name "*.bak" -type f</code> first to see exactly which files you will remove.</p>
  569. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  570. </section>
  571. <section id="list-directory-contents">
  572. <h3>list directory contents</h3>
  573. <div class="note">STOP OPENING YOUR FINDER OR FILE EXPLORER ๐Ÿ‘Ž</div>
  574. <pre><code>$ ls my_folder # Simple
  575. $ ls -la my_folder # -l: show in list format. -a: show all files, including hidden. -la combines those options.
  576. $ ls -ltrha my_folder # -r: reverse output. -t: sort by time (modified). -h: output human-readable sizes.</code></pre>
  577. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  578. </section>
  579. <section id="tree-view-a-directory-and-its-subdirectories">
  580. <h3>tree view a directory and its subdirectories</h3>
  581. <div class="note">STOP OPENING YOUR FINDER OR FILE EXPLORER ๐Ÿ‘Ž</div>
  582. <pre><code>$ tree # on Linux
  583. $ find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' # on MacOS
  584. # Note: install homebrew (https://brew.sh) to be able to use (some) Linux utilities such as tree.
  585. # brew install tree</code></pre>
  586. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  587. </section>
  588. <section id="find-a-stale-file">
  589. <h3>find a stale file</h3>
  590. <div class="note">STOP USING YOUR FILE EXPLORER TO FIND A FILE ๐Ÿ‘Ž</div>
  591. <p>Find all files modified more than 5 days ago</p>
  592. <pre><code>$ find my_folder -mtime +5</code></pre>
  593. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  594. </section>
  595. <section id="show-a-calendar">
  596. <h3>show a calendar</h3>
  597. <div class="note">STOP LOOKING UP WHAT THIS MONTH LOOKS LIKE BY CALENDAR WIDGETS ๐Ÿ‘Ž</div>
  598. <p>Display a text calendar</p>
  599. <pre><code>$ cal</code></pre>
  600. <p>Display selected month and year calendar</p>
  601. <pre><code>$ cal 11 2018</code></pre>
  602. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  603. </section>
  604. <section id="find-a-future-date">
  605. <h3>find a future date</h3>
  606. <div class="note">STOP USING WEBAPPS TO CALCULATE FUTURE DATES ๐Ÿ‘Ž</div>
  607. <p>What is today's date?</p>
  608. <pre><code>$ date +%m/%d/%Y</code></pre>
  609. <p>What about a week from now?</p>
  610. <pre><code>$ date -d "+7 days" # on Linux
  611. $ date -j -v+7d # on MacOS</code></pre>
  612. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  613. </section>
  614. <section id="use-a-calculator">
  615. <h3>use a calculator</h3>
  616. <div class="note">STOP USING CALCULATOR WIDGET ๐Ÿ‘Ž</div>
  617. <pre><code>$ bc -l</code></pre>
  618. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  619. </section>
  620. <section id="force-quit-a-program">
  621. <h3>force quit a program</h3>
  622. <div class="note">STOP CTRL + ALT + DELETE and choose the program to kill ๐Ÿ‘Ž</div>
  623. <pre><code>$ killall -9 program_name</code></pre>
  624. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  625. </section>
  626. <section id="check-server-response">
  627. <h3>check server response</h3>
  628. <div class="note">STOP OPENING A BROWSER ๐Ÿ‘Ž</div>
  629. <pre><code>$ curl -i rbtreevi.web.app
  630. # curl's -i (--include) option includes HTTP response headers in its output.</code></pre>
  631. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  632. </section>
  633. <section id="view-content-of-a-file">
  634. <h3>view content of a file</h3>
  635. <div class="note">STOP DOUBLE CLICKING A FILE ๐Ÿ‘Ž</div>
  636. <pre><code>$ cat apps/settings.py
  637. # if the file is too big to fit on one page, you can use a 'pager' (less) which shows you one page at a time.
  638. $ less apps/settings.py</code></pre>
  639. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  640. </section>
  641. <section id="search-for-a-text-in-a-file">
  642. <h3>search for a text in a file</h3>
  643. <div class="note">STOP CMD/CTRL + F IN A FILE ๐Ÿ‘Ž</div>
  644. <pre><code>$ grep -i "Query" file.txt</code></pre>
  645. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  646. </section>
  647. <section id="search-in-all-files-in-current-working-directory-quickly-entire-disk-in-less-than-15-minutes">
  648. <h3>search in all files in current working directory, quickly (entire disk in less than 15 minutes)</h3>
  649. <div class="note">STOP CMD/CTRL + F IN A DIRECTORY ๐Ÿ‘Ž</div>
  650. <pre><code>$ ripgrep -i "Query"
  651. # brew install ripgrep</code></pre>
  652. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  653. </section>
  654. <section id="view-an-image">
  655. <h3>view an image</h3>
  656. <div class="note">STOP USING PREVIEW ๐Ÿ‘Ž</div>
  657. <pre><code>$ imgcat image.png
  658. # Note: requires iTerm2 terminal.</code></pre>
  659. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  660. </section>
  661. <section id="show-disk-size">
  662. <h3>show disk size</h3>
  663. <div class="note">STOP RIGHT CLICKING DISK ICON OR OPENING DISK UTILITY ๐Ÿ‘Ž</div>
  664. <pre><code>$ df -h</code></pre>
  665. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  666. </section>
  667. <section id="check-cpu-usage-processes-and-ram">
  668. <h3>check cpu usage, processes and RAM</h3>
  669. <div class="note">STOP OPENING YOUR ACTIVITY MONITOR OR TASK MANAGER ๐Ÿ‘Ž</div>
  670. <pre><code>$ top</code></pre>
  671. <p>if you want some more details:</p>
  672. <pre><code>$ htop</code></pre>
  673. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  674. </section>
  675. <section id="know-whether-your-computer-is-under-load-and-whether-its-due-to-memory-or-cpu">
  676. <h3>know whether your computer is under load, and whether it's due to memory or CPU</h3>
  677. <pre><code>$ glances
  678. # brew install glances
  679. # pip install --user 'glances[all]'</code></pre>
  680. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  681. </section>
  682. <section id="poweroff-or-reboot-your-computer">
  683. <h3>poweroff or reboot your computer</h3>
  684. <p>This can be useful when you're patching a server that is accessed via SSH and you don't have a GUI.</p>
  685. <pre><code># poweroff
  686. $ sudo shutdown -h now
  687. # reboot
  688. $ sudo shutdown -r now</code></pre>
  689. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  690. </section>
  691. <section id="locate-usb-drives">
  692. <h3>locate USB drives</h3>
  693. <pre><code>$ df</code></pre>
  694. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  695. </section>
  696. <section id="unmount-usb-drives">
  697. <h3>unmount USB drives</h3>
  698. <pre><code>$ sudo umount /dev/sdb1</code></pre>
  699. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  700. </section>
  701. <section id="format-usb-drives">
  702. <h3>format USB drives</h3>
  703. <pre><code># FAT32
  704. $ sudo mkfs.vfat /dev/sdb1
  705. # NTFS
  706. $ sudo mkfs.ntfs /dev/sdb1
  707. # exFAT
  708. $ sudo mkfs.exfat /dev/sdb1</code></pre>
  709. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  710. </section>
  711. <section id="check-usb-format">
  712. <h3>check USB format</h3>
  713. <pre><code>$ sudo fsck /dev/sdb1</code></pre>
  714. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  715. </section>
  716. <section id="run-command-on-all-files-of-a-directory">
  717. <h3>run command on all files of a directory</h3>
  718. <div class="note">STOP CLICKING THE FILES ONE BY ONE ๐Ÿ‘Ž</div>
  719. <pre><code>$ for FILE in *; do echo $FILE; done</code></pre>
  720. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  721. </section>
  722. <section id="check-network-connectivity-to-a-remote-address-and-port">
  723. <h3>check network connectivity to a remote address and port</h3>
  724. <div class="note">STOP USING NETWORK UTILITY</div>
  725. <pre><code>$ nc -vz www.google.com 443
  726. $ nc -vz 1.1.1.1 53</code></pre>
  727. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  728. </section>
  729. <section id="check-dns-config-of-a-domain">
  730. <h3>check DNS config of a domain</h3>
  731. <div class="note">STOP USING NETWORK UTILITY</div>
  732. <pre><code>$ dig www.google.com</code></pre>
  733. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  734. </section>
  735. <section id="check-the-ownership-and-registration-of-a-domain">
  736. <h3>check the ownership and registration of a domain</h3>
  737. <div class="note">STOP USING NETWORK UTILITY AND THE WEBSITE OF DOMAIN REGISTRATION PROVIDERS</div>
  738. <pre><code>$ whois www.google.com</code></pre>
  739. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  740. </section>
  741. <section id="hotkeys">
  742. <h3>Hotkeys</h3>
  743. <div class="table-wrap">
  744. <table>
  745. <thead>
  746. <tr>
  747. <th>Hotkey</th>
  748. <th>Description</th>
  749. </tr>
  750. </thead>
  751. <tbody>
  752. <tr><td><kbd>Ctrl</kbd>+<kbd>A</kbd></td><td>Go to the beginning of the line you are currently typing on</td></tr>
  753. <tr><td><kbd>Ctrl</kbd>+<kbd>E</kbd></td><td>Go to the end of the line you are currently typing on</td></tr>
  754. <tr><td><kbd>Ctrl</kbd>+<kbd>L</kbd></td><td>Clears the Screen, similar to the clear command</td></tr>
  755. <tr><td><kbd>Ctrl</kbd>+<kbd>U</kbd></td><td>Clears the line before the cursor position. If you are at the end of the line, clears the entire line.</td></tr>
  756. <tr><td><kbd>Ctrl</kbd>+<kbd>H</kbd></td><td>Same as backspace</td></tr>
  757. <tr><td><kbd>Ctrl</kbd>+<kbd>R</kbd></td><td>Lets you search through previously used commands</td></tr>
  758. <tr><td><kbd>Ctrl</kbd>+<kbd>C</kbd></td><td>Kill whatever you are running</td></tr>
  759. <tr><td><kbd>Ctrl</kbd>+<kbd>D</kbd></td><td>Exit the current shell</td></tr>
  760. <tr><td><kbd>Ctrl</kbd>+<kbd>Z</kbd></td><td>Puts whatever you are running into a suspended background process. fg restores it.</td></tr>
  761. <tr><td><kbd>Ctrl</kbd>+<kbd>W</kbd></td><td>Delete the word before the cursor</td></tr>
  762. <tr><td><kbd>Ctrl</kbd>+<kbd>K</kbd></td><td>Clear the line after the cursor</td></tr>
  763. <tr><td><kbd>Ctrl</kbd>+<kbd>T</kbd></td><td>Swap the last two characters before the cursor</td></tr>
  764. <tr><td><kbd>Ctrl</kbd>+<kbd>F</kbd></td><td>Move cursor forward one character</td></tr>
  765. <tr><td><kbd>Ctrl</kbd>+<kbd>B</kbd></td><td>Move cursor backward one character</td></tr>
  766. <tr><td><kbd>Esc</kbd>+<kbd>T</kbd></td><td>Swap the last two words before the cursor</td></tr>
  767. <tr><td><kbd>Alt</kbd>+<kbd>T</kbd></td><td>Same as <kbd>Esc</kbd> + <kbd>T</kbd></td></tr>
  768. <tr><td><kbd>Alt</kbd>+<kbd>F</kbd></td><td>Move cursor forward one word on the current line</td></tr>
  769. <tr><td><kbd>Alt</kbd>+<kbd>B</kbd></td><td>Move cursor backward one word on the current line</td></tr>
  770. <tr><td><kbd>Esc</kbd>+<kbd>F</kbd></td><td>Same as <kbd>Alt</kbd> + <kbd>F</kbd></td></tr>
  771. <tr><td><kbd>Esc</kbd>+<kbd>B</kbd></td><td>Same as <kbd>Alt</kbd> + <kbd>B</kbd></td></tr>
  772. <tr><td><kbd>Alt</kbd>+<kbd>.</kbd></td><td>Paste the last word of the most recently command</td></tr>
  773. <tr><td><kbd>Tab</kbd></td><td>Auto-complete files and directory names</td></tr>
  774. </tbody>
  775. </table>
  776. </div>
  777. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  778. </section>
  779. <section id="i-cant-remember-these-cryptic-commands">
  780. <h3>I can't remember these cryptic commands</h3>
  781. <p>You can always google or <code>man</code> the commands you are not familiar with. Or, checkout <a href="https://github.com/tldr-pages/tldr" target="_blank">tldr</a>, a collection of simplified and community-driven man pages.</p>
  782. <a class="back-to-top" href="#quick-links">Go to table of contents ๐Ÿ”ผ</a>
  783. </section>
  784. </main>
  785. <footer>
  786. <a href="https://instagram.com/parvcodes" class="love-btn" target="_blank">
  787. Made With โค๏ธ by Parv Ashwani
  788. </a>
  789. </footer>
  790. <div class="theme-indicator" id="themeIndicator">MacOS Theme</div>
  791. <script>
  792. // Light/Dark mode toggle
  793. const btn = document.getElementById('toggleModeBtn');
  794. const themeIndicator = document.getElementById('themeIndicator');
  795. const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
  796. function setMode(dark) {
  797. document.body.classList.toggle('dark', dark);
  798. btn.textContent = dark ? 'โ˜€๏ธ Light' : '๐ŸŒ™ Dark';
  799. localStorage.setItem('theme', dark ? 'dark' : 'light');
  800. // Update theme indicator
  801. if (dark) {
  802. themeIndicator.textContent = 'Linux Theme';
  803. } else {
  804. themeIndicator.textContent = 'MacOS Theme';
  805. }
  806. // Add subtle theme transition
  807. document.body.style.transition = 'background 0.5s ease, color 0.5s ease';
  808. setTimeout(() => {
  809. document.body.style.transition = '';
  810. }, 500);
  811. }
  812. // On load
  813. (() => {
  814. const saved = localStorage.getItem('theme');
  815. if (saved) setMode(saved === 'dark');
  816. else setMode(prefersDark);
  817. })();
  818. btn.onclick = () => setMode(!document.body.classList.contains('dark'));
  819. </script>
  820. </body>
  821. </html>