TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Can I see your cheatsheet?

346 点作者 fastily将近 3 年前
Almost everyone I know keeps a list of (easily forgettable) command line snippets somewhere. I can&#x27;t imagine that HN folks would be any different :)<p>So that said, could I please see your cheatsheet?<p>I&#x27;ll go first: <a href="https:&#x2F;&#x2F;github.com&#x2F;fastily&#x2F;cheatsheet" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;fastily&#x2F;cheatsheet</a>

75 条评论

asicsp将近 3 年前
I use my ebooks for reference:<p>* GNU grep and ripgrep (<a href="https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;learn_gnugrep_ripgrep&#x2F;" rel="nofollow">https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;learn_gnugrep_ripgrep&#x2F;</a>)<p>* GNU sed (<a href="https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;learn_gnused&#x2F;" rel="nofollow">https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;learn_gnused&#x2F;</a>)<p>* GNU awk (<a href="https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;learn_gnuawk&#x2F;" rel="nofollow">https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;learn_gnuawk&#x2F;</a>)<p>* Ruby one-liners cookbook (<a href="https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;learn_ruby_oneliners&#x2F;" rel="nofollow">https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;learn_ruby_oneliners&#x2F;</a>)<p>* Perl one-liners cookbook (<a href="https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;learn_perl_oneliners&#x2F;" rel="nofollow">https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;learn_perl_oneliners&#x2F;</a>)<p>* Command line text processing with GNU Coreutils (<a href="https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;cli_text_processing_coreutils&#x2F;" rel="nofollow">https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;cli_text_processing_coreuti...</a>)<p>* Command line text processing with Rust tools (<a href="https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;cli_text_processing_rust&#x2F;" rel="nofollow">https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;cli_text_processing_rust&#x2F;</a>) — work-in-progress<p>* Computing from the Command Line (<a href="https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;cli-computing&#x2F;" rel="nofollow">https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;cli-computing&#x2F;</a>) — work-in-progress
评论 #31930840 未加载
评论 #31931804 未加载
评论 #31935430 未加载
评论 #31938787 未加载
CraigJPerry将近 3 年前
Set a huuuuuuuge shell history <a href="https:&#x2F;&#x2F;github.com&#x2F;craigjperry2&#x2F;dotfiles&#x2F;blob&#x2F;aa77ddcbde63bf3a0a61a2c218bf36f8e146a3c9&#x2F;dotfiles&#x2F;zshrc#L44" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;craigjperry2&#x2F;dotfiles&#x2F;blob&#x2F;aa77ddcbde63bf...</a> then fzf ctrl+r bindings mean you can recall anything right where you need it.<p>If you’re going to do this then have an escape hatch for commands you don’t want memorised <a href="https:&#x2F;&#x2F;github.com&#x2F;craigjperry2&#x2F;dotfiles&#x2F;blob&#x2F;aa77ddcbde63bf3a0a61a2c218bf36f8e146a3c9&#x2F;dotfiles&#x2F;zshrc#L52" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;craigjperry2&#x2F;dotfiles&#x2F;blob&#x2F;aa77ddcbde63bf...</a>
评论 #31931882 未加载
评论 #31930372 未加载
评论 #31930692 未加载
评论 #31932432 未加载
评论 #31935194 未加载
评论 #31932573 未加载
ww520将近 3 年前
<p><pre><code> - Find all files modified in the last 90 minutes find . -type f -mmin -90 - Find all files and do something to each one find . -type f -mmin -90 | xargs ls -l - Find all files modified before 2 days ago find . -type f -mtime +2 - Removing files older than 7 days find . -type f -mtime +7 -name &#x27;*.gz&#x27; -exec rm {} \; - Find all files modified after last 2 days find . -type f -mtime -2 - Find all files modified at the last 2 day mark find . -type f -mtime 2</code></pre>
评论 #31930398 未加载
评论 #31930003 未加载
评论 #31931053 未加载
评论 #31931059 未加载
评论 #31930214 未加载
评论 #31930072 未加载
mosselman将近 3 年前
<a href="http:&#x2F;&#x2F;cht.sh&#x2F;" rel="nofollow">http:&#x2F;&#x2F;cht.sh&#x2F;</a> - I use this a lot. It outputs a short summary of common commands for many cli tools. You can curl to it <a href="https:&#x2F;&#x2F;cht.sh&#x2F;grep" rel="nofollow">https:&#x2F;&#x2F;cht.sh&#x2F;grep</a> for example or install their cli client
评论 #31945730 未加载
评论 #31931616 未加载
评论 #31936172 未加载
scrapheap将近 3 年前
No maintained cheat sheet here either. I do use `history | grep` quite a lot though.<p>One thing I try to do is to keep my keyboard shortcuts consistent between programs&#x2F;systems. That way the chance of my instinct of pressing `&lt;CTRL&gt;+a` to move the cursor to the start of the line will be correct more often.<p>Another thing I try to do when a project has a set of complex commands that are needed, is to add them as a rule in its Makefile, that way they&#x27;re available for my colleagues as well.
评论 #31930504 未加载
评论 #31929790 未加载
评论 #31930196 未加载
评论 #31929859 未加载
hillacious将近 3 年前
One of the most useful cheat sheet utilities I&#x27;ve come across is cheat.sh: <a href="https:&#x2F;&#x2F;github.com&#x2F;chubin&#x2F;cheat.sh" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;chubin&#x2F;cheat.sh</a><p>If you don&#x27;t have it installed it can easily be queried with curl from the command line like: `curl cheat.sh&#x2F;sed`. The payload is colorized and gives a lot of examples of usage of the command. You can also query &quot;cht.sh&quot; to use fewer characters. There is actually a lot more advanced usage of the tool&#x2F;service if you check out the README.<p>Apologies if this isn&#x27;t what you&#x27;re looking for.
评论 #31937388 未加载
tiborsaas将近 3 年前
This surprised me that people do this. I don&#x27;t have any, since if I have to look up one, it&#x27;s not really useful :)<p>But my cheat sheet is google, I usually find what I want in no time.
评论 #31930514 未加载
McDyver将近 3 年前
Delete empty files &#x2F; empty directories<p>find . -type f -empty -print -delete<p>find . -type d -empty -print -delete<p>Move photos&#x2F;videos to folder, based on their creation date<p>exiftool -d &#x2F;home&#x2F;user&#x2F;Photos&#x2F;%Y-%m-%d &quot;-directory&lt;CreateDate&quot; .&#x2F;VID*.{mp4,jpg}<p>(or leave the extension out, and all files with EXIF data will be included)
pcthrowaway将近 3 年前
My only real cheatsheet is a list of shortcuts I maintain for programs&#x2F;apps I use:<p><pre><code> system: ctrl+space=switch keyboard input language iterm2: cmd+; = autocomplete fn+cmd+&lt; = scroll to top of buffer fn+cmd+&gt; = scroll to bottom of buffer fn+cmd+^ = pgup buffer fn+cmd+v = pgdown buffer fn+&lt; = beginning of line fn+&gt; = end of line shift+cmd+[ = previous tab shift+cmd+] = next tab cmd+K = delete til end of line cmd+enter = full-screen on&#x2F;off cmd+shift+e = show command timeline!!! chrome: opt+cmd+J = devtools cmd+] = devtools tab right cmd+[ = devtools tab left opt+space = start&#x2F;stop toggl fn+cmd+&lt; = move tab left fn+cmd+&gt; = move tab right fn+cmd+^ = move tab to start fn+cmd+v = move tab to end sublime: ctrl+` = open python console cmd+shift+P = open command palette cmd+P = search open files ctrl+opt+C = open in browser with View in Browser package (create tmpfile if dirty) cmd+shift+[ = Move to left pane cmd+shift+] = Move to right pane ctrl+0 = move to sidebar cmd+k+b = show&#x2F;hide sidebar cmd+k+u = uppercase cmd+k+l = lowercase ctrl+shift+v = multiple cursor down ctrl+shift+^ = multiple cursor up shift+tab = back up tab indentation (at beginning of line) cmd+[ = dedent (when highlighted) cmd+[ = indent (when highlighted) cmd+shift+. = show dotfiles in open file view cmd+shit+g (when opening file) = navigate to path for file selection # edit package override files in &#x2F;User&#x2F;user&#x2F;Library&#x2F;Application Support&#x2F;Sublime Text 3&#x2F;Packages&#x2F;User&#x2F; VS Code: option+^ = drag line up option+v = drag line down ctrl+` = open terminal cmd+p, :#&lt;enter&gt; = go to line ctrl+enter = open alongside cmd+b = open&#x2F;close side panel cmd+option+shift+&gt; = move tab right cmd+option+shift+&lt; = move tab left cmd+option+F = toggle fullscreen cmd+shift+l = highlight all selected cmd+shift+o = type fn name to jump to in open file cmd+option+shift+c = copy path of active filename Asana: cmd+shift+M: monospace highlighted text</code></pre>
评论 #31929212 未加载
评论 #31929794 未加载
meribold将近 3 年前
Mine is a file named oneliners.bash [1], and I have a Bash keybind (Control+I) [2] that runs fzf with that file as input and lets me select a command.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;meribold&#x2F;dotfiles&#x2F;blob&#x2F;e4dc5ee09d9e6563462c9243f1556706c1bd6dc6&#x2F;misc&#x2F;oneliners.bash" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;meribold&#x2F;dotfiles&#x2F;blob&#x2F;e4dc5ee09d9e656346...</a><p>[2]: <a href="https:&#x2F;&#x2F;github.com&#x2F;meribold&#x2F;dotfiles&#x2F;blob&#x2F;e4dc5ee09d9e6563462c9243f1556706c1bd6dc6&#x2F;home&#x2F;bashrc#L188" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;meribold&#x2F;dotfiles&#x2F;blob&#x2F;e4dc5ee09d9e656346...</a>
Toreno96将近 3 年前
<a href="https:&#x2F;&#x2F;github.com&#x2F;Toreno96&#x2F;dotfiles&#x2F;blob&#x2F;master&#x2F;commands.txt" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Toreno96&#x2F;dotfiles&#x2F;blob&#x2F;master&#x2F;commands.tx...</a><p>Beware: I started this long before I became a fan of markdown, so the syntax of the whole file could seem as pretty weird, but it works for me. I mainly do `rg &lt;pattern&gt; ~&#x2F;commands.txt` in shell or `&#x2F;&lt;pattern&gt;` in vim when I need to find something in there.<p>There are also definitely too much commands dumped into the `Etc` section. I should reorganize this some day.
rjh29将近 3 年前
Try using flashcards (Anki) to remember shortcuts if you haven&#x27;t yet. Just like with learning a foreign language, it&#x27;s a quick way to get &quot;action -&gt; shortcut&quot; mappings into your brain permanently for recall at any time, rather than relying on a cheatsheet.
评论 #31950040 未加载
sandreas将近 3 年前
Shell scripting: <a href="https:&#x2F;&#x2F;pilabor.com&#x2F;blog&#x2F;2021&#x2F;04&#x2F;shell-scripting-cheatsheet&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pilabor.com&#x2F;blog&#x2F;2021&#x2F;04&#x2F;shell-scripting-cheatsheet&#x2F;</a><p>Markdown: <a href="https:&#x2F;&#x2F;pilabor.com&#x2F;blog&#x2F;2021&#x2F;04&#x2F;markdown-cheatsheet&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pilabor.com&#x2F;blog&#x2F;2021&#x2F;04&#x2F;markdown-cheatsheet&#x2F;</a>
评论 #31929184 未加载
yourcousinbilly将近 3 年前
I have a massive Cheatsheet for most languages and many packages- <a href="https:&#x2F;&#x2F;github.com&#x2F;jsfuentes&#x2F;Code-Cheatsheet" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jsfuentes&#x2F;Code-Cheatsheet</a><p>Also hosted on gitbooks: <a href="https:&#x2F;&#x2F;openai.gitbook.io&#x2F;code-cheatsheets&#x2F;" rel="nofollow">https:&#x2F;&#x2F;openai.gitbook.io&#x2F;code-cheatsheets&#x2F;</a>
评论 #31935114 未加载
smivan将近 3 年前
<a href="https:&#x2F;&#x2F;github.com&#x2F;issmirnov&#x2F;dotfiles&#x2F;tree&#x2F;master&#x2F;cheat&#x2F;personal" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;issmirnov&#x2F;dotfiles&#x2F;tree&#x2F;master&#x2F;cheat&#x2F;pers...</a><p>powered by <a href="https:&#x2F;&#x2F;github.com&#x2F;cheat&#x2F;cheat" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cheat&#x2F;cheat</a>
kdeldycke将近 3 年前
All my CLI: <a href="https:&#x2F;&#x2F;kevin.deldycke.com&#x2F;2006&#x2F;12&#x2F;all-my-command-lines&#x2F;" rel="nofollow">https:&#x2F;&#x2F;kevin.deldycke.com&#x2F;2006&#x2F;12&#x2F;all-my-command-lines&#x2F;</a><p>The one I&#x27;m probably the most proud of is that one-liner to produce GIFs:<p><pre><code> $ ffmpeg -i .&#x2F;source.mp4 -ss 00:24:52.4 -to 00:24:57.0 -filter_complex &quot;[0:v] fps=12,scale=width=480:height=-1:flags=lanczos,subtitles=source.mp4:si=0:force_style=&#x27;FontName=Arial Black,Bold=-1,FontSize=26&#x27;,split [a][b];[a] palettegen=64 [p];[b][p] paletteuse&quot; .&#x2F;meme.gif </code></pre> Source: <a href="https:&#x2F;&#x2F;kevin.deldycke.com&#x2F;2006&#x2F;11&#x2F;video-commands&#x2F;" rel="nofollow">https:&#x2F;&#x2F;kevin.deldycke.com&#x2F;2006&#x2F;11&#x2F;video-commands&#x2F;</a>
darekkay将近 3 年前
For bash, this is my cheatsheet (can be viewed from within bash): <a href="https:&#x2F;&#x2F;github.com&#x2F;darekkay&#x2F;config-files&#x2F;blob&#x2F;master&#x2F;bash&#x2F;.commands" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;darekkay&#x2F;config-files&#x2F;blob&#x2F;master&#x2F;bash&#x2F;.c...</a><p>I also maintain cheatsheets for some dev stuff: <a href="https:&#x2F;&#x2F;github.com&#x2F;darekkay&#x2F;config-files&#x2F;tree&#x2F;master&#x2F;cheat-sheets" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;darekkay&#x2F;config-files&#x2F;tree&#x2F;master&#x2F;cheat-s...</a><p>And then there&#x27;s my Flexbox cheatsheet: <a href="https:&#x2F;&#x2F;darekkay.com&#x2F;flexbox-cheatsheet&#x2F;" rel="nofollow">https:&#x2F;&#x2F;darekkay.com&#x2F;flexbox-cheatsheet&#x2F;</a>
vince14将近 3 年前
Creating clips from tv recordings:<p><pre><code> ffmpeg -ss 01:59:00.000 -i &quot;interlaced.ts&quot; -ss 00:00:12.000 -t 26 -max_muxing_queue_size 1024 -c:a libopus -b:a 96k -c:v libx264 -crf 20 -vf &quot;yadif=1&quot; -profile:v baseline -level 3.0 -pix_fmt yuv420p -movflags +faststart -y clip.mp4 </code></pre> Make clip compatible with WhatsApp:<p><pre><code> ffmpeg -i in.mp4 -map 0:v:0 -map 0:a:0 -map_metadata -1 -map_chapters -1 -c:v libx264 -preset slow -tune film -crf 32 -c:a aac -b:a 128k -profile:v baseline -level 3.0 -pix_fmt yuv420p -movflags +faststart out.mp4 </code></pre> Copying in various terminals:<p><pre><code> PuTTY: select tmux: Shift + select cmd: select + Enter in quick edit mode Windows Terminal: select + Right Click</code></pre>
评论 #31930146 未加载
评论 #31958034 未加载
moreati将近 3 年前
I use twitter <a href="https:&#x2F;&#x2F;twitter.com&#x2F;search?q=from:moreati%20ansible%20tip&amp;src=typed_query&amp;f=live" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;search?q=from:moreati%20ansible%20tip&amp;sr...</a>. More generally I have a Firefox bookmark set up so &quot;tm search term&quot; searches my previous tweets.<p>If I ever get round to editting&#x2F;refining these I plan to do it on <a href="https:&#x2F;&#x2F;devhints.io" rel="nofollow">https:&#x2F;&#x2F;devhints.io</a> - <a href="https:&#x2F;&#x2F;devhints.io&#x2F;xpath" rel="nofollow">https:&#x2F;&#x2F;devhints.io&#x2F;xpath</a> and <a href="https:&#x2F;&#x2F;devhints.io&#x2F;bash" rel="nofollow">https:&#x2F;&#x2F;devhints.io&#x2F;bash</a> are so nice.
bajsejohannes将近 3 年前
My extremely short shell cheatsheet for things I do rarely enough to forget each time:<p><pre><code> Process substitution: bash: diff &lt;(echo hello) &lt;(echo world) fish: diff (echo hello | psub) (echo world | psub) Rsync directories: rsync -a -v --dry-run other:dir&#x2F; dir&#x2F; Syncs the contents of dir (`&#x2F;` needed) Script exit handler: bash: function finish { # exit handling code } trap finish EXIT # EXIT is special and works on normal exit as well as interrupts</code></pre>
评论 #31929696 未加载
theginger将近 3 年前
tab tab tab tab tab tab tab tab As someone who is quite severely dyslexic tab complete changed my life.
ebfe1将近 3 年前
As for me, I put together some spaghetti bash functions for taking note while using the terminal (eg run tnote function will let me select one of the last 10 commands, type a description of what it does and move on with my day...i can come back later and sort it out into my notes)...<p>I then write another small bash script that use consolemd and surge(probably will move to github page at some point) to generate a simple webpage with simple markdown JavaScript library to serve it up along with all the files generated by consolemd so i can use curl in terminal and have it colorfully displayed.<p>The cheatsheet site is here <a href="https:&#x2F;&#x2F;ch.ebfe.pw&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ch.ebfe.pw&#x2F;</a>.<p>And you can try it in terminal: curl <a href="https:&#x2F;&#x2F;ch.ebfe.pw&#x2F;intel&#x2F;splunk" rel="nofollow">https:&#x2F;&#x2F;ch.ebfe.pw&#x2F;intel&#x2F;splunk</a><p>And my code can be found here if you are interested:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;santrancisco&#x2F;cheat" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;santrancisco&#x2F;cheat</a>
Helmut10001将近 3 年前
I write down all my commands, ever issued in the terminal, in temporal ordered markdown files per task&#x2F;project. This means I can go back, compare, see how I did it in the past and improve, if possible. Or investigate, why something isn&#x27;t working (based on my noted commands, which is eaier in hindsight).
评论 #31930682 未加载
chrismorgan将近 3 年前
I keep some as shell aliases, shell scripts or Git aliases, but mostly I just use my shell history, finding commands with Ctrl+R and a few characters that I know to be in there somewhere. (If you want to do this, make sure you set its limit high enough so you don’t lose stuff.)
ww520将近 3 年前
<p><pre><code> - List dirs and file count, to find dir with high file count. for i in &#x2F;home&#x2F;*; do echo $i; find $i | wc -l; done for i in &#x2F;*; do echo $i; find $i | wc -l; done - Report space usage of the top level subdirectories. du -h --max-depth=2 - Report space summary only, no directory output. du -s -h - Find out which device a directory is in. df &#x2F;tmp df &#x2F;home - Print of tree of directories tree . - Disk fdisk -l, list disk partitions lsblk, show a tree of disks, partitions, and lvm volumes lsblk -d, show physical devices lsblk -io KNAME,TYPE,SIZE,MODEL, name&#x2F;type&#x2F;size&#x2F;model</code></pre>
评论 #31930055 未加载
charlax将近 3 年前
<a href="https:&#x2F;&#x2F;github.com&#x2F;charlax&#x2F;dotfiles&#x2F;tree&#x2F;master&#x2F;cheatsheets" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;charlax&#x2F;dotfiles&#x2F;tree&#x2F;master&#x2F;cheatsheets</a> using cheat
mehdix将近 3 年前
Like some others, I don&#x27;t have a list of cheatsheets except my bash history and my browser bookmarks. My bash history atm contains 4575 unique entries (I reset it a few weeks ago). It is like L1 cache to me for accessing most frequently used commands. Beside that I press `*` then Space in browser bar to search my previously bookmarks (I add keywords to them upon bookmarking by modifying the title). Beside these two, nowadays I write Makefiles in every project I work on. That way one can consolidate all commands that otherwise would be forgotten or scattered in configs, in one place.
lynndotpy将近 3 年前
I use these two commands regularly:<p>1. `history | grep somecommand` to see a command I used previously. (I have my history set to a bonkers high number.) 2. `curl cht.sh&#x2F;somecommand` to see a crowdsourced cheatsheet for a command. See: <a href="https:&#x2F;&#x2F;cht.sh&#x2F;grep" rel="nofollow">https:&#x2F;&#x2F;cht.sh&#x2F;grep</a> 3. DuckDuckGo often has good cheat sheets, e.g. <a href="https:&#x2F;&#x2F;duckduckgo.com&#x2F;?q=tmux+cheat" rel="nofollow">https:&#x2F;&#x2F;duckduckgo.com&#x2F;?q=tmux+cheat</a><p>I also use fish, which has nice history-based autocomplete
dolfins将近 3 年前
I use navi: <a href="https:&#x2F;&#x2F;github.com&#x2F;denisidoro&#x2F;navi" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;denisidoro&#x2F;navi</a><p>&gt; navi allows you to browse through cheatsheets (that you may write yourself or download from maintainers) and execute commands. Suggested values for arguments are dynamically displayed in a list.<p>It also lets you use cheatsheets from tldr and cheat.sh from it (besides your own cheatsheets). I&#x27;ve started to mostly just maintain my own, copying what I find most useful from those repositories, though.
kbouck将近 3 年前
For those with larger collections (I&#x27;m up to ~350 individual sheets), I&#x27;m interested to know you access (find&#x2F;read&#x2F;edit) the cheatsheets. My way:<p>(Mac Desktop): I use xbar [0] with a custom script to create a menubar nested dropdown of all of my cheatsheets. Selecting opens in typora [0] for reading&#x2F;editing markdown.<p>(CLI): I use cheat [0] which consumes the same markdown cheatsheet content<p><pre><code> [0]: https:&#x2F;&#x2F;xbarapp.com [1]: https:&#x2F;&#x2F;typora.io [2]: https:&#x2F;&#x2F;github.com&#x2F;cheat&#x2F;cheat</code></pre>
ozim将近 3 年前
I keep my &quot;lab&quot; diary in txt files for each day and use VSCode.<p>Would not ever post any of it because these are mostly specific command lines.<p>Then with VSCode if I need to remind myself of something I search for command I might use and get my whole history with contexts. Then I copy paste&#x2F;change and keep all that history there.<p>Never ever I will spend time organizing it into cheat-sheet because it will be waste of time anything that I put into cheat-sheet that I won&#x27;t use in next 6-12 months will be just cluttering space on such cheat-sheet.
tomcam将近 3 年前
Go examples <a href="https:&#x2F;&#x2F;github.com&#x2F;tomcam&#x2F;goexamples" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tomcam&#x2F;goexamples</a><p>The least you need to know about GitHub pages <a href="https:&#x2F;&#x2F;tomcam.github.io&#x2F;least-github-pages&#x2F;" rel="nofollow">https:&#x2F;&#x2F;tomcam.github.io&#x2F;least-github-pages&#x2F;</a><p>Soup to nuts psql tutorial <a href="https:&#x2F;&#x2F;tomcam.github.io&#x2F;postgres&#x2F;" rel="nofollow">https:&#x2F;&#x2F;tomcam.github.io&#x2F;postgres&#x2F;</a>
ripley12将近 3 年前
On a related note: has anyone used a good tool for using&#x2F;inserting these kinds of custom snippets? It would be neat to have a snippet manager with quick search bound to a keypress.
评论 #31929476 未加载
评论 #31935131 未加载
评论 #31929480 未加载
评论 #31929724 未加载
评论 #31930364 未加载
评论 #31929561 未加载
评论 #31929912 未加载
News-Dog将近 3 年前
New(ish) command line tools : <a href="https:&#x2F;&#x2F;jvns.ca&#x2F;blog&#x2F;2022&#x2F;04&#x2F;12&#x2F;a-list-of-new-ish--command-line-tools&#x2F;" rel="nofollow">https:&#x2F;&#x2F;jvns.ca&#x2F;blog&#x2F;2022&#x2F;04&#x2F;12&#x2F;a-list-of-new-ish--command-l...</a><p>See; <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31009313760" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31009313760</a> (78 days ago -- 245 comments)
efortis将近 3 年前
<a href="https:&#x2F;&#x2F;github.com&#x2F;ericfortis&#x2F;quick-reference" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ericfortis&#x2F;quick-reference</a>
aftbit将近 3 年前
Here are two that I have bookmarked:<p><a href="https:&#x2F;&#x2F;wiki.samat.org&#x2F;CheatSheet&#x2F;OpenSSL" rel="nofollow">https:&#x2F;&#x2F;wiki.samat.org&#x2F;CheatSheet&#x2F;OpenSSL</a><p><a href="https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20150705174450&#x2F;http:&#x2F;&#x2F;www.w3schools.com:80&#x2F;XPath&#x2F;xpath_axes.asp" rel="nofollow">https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20150705174450&#x2F;http:&#x2F;&#x2F;www.w3scho...</a>
theden将近 3 年前
Usually I&#x27;ll just search online and read man pages (and experiment different options and solutions) but here&#x27;s a short list of my most used aliases and functions, I guess that&#x27;s the closest thing I have to a cheatsheet<p><pre><code> alias private=&#x27;shopt -uo history&#x27; alias unprivate=&#x27;shopt -so history&#x27; alias gl=&quot;git log --all --decorate --oneline --graph --pretty=format:&#x27;%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)&lt;%an&gt;%Creset&#x27;&quot; alias gitlog=&#x27;git log --graph --pretty=format:&quot;%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)&lt;%an&gt;%Creset&quot; --abbrev-commit --date=relative --branches&#x27; alias sha256sum=&quot;shasum -a 256&quot; alias sha512sum=&quot;shasum -a 512&quot; alias flushDNSMac=&quot;sudo killall -HUP mDNSResponder&quot; alias myip=&quot;dig +short myip.opendns.com @resolver1.opendns.com&quot; alias m1=&quot;arch -arm64&quot; alias x86=&quot;arch -x86_64&quot; alias ibrew=&#x27;arch -x86_64 &#x2F;usr&#x2F;local&#x2F;bin&#x2F;brew&#x27; alias upgrade=&quot;ibrew upgrade &amp;&amp; m1 brew upgrade &amp;&amp; mas upgrade&quot; alias docker-clean=&#x27;docker ps -aq | xargs -P $(nproc) -n1 docker rm -f ; docker rmi -f $(docker images --filter &quot;dangling=true&quot; -q --no-trunc)&#x27; alias autoscalerstatus=&quot;kubectl describe -n kube-system configmap cluster-autoscaler-status&quot; alias evictedpods=&quot;kubectl get pods --all-namespaces --field-selector=status.phase=Failed&quot; 2qr() { qrencode &quot;$1&quot; -t ANSI256 -o - } curl_status() { if [ -n &quot;${1}&quot; ]; then curl -L -o &#x2F;dev&#x2F;null --silent --head --write-out &#x27;%{http_code}\n&#x27; &quot;$1&quot; fi } webp_convert() { local file=&quot;$1&quot; cwebp -q 100 &quot;$file&quot; -o &quot;${file%.\*}.webp&quot; } </code></pre> To minify everything (using <a href="https:&#x2F;&#x2F;github.com&#x2F;tdewolff&#x2F;minify" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tdewolff&#x2F;minify</a>)<p><pre><code> find .&#x2F;dist&#x2F; -type f \( \ -name &quot;*.html&quot; \ -o -name &#x27;*.js&#x27; \ -o -name &#x27;*.css&#x27; \ -o -name &#x27;*.svg&#x27; \ -o -name &quot;*.xml&quot; \ -o -name &quot;*.json&quot; \ -o -name &quot;*.htm&quot; \ \) \ -and ! -name &quot;*.min\*&quot; -print0 | xargs -0 -n1 -P4 -I &#x27;{}&#x27; sh -c &#x27;minify -o &quot;{}&quot; &quot;{}&quot;&#x27;</code></pre>
Dzugaru将近 3 年前
Me and my friends have a funny habit calling these Spellbooks and pretending to be magicians. This leads to all sorts of hilarious interactions.
michaelsalim将近 3 年前
<a href="https:&#x2F;&#x2F;michaelsalim.co.uk&#x2F;dev-notes&#x2F;" rel="nofollow">https:&#x2F;&#x2F;michaelsalim.co.uk&#x2F;dev-notes&#x2F;</a>
fastily将近 3 年前
<a href="https:&#x2F;&#x2F;github.com&#x2F;fastily&#x2F;cheatsheet" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;fastily&#x2F;cheatsheet</a>
arunsrin将近 3 年前
<a href="https:&#x2F;&#x2F;notes.arunsr.in&#x2F;" rel="nofollow">https:&#x2F;&#x2F;notes.arunsr.in&#x2F;</a><p>cheat sheets, notes, learnings all go here.
swframe2将近 3 年前
Sounds like we need a &quot;github copilot&quot; for the shell. bash on linux can already tell you which command you need to install if necessary. I really don&#x27;t want to keep cheatsheets any more. I just want to write a shell comment and get the suggestions of the commands. It shouldn&#x27;t be too hard I think. I guess the problem is how to pay for it.
pppppppppps将近 3 年前
Here is tool that I use very often: <a href="https:&#x2F;&#x2F;github.com&#x2F;cheat&#x2F;cheat" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cheat&#x2F;cheat</a><p>Super simple!<p>Here is example:<p>&gt; cheat zip<p># To create zip file:<p>zip archive.zip file1 directory&#x2F;<p># To create zip file from directory:<p>zip -r archive.zip directory&#x2F;<p># To create zip file with password:<p>zip -P password archive.zip file1<p># To join a split zip file (.zip, .z01, .z02, etc):<p>zip -FF splitZipfile.zip --out joined.zip<p># To list, test and extract zip archives, see unzip:<p>cheat unzip
frefr将近 3 年前
I have maybe 50 pages of cheat codes worth. I haven&#x27;t had the time to post them somewhere yet. Remind me... a week from now :D
评论 #31929785 未加载
pmoriarty将近 3 年前
<p><pre><code> * Some zsh tips ** Zero-pad (preserve zeroes) a variable Either *** typeset -Z2 FOO *** printf %02 $FOO ** Do arithmetic *** examples **** addition (( count = $count + 1 )) ** Loop through a directory of long filenames with spaces while read -r line do echo &quot;&#x27;$line&#x27;&quot; done &lt; &lt;(print -l *(&#x2F;)) ** Shell return codes for piped commands echo foo | grep bar | tr z a | cat echo ${PIPESTATUS[@]} 0 1 0 0 ** Pass file contents as an argument *** foo &quot;$(&lt;bar)&quot; *** The above is more idiomatic than: foo &quot;$(cat bar)&quot; ** Sort files numerically *** files=(*); command ${(n)files} ** Get the last argument passed to a zsh script *** $@[-1] or $@[$#] *** you could also use $argv if $@ seems too weird ** exec an alias *** alias exec=&#x27;exec &#x27; *** an alias ending in space causes further alias expansion for the next arg ** Start zsh without inhereting any environment variables or sourcing zsh init files *** env -i zsh -f ** Which shell are you in *** echo $0 *** Check ZSH_VERSION: if [ -n &quot;${BASH_VERSION+s}&quot; ]; then echo &#x27;this is bash&#x27; elif [ &quot;${ZSH_VERSION+s}&quot; ]; then echo &#x27;this is zsh&#x27; fi ** Find files&#x2F;dirs between certain dates *** First: zmodload zsh&#x2F;stat autoload age *** For files **** print -l *(.e#age 2015&#x2F;01&#x2F;01 2016&#x2F;01&#x2F;01#) *** For directories **** print -l *(&#x2F;e#age 2015&#x2F;01&#x2F;01 2016&#x2F;01&#x2F;01#) ** make ^R work in zsh bindkey -M viins &quot;^R&quot; history-incremental-search-backward ** Search for lots of files Will not run in to argument number limits zargs -- **&#x2F;bar -- grep foo ** Remove leading and trailing spaces in a variable First, make sure to &quot;setopt EXENDED_GLOB&quot; in your script! Then: *** Remove leading spaces ${FOO## #} *** Remove trailing spaces ${FOO%% #} ** Edit a variable using your EDITOR vared FOO ** Find files in directory depth of one print -l *&#x2F;foo ** List all files except for &#x27;foobar&#x27; print -l *~foobar ** List all plain files except for &#x27;foobar&#x27; print -l *~foobar(.) ** List all files starting with &#x27;foo&#x27; except for &#x27;foobar&#x27; print -l foo*~foobar ** List all files starting with &quot;tex&quot; but not starting with &quot;text&quot; print -l tex*~*text* ** List all files which are not symbolic links print -l *(^@) ** Load zsh modules *** zmodload zsh&#x2F;attr</code></pre>
aaronax将近 3 年前
I actually do most of my tasks in various GUIs. This has a large advantage in discoverability (and for my brain: memorability). So I find no need for cheat sheets in general.<p>If on command line, I am typically following an installation guide or something so no need for a cheat sheet.<p>If scripting, I refer to past scripts or use a search engine.
xupybd将近 3 年前
<a href="https:&#x2F;&#x2F;tldr.sh&#x2F;" rel="nofollow">https:&#x2F;&#x2F;tldr.sh&#x2F;</a>
评论 #31929759 未加载
评论 #31929214 未加载
sorokine将近 3 年前
I keep a long cheatsheet for many-many-many years as a github gist: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;sorokine&#x2F;7b032ccb39514e2a64801f63d9ea36c2" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;sorokine&#x2F;7b032ccb39514e2a64801f63d9e...</a> (yes, it depends upon my dotfiles)
hoseja将近 3 年前
I keep a printed copy of C++ operator precedence around the desk.<p><a href="https:&#x2F;&#x2F;en.cppreference.com&#x2F;mwiki&#x2F;index.php?title=cpp&#x2F;language&#x2F;operator_precedence&amp;printable=yes" rel="nofollow">https:&#x2F;&#x2F;en.cppreference.com&#x2F;mwiki&#x2F;index.php?title=cpp&#x2F;langua...</a>
pplonski86将近 3 年前
Jupyter Notebook shortcuts <a href="https:&#x2F;&#x2F;github.com&#x2F;mljar&#x2F;data-science-cheat-sheets&#x2F;tree&#x2F;main&#x2F;jupyter-notebook-shortcuts-pdf" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mljar&#x2F;data-science-cheat-sheets&#x2F;tree&#x2F;main...</a>
subpixel将近 3 年前
My team has a shared knowledge base CLI set up via kb: <a href="https:&#x2F;&#x2F;github.com&#x2F;gnebbia&#x2F;kb" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;gnebbia&#x2F;kb</a><p>It’s like a group-maintained collection of cheatsheets. The git sync is buggy but I’ve made it work.
Dachande663将近 3 年前
I feel almost embarassed for sharing some of these, but I either remember things the first time I&#x27;m exposed to them or am forever doomed to have to look them up.<p><pre><code> ln -s &#x2F;the&#x2F;target the_link (can never remember order) for f in *.mp4; do mv &quot;$f&quot; &quot;$(echo &quot;$f&quot; | sed s&#x2F;S1E&#x2F;S01E&#x2F;)&quot;; done tar -theuniverse (insert xkcd here) grep -E &#x27;foo|bar&#x27; file (can never remember the flag for regex)</code></pre>
评论 #31930111 未加载
评论 #31930157 未加载
pivik将近 3 年前
<a href="https:&#x2F;&#x2F;github.com&#x2F;cheat&#x2F;cheat" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cheat&#x2F;cheat</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;denisidoro&#x2F;navi" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;denisidoro&#x2F;navi</a>
tr1ll10nb1ll将近 3 年前
My cheatsheet happens to be just my muscle memory. And, for applications I don&#x27;t use often, mostly just intuitive guesses.<p>Sounds pretty messy but I&#x27;ve never felt the need to maintain a cheatsheet.<p>I don&#x27;t see why one would. I know I&#x27;m possibly being naive.
remram将近 3 年前
I just use my bach history. I set it to never expire and I back it up, so it has years of commands I can search, either with Ctrl-R or history|grep. Sometimes I put comments in them to help with searching later.<p>[edit: turns out a lot of people do that!]
psyc将近 3 年前
I tried to maintain one many years ago, but I could never get in the habit of being consistent about it. So it was short-lived and didn&#x27;t get much use. I do refer directly to past code all the time, and that serves me fine.
sdwolfz将近 3 年前
The whole purpose of this section in my website is to have sharable cheat-sheets that I own: <a href="https:&#x2F;&#x2F;www.codrut.pro&#x2F;snippets&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.codrut.pro&#x2F;snippets&#x2F;</a>
tailspin2019将近 3 年前
Weirdly, I’ve never thought of keeping a single cheatsheet for command line snippets.<p>I’ll usually put relevant commands into my project README files but your post has inspired me to start a global cheatsheet of common commands too!
sqwrell将近 3 年前
This is a great tool. <a href="https:&#x2F;&#x2F;www.softwareok.com&#x2F;?seite=Microsoft&#x2F;QuickTextPaste" rel="nofollow">https:&#x2F;&#x2F;www.softwareok.com&#x2F;?seite=Microsoft&#x2F;QuickTextPaste</a>
sharjeelsayed将近 3 年前
Here is mine Curated Self Study Guide for Computer Science, DevOps, SRE &amp; SysAdmin (<a href="https:&#x2F;&#x2F;Learn.SharjeelSayed.COM" rel="nofollow">https:&#x2F;&#x2F;Learn.SharjeelSayed.COM</a>)
INTPenis将近 3 年前
I never did have a cheatsheet. Strange since I&#x27;ve been on the *nix journey since 1998.<p>I do like the cheat command but it&#x27;s still not habitual to use it, I grew up with Google so I&#x27;m far too dependent on it.
dpz将近 3 年前
Don&#x27;t really use a cheat sheet. history and fzf is mostly what i use
ashwinne将近 3 年前
Kept them as blog posts: <a href="https:&#x2F;&#x2F;codeyarns.com&#x2F;tech&#x2F;index.html#cheatsheet" rel="nofollow">https:&#x2F;&#x2F;codeyarns.com&#x2F;tech&#x2F;index.html#cheatsheet</a>
jwilk将近 3 年前
POSIX sh parameter expansion cheat sheet:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;jwilk&#x2F;sh-param-expansion" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jwilk&#x2F;sh-param-expansion</a>
habibur将近 3 年前
All kept in batch files in a directory with a meaningful name. When I need something what I do a ls <i>&lt;keyword&gt;</i> on the directory and can recon the command I need.
donbrae将近 3 年前
I use my GitHub gists as a cheatsheet: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;donbrae" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;donbrae</a>.
blooalien将近 3 年前
You might like <a href="https:&#x2F;&#x2F;github.com&#x2F;cheat&#x2F;cheat&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cheat&#x2F;cheat&#x2F;</a>
评论 #31930020 未加载
hackersonggg将近 3 年前
A friend of mine made this awesome collection: <a href="https:&#x2F;&#x2F;devhints.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;devhints.io&#x2F;</a>
memorable将近 3 年前
I don&#x27;t really use a cheatsheet, but I stored all of my snippets in my shell configuration file. In this case, I use fish shell.
warrenm将近 3 年前
my only cheatsheets are customer-specific ... so they&#x27;re basically unshareable (the general ideas of what&#x27;s being done apply all over, but there&#x27;s a <i>lot</i> of environment-specific stuff that I don&#x27;t want to have to remember all the time :)
valbaca将近 3 年前
less &quot;cheatsheet&quot; and more just general notes for languages and vim and such:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;valbaca&#x2F;notes" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;valbaca&#x2F;notes</a>
nindalf将近 3 年前
I used to keep a list of snippets, but I found a tool that did it better - `tldr` (<a href="https:&#x2F;&#x2F;tldr.sh" rel="nofollow">https:&#x2F;&#x2F;tldr.sh</a>). I can use this tool from the command line instead of going searching my notes for a snippet.<p>`tldr tar` or whatever.
acutesoftware将近 3 年前
### Disk and Hardware<p>Hardware Summary<p><pre><code> sudo lshw -short </code></pre> Get the total disk space left and summary of folder usage<p><pre><code> df -h .; du -sh -- * | sort -hr </code></pre> Simple partition summary<p><pre><code> lsblk </code></pre> What version of Linux are you running<p><pre><code> uname -a &gt; Linux TREEBEARD 4.4.0-98-generic #121-Ubuntu SMP Tue Oct 10 14:24:03 UTC 2017 x86_64 x86_64 x86_64 GNU&#x2F;Linux lsb_release -a &gt; Distributor ID: Ubuntu &gt; Description: Ubuntu 16.04.4 LTS &gt; Release: 16.04 &gt; Codename: xenial What flavour of Ubuntu are you running (see https:&#x2F;&#x2F;itsfoss.com&#x2F;which-ubuntu-install&#x2F; ) cat &#x2F;var&#x2F;log&#x2F;installer&#x2F;media-info &gt; Unity </code></pre> How long has the PC been running<p><pre><code> uptime &gt; 23:09:26 up 61 days, 8:28, 1 user, load average: 0.82, 0.48, 0.34 </code></pre> Count files in folder and sub folders<p><pre><code> find . -type f | wc -l </code></pre> ### Files and Folders<p>Get a tree view of subfolders<p><pre><code> ls -R | grep &quot;:$&quot; | sed -e &#x27;s&#x2F;:$&#x2F;&#x2F;&#x27; -e &#x27;s&#x2F;[^-][^\&#x2F;]*\&#x2F;&#x2F;--&#x2F;g&#x27; -e &#x27;s&#x2F;^&#x2F; &#x2F;&#x27; -e &#x27;s&#x2F;-&#x2F;|&#x2F;&#x27; </code></pre> Find the most recently used files including all subdirectories<p><pre><code> find . -type f -mtime -7 -print0 | xargs -0 ls -lt | head </code></pre> Find string in all files (example searchs logs for Exception)<p><pre><code> find &#x2F;var&#x2F;log&#x2F;www.lifepim.com -type f -print0 2&gt;&#x2F;dev&#x2F;null | xargs -0 grep --color=AUTO -Hn &#x27;Except&#x27; 2&gt;&#x2F;dev&#x2F;null </code></pre> Find a string &#x27;blah&#x27; in all files with recursive (deep) search from current folder &#x27;.&#x27;<p><pre><code> grep -Rnw &#x27;.&#x27; -e &#x27;blah&#x27; </code></pre> Limit above search to only .html files<p><pre><code> grep -Rn --include=*.html &#x27;.&#x27; -e &#x27;blah&#x27; </code></pre> ### Processes<p>List all processes<p><pre><code> ps -ef </code></pre> Show a tree of processes<p><pre><code> pstree </code></pre> Find the processes I am running<p><pre><code> ps -u duncan </code></pre> Get list and PID of specific processes (eg python)<p><pre><code> pgrep -a python </code></pre> Show all processes and usage<p><pre><code> top htop (will need to run sudo apt install htop first) </code></pre> ### Network<p>Get IP Address and network details<p><pre><code> &#x2F;sbin&#x2F;ifconfig </code></pre> See list of PC&#x27;s on the network<p><pre><code> arp -n ip -r neigh nmap -sA 192.168.1.0&#x2F;24 </code></pre> Lookup name of IP Address<p><pre><code> nslookup 162.213.1.246 &gt; Non-authoritative answer: &gt; 246.1.213.162.in-addr.arpa name = wssa.beyondsecurity.com. </code></pre> Get the IP address of a domain name<p><pre><code> host www.acutesoftware.com.au &gt; acutesoftware.com.au has address 129.121.30.188 Show the routing table route </code></pre> Port scanning<p><pre><code> nmap ### Shell tips Show top commands from your shell history history | awk &#x27;{a[$2]++}END{for(i in a){print a[i] &quot; &quot; i}}&#x27; | sort -rn | head 35 cat 25 awk 18 pwd 15 ls 14 cd </code></pre> ### Data Collection<p>Download a file<p><pre><code> wget http:&#x2F;&#x2F;www.acutesoftware.com.au&#x2F;aikif&#x2F;AIKIF-Overview.jpg </code></pre> Download a site for offline reading<p><pre><code> wget --recursive --page-requisites http:&#x2F;&#x2F;www.acutesoftware.com.au&#x2F;cont_articles.html </code></pre> ### Data extraction<p>Get a list of URLs from a html file (like an exported list of Chrome bookmarks)<p><pre><code> grep -Eoi &#x27;&lt;a [^&gt;]+&gt;&#x27; source.html | grep -Eo &#x27;HREF=&quot;[^\&quot;]+&quot;&#x27; | grep -Eo &#x27;(http|https):&#x2F;&#x2F;[^&#x2F;&quot;]+&#x27; &gt; urls.csv </code></pre> Grep log files<p><pre><code> cat &#x2F;var&#x2F;log&#x2F;www.lifepim.com.access.log | grep &quot;POST&quot; # number of posts to lifepim cat &#x2F;var&#x2F;log&#x2F;www.lifepim.com.access.log | grep &quot;login&quot; | wc -l # number of login page accesses awk &#x27;{print $1}&#x27; &#x2F;var&#x2F;log&#x2F;www.lifepim.com.access.log | sort | uniq -c # count per IP address awk &#x27;{print $7}&#x27; &#x2F;var&#x2F;log&#x2F;www.lifepim.com.access.log | uniq # list of pages accessed cat &#x2F;var&#x2F;log&#x2F;www.lifepim.com.error.log | grep &quot;Exception&quot; | uniq # list of exceptions awk &#x27;{print $11}&#x27; &#x2F;var&#x2F;log&#x2F;www.lifepim.com.access.log | sort | uniq -c | grep -v &quot;lifepim&quot; # count by referrers 1 &quot;https:&#x2F;&#x2F;newsbout.com&#x2F;id&#x2F;19184625381&quot; 1 &quot;https:&#x2F;&#x2F;umumble.com&#x2F;links&#x2F;156005&#x2F;what-software-will-you-trust-when-you-get-senile%3F&quot; 1 &quot;https:&#x2F;&#x2F;www.producthunt.com&#x2F;ask&#x2F;616-what-s-the-best-personal-knowledge-base&quot; </code></pre> Looping through list of gz files and grepping for blog hit count<p><pre><code> for i in &#x2F;var&#x2F;log&#x2F;www.lifepim.com.access*.gz do echo -n &quot;Checking zipped logfile $i - &quot; zgrep &#x27;&#x2F;blog&#x2F;&#x27; &quot;$i&quot; | wc -l done Checking zipped logfile &#x2F;var&#x2F;log&#x2F;www.lifepim.com.access.log.2.gz - 45 Checking zipped logfile &#x2F;var&#x2F;log&#x2F;www.lifepim.com.access.log.3.gz - 112 Checking zipped logfile &#x2F;var&#x2F;log&#x2F;www.lifepim.com.access.log.4.gz - 92 Checking zipped logfile &#x2F;var&#x2F;log&#x2F;www.lifepim.com.access.log.5.gz - 62 Checking zipped logfile &#x2F;var&#x2F;log&#x2F;www.lifepim.com.access.log.6.gz - 64 Checking zipped logfile &#x2F;var&#x2F;log&#x2F;www.lifepim.com.access.log.7.gz - 85 Checking zipped logfile &#x2F;var&#x2F;log&#x2F;www.lifepim.com.access.log.8.gz - 213 Checking zipped logfile &#x2F;var&#x2F;log&#x2F;www.lifepim.com.access.log.9.gz - 80 </code></pre> ### Date and Time<p>Display Annual Calendar for current year<p><pre><code> cal -y </code></pre> Show the current date in ISO format ( yyyy-mm-dd )<p><pre><code> echo $(date -I) </code></pre> Store the current date &#x2F; time as string in a bash variable<p><pre><code> DATE=`date &#x27;+%Y-%m-%d %H:%M:%S&#x27;` echo $DATE </code></pre> ### SQL tips<p>Show table size of selected tables in a schema<p><pre><code> SELECT table_name as &#x27;Database Name&#x27;, sum( data_length + index_length ) as &#x27;Size in Bytes&#x27;, round((sum(data_length + index_length) &#x2F; 1024 &#x2F; 1024), 4) as &#x27;Size in MB&#x27; FROM information_schema.TABLES where table_name like &#x27;as_%&#x27; or table_name like &#x27;sys_%&#x27; GROUP BY table_name; </code></pre> Get a list of column names for a table<p><pre><code> select * from information_schema.columns where table_name = &#x27;as_task&#x27;; </code></pre> Show usage in log file grouped by date<p><pre><code> select DATE_FORMAT(log_date, &#x27;%Y-%m&#x27;), count(*) from sys_log group by DATE_FORMAT(log_date, &#x27;%Y-%m&#x27;) order by 1; </code></pre> Show usage by user_id and date<p><pre><code> select log_date, user_id, count(*) from sys_log group by log_date, user_id order by log_date; </code></pre> Show users by week<p><pre><code> select WEEK(log_date), max(log_date) as date_until, count(*) as num_user_actions, count(distinct user_id) as active_users_this_week from sys_log where DATE_FORMAT(log_date, &#x27;%Y-%m&#x27;) &gt; &#x27;2018-05-05&#x27; group by WEEK(log_date) order by 2;</code></pre>
jiggawatts将近 3 年前
pwsh
nathias将近 3 年前
tldr