mirror of
https://github.com/yuriskinfo/cheat-sheets.git
synced 2025-12-21 21:33:25 +01:00
Merge pull request #3 from yuriskinfo/next
Added to the existing cheat sheets,
This commit is contained in:
@@ -61,6 +61,6 @@ Make sure to __watch__ this repository to get notified on updates (usually updat
|
||||
|
||||
[FAR file manager cheat sheet of keyboard shortcuts](cheat-sheets/FAR-manager-cheat-sheet-of-keyboard-shortcuts.adoc) | [PDF](cheat-sheets/FAR-manager-cheat-sheet-of-keyboard-shortcuts.pdf)
|
||||
|
||||
|
||||
[Windows cmd.exe shell batch scripting cheat sheet](cheat-sheets/Windows-cmd-shell-batch-scripting-cheat-sheet.adoc)
|
||||
|
||||
|
||||
|
||||
25
cheat-sheets/7zip-command-line-cookbook-of-examples.adoc
Normal file
25
cheat-sheets/7zip-command-line-cookbook-of-examples.adoc
Normal file
@@ -0,0 +1,25 @@
|
||||
= 7z Linux Command Line Cookbook of Examples
|
||||
:homepage: https://github.com/yuriskinfo/cheat-sheets
|
||||
:toc:
|
||||
|
||||
Author: https://www.linkedin.com/in/yurislobodyanyuk/
|
||||
|
||||
== Important facts about 7-zip
|
||||
* 7-zip does NOT store the owner/group of the files/folders being archived, which is good for privacy, but may not suite your specifc use case, especially as a back up tool.
|
||||
* 7-zip is a name of the compression tool created by Igor Pavlov.
|
||||
* While Igor Pavlov provides Linux/macOS versions as well, another implementation by independent developer (Mohammed Adnene Trojette) has become wide used in the Linux realm - `p7zip`. This cookbook relates to this, independent version, so options and switches may differ a bit from 7-zip Windows canonical version.
|
||||
|
||||
== Install p7zip package on Linux
|
||||
This tool is already in all the major repositories, so you should have no problems installing it.
|
||||
|
||||
`Ubuntu`: `sudo apt install p7zip-full`
|
||||
|
||||
`CentOS/Fedora`: `sudo yum install p7zip p7zip-plugins`
|
||||
|
||||
== Create an archive adding all the files in the current folder
|
||||
We first indicate to `7-zip` that we want to _add_ to an archive with `a` command, then we specify the archive name, and finally, we use `*` as wildcard to include all files in the current folder.
|
||||
|
||||
`7z a folder.7z *`
|
||||
|
||||
The result - _folder.7z_ will be placed in the same folder where it run.
|
||||
|
||||
24
cheat-sheets/ImageMagick-command-line-examples.adoc
Normal file
24
cheat-sheets/ImageMagick-command-line-examples.adoc
Normal file
@@ -0,0 +1,24 @@
|
||||
= ImageMagick Command Line Examples
|
||||
:toc:
|
||||
|
||||
== Rotate images 90 degrees
|
||||
|
||||
Use `convert` tools in a bash script to rotate all .jpg images in the current folder, naming the rotated images as _current-name_-rotated.jpg
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
for ii in *.jpg
|
||||
do
|
||||
convert ${ii} -rotate 90 ${ii}-rotated.jpg
|
||||
done
|
||||
----
|
||||
|
||||
|
||||
== Combine images in the current folder into a PDF file
|
||||
Let's combine images with extension .jpg (using shell wildcards) into one
|
||||
PDF file.
|
||||
|
||||
----
|
||||
magick *.jpg pics-2022-1.pdf
|
||||
----
|
||||
|
||||
@@ -20,12 +20,25 @@ The commands below are meant to be run on the device CLI itself, not on provisio
|
||||
| Show port status: administrative and operational states, speed/duplex, connector type, MAC address, and most important (for fiber) - RX/TX signal power (dBm)
|
||||
|
||||
|*show config port _name_ statistics*
|
||||
| Statistics of the port: total bits/frames passed,maximum/minimum bits/sec seen, and most interesting - CRC errors, error frames, oversize frames, discards.
|
||||
| Statistics of the port: total bits/frames passed, maximum/minimum bits/sec seen, and most
|
||||
interesting - CRC errors, error frames, oversize frames, discards, CV/ES/SES/FC stats for
|
||||
E1 lines.
|
||||
|
||||
|*show config port _name_ statistics*
|
||||
| Statistics of the port: total bits/frames passed,maximum/minimum bits/sec seen, and most interesting - CRC errors, error frames, oversize frames, discards.
|
||||
|
||||
|*config port name*
|
||||
|*config port ethernet _number_*
|
||||
|
||||
*clear-statistics*
|
||||
|Clear all statistics/counters for this port.
|
||||
|
||||
|*config flow*
|
||||
|
||||
*flow _flow-name_*
|
||||
|
||||
*show statistics running*
|
||||
|Show detailed counters for the given flow, will include `bps`, max/min `bps` seen after reboot, `drops` if any.
|
||||
|
||||
|
||||
|*config port _name_*
|
||||
|
||||
*rate-measure interval _seconds_*
|
||||
|
||||
@@ -60,8 +73,22 @@ service-ping local-ip 13.13.13.1/30 dst-ip 13.13.13.2 next-hop 13.13.13.2 egress
|
||||
|Show alarms log, their severity/state/last raised time
|
||||
|
||||
|
||||
|*exit all*
|
||||
|Exit all sub-configuration modes to the top level.
|
||||
|
||||
|*show file startup*
|
||||
|Show startup configuration.
|
||||
|
||||
|*save*
|
||||
|Save the configuration.
|
||||
|
||||
|*clear-statistics*
|
||||
|Clear all statistics (at the highest config level) - errors on interfaces, bytes sent/received, etc.
|
||||
|
||||
|*admin*
|
||||
|
||||
*reboot*
|
||||
|Reboot the device.
|
||||
|
||||
|
||||
|===
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
= Windows cmd shell batch scripting cheat sheet
|
||||
Yuri Slobodyanyuk <admin@yurisk.info>
|
||||
v1.0, 2022-08-31
|
||||
:homepage: https://yurisk.info
|
||||
:toc:
|
||||
Author: Yuri Slobodyanyuk, https://www.linkedin.com/in/yurislobodyanyuk/
|
||||
|
||||
|
||||
== Controlling scripts themselves
|
||||
[cols=2, options="header"]
|
||||
|===
|
||||
|Command
|
||||
|Description
|
||||
|
||||
|*rem*
|
||||
|Start a comment, till the end of line. It can be used to comment out a whole line or part of it.
|
||||
|
||||
|*cls*
|
||||
|Clear the screen buffer.
|
||||
|
||||
|*echo _text to display_*
|
||||
|
||||
*echo off/on*
|
||||
|
||||
*echo.*
|
||||
|Print text on line, or, with `off/on` switch without text, turn off/on echoing the commands being run.
|
||||
Usually, you set `echo off` as the 1st line in a batch script, and the `echo on` as the last line. Turning
|
||||
echoing off does not hide _output_ of the commands run, just the commands themselves. The 3rd option is `echo` followed immediately
|
||||
by _dot_ and it causes echo to print a blank line (an dthis is the only way to do so).
|
||||
|
||||
|*@*
|
||||
|Turn off echoing only for the command preceded by this @. E.g. `@echo off` to prevent the _echo off_
|
||||
being printed itself.
|
||||
|
||||
|*title _Title bar text_*
|
||||
|Change the title of the cmd.exe window for this session. As a rule of a good style, change _title_ on each stage of the
|
||||
script, to let users know what the script is doing.
|
||||
|
||||
|
||||
|===
|
||||
|
||||
|
||||
== Script arguments
|
||||
[cols=2, options="header"]
|
||||
|===
|
||||
|Command
|
||||
|Description
|
||||
|
||||
|%_n_
|
||||
|Positional argument to the script from the command line. _n_ can be from 0 to 9.
|
||||
|
||||
|%0
|
||||
|The script name. The actual arguments to the script start with %1.
|
||||
E.g. `echo The script was called as %0, with the %1 as the first argument`
|
||||
|
||||
|%*
|
||||
|The rest of the positional arguments after the 9th altogether. The individual args are not accessible directly, use `SHIFT`-ing.
|
||||
|
||||
|*shift [/_n_]*
|
||||
|Shift positional arguments by one. If `/n` is given, will shift starting with n+1. E.g. `shift /4` will shift 5th to become 4th,
|
||||
6th will become 5th, and so on, while arguments before 4 will stay untouched.
|
||||
|
||||
|===
|
||||
Reference in New Issue
Block a user