Differences
This shows you the differences between the selected revisions of the page.
2020-02-06 | 2020-02-07 | ||
syntax highlighting for local custom commands (martin) | syntax highlighting for remote custom commands (martin) | ||
Line 11: | Line 11: | ||
==== Tar/Gzip ==== | ==== Tar/Gzip ==== | ||
- | ··tar -xvzf --directory="!?&Extract to which directory:?.!" "!" | + | <code custom-command-remote> |
+ | tar -xvzf --directory="!?&Extract to which directory:?.!" "!" | ||
+ | </code> | ||
- | ··tar -czvf "!?&Enter an Archive Name:?archive.tgz!" | + | <code custom-command-remote> |
- | ···--exclude="!?&Exclude files matching pattern:?*.exe!" | + | tar -czvf "!?&Enter an Archive Name:?archive.tgz!" |
- | ···!& | + | ·--exclude="!?&Exclude files matching pattern:?*.exe!" |
+ | ·!& | ||
+ | </code> | ||
==== [[gzip]] Gzip ==== | ==== [[gzip]] Gzip ==== | ||
- | ··gzip -f "!" | + | <code custom-command-remote> |
+ | gzip -f "!" | ||
+ | </code> | ||
- | ··gunzip -f "!" | + | <code custom-command-remote> |
+ | gunzip -f "!" | ||
+ | </code> | ||
==== [[zip]] Zip ==== | ==== [[zip]] Zip ==== | ||
Line 27: | Line 35: | ||
To unpack to the current directory: | To unpack to the current directory: | ||
- | ··unzip "!" | + | <code custom-command-remote> |
+ | unzip "!" | ||
+ | </code> | ||
To unpack to an alternate directory: | To unpack to an alternate directory: | ||
- | ··unzip -d "!?&Extract to directory:?.!" "!" | + | <code custom-command-remote> |
+ | unzip -d "!?&Extract to directory:?.!" "!" | ||
+ | </code> | ||
To create an archive: | To create an archive: | ||
- | ··zip -r "!?&Enter an Archive Name:?archive.zip!" !& | + | <code custom-command-remote> |
+ | zip -r "!?&Enter an Archive Name:?archive.zip!" !& | ||
+ | </code> | ||
==== Rar ==== | ==== Rar ==== | ||
- | ··rar a -ep "!?&Enter an Archive Name:?archive.rar!" !& | + | <code custom-command-remote> |
+ | rar a -ep "!?&Enter an Archive Name:?archive.rar!" !& | ||
+ | </code> | ||
===== [[delete]] Quick Deleting ===== | ===== [[delete]] Quick Deleting ===== | ||
Line 45: | Line 61: | ||
Use following command to quickly delete large directory structures: | Use following command to quickly delete large directory structures: | ||
- | <code>rm -f -r "!"</code> | + | <code custom-command-remote> |
+ | rm -f -r "!" | ||
+ | </code> | ||
The same command can ask for confirmation before deleting: | The same command can ask for confirmation before deleting: | ||
- | <code>test "!?Do you really want to delete ?no!" == "yes" && rm -rf !&</code> | + | <code custom-command-remote> |
+ | test "!?Do you really want to delete ?no!" == "yes" && rm -rf !& | ||
+ | </code> | ||
===== [[delete_background]] Deleting on Background ===== | ===== [[delete_background]] Deleting on Background ===== | ||
Line 65: | Line 85: | ||
Use following command if current [[protocols|protocol]] does not allow changing ownership: | Use following command if current [[protocols|protocol]] does not allow changing ownership: | ||
- | <code>chown "!?New owner:?!" !&</code> | + | <code custom-command-remote> |
+ | chown "!?New owner:?!" !& | ||
+ | </code> | ||
To change group use ''chgrp'' instead of ''chown''. Or use following command: | To change group use ''chgrp'' instead of ''chown''. Or use following command: | ||
- | <code>chown "!?New owner (and group: user:group):!" !&</code> | + | <code custom-command-remote> |
+ | chown "!?New owner (and group: user:group):!" !& | ||
+ | </code> | ||
or with two separate prompts: | or with two separate prompts: | ||
- | <code>chown -R "!?New owner:?!":"!?New group:?!" !&</code> | + | <code custom-command-remote> |
+ | chown -R "!?New owner:?!":"!?New group:?!" !& | ||
+ | </code> | ||
===== [[url]] URL Address of Selected File ===== | ===== [[url]] URL Address of Selected File ===== | ||
Line 95: | Line 120: | ||
Example shows how to launch simple PHP script that maps file path to URL. | Example shows how to launch simple PHP script that maps file path to URL. | ||
- | <code>echo '<?="https://www.example.com".str_replace("home/user/public_html", "~user", "'`pwd`'")."/!\n"?>' | php -q</code> | + | <code custom-command-remote> |
+ | echo '<?="https://www.example.com".str_replace("home/user/public_html", "~user", "'`pwd`'")."/!\n"?>' | php -q | ||
+ | </code> | ||
Hints: | Hints: | ||
Line 108: | Line 135: | ||
Another example using shell commands only, in case PHP is not available: | Another example using shell commands only, in case PHP is not available: | ||
- | <code>echo 'https://www.example.com'`pwd`'/!' | sed s#home/user/public_html#~user#</code> | + | <code custom-command-remote> |
+ | echo 'https://www.example.com'`pwd`'/!' | sed s#home/user/public_html#~user# | ||
+ | </code> | ||
===== Templates ===== | ===== Templates ===== | ||
- | ··cp /path/to/template.html "!?&New HTML file:?!" | + | <code custom-command-remote> |
+ | cp /path/to/template.html "!?&New HTML file:?!" | ||
+ | </code> | ||
===== [[tail]] Viewing End of a File (log) ===== | ===== [[tail]] Viewing End of a File (log) ===== | ||
Line 119: | Line 149: | ||
==== In Console Window ==== | ==== In Console Window ==== | ||
- | ··tail "!" | + | <code custom-command-remote> |
+ | tail "!" | ||
+ | </code> | ||
You may specify further how much to transfer, e.g. | You may specify further how much to transfer, e.g. | ||
- | ··tail --lines 2000 "!" | + | <code custom-command-remote> |
+ | tail --lines 2000 "!" | ||
+ | </code> | ||
Check custom command option //Show results in terminal//. | Check custom command option //Show results in terminal//. | ||
Line 137: | Line 171: | ||
===== [[search_file]] Searching for a File ===== | ===== [[search_file]] Searching for a File ===== | ||
- | ··find . -name "!?Search for files:?!" | + | <code custom-command-remote> |
+ | find . -name "!?Search for files:?!" | ||
+ | </code> | ||
Check custom command option //Show results in terminal//. | Check custom command option //Show results in terminal//. | ||
- | |||
- | |||
===== [[search_text]] Searching for a text/string within a directory ===== | ===== [[search_text]] Searching for a text/string within a directory ===== | ||
- | ··grep -H -r "!?Search for text:?!" * | cut -d: -f1 | + | <code custom-command-remote> |
+ | grep -H -r "!?Search for text:?!" * | cut -d: -f1 | ||
+ | </code> | ||
Check custom command option //Show results in terminal//. | Check custom command option //Show results in terminal//. | ||
Line 152: | Line 188: | ||
==== Backup a File with Current Date and Time ==== | ==== Backup a File with Current Date and Time ==== | ||
- | ··cp ! $(echo "!" | sed "s/\..*$//").$(date '+%Y-%m-%d_%H-%M').$(echo ! | awk -F"." '{ print $NF }') | + | <code custom-command-remote> |
+ | cp ! $(echo "!" | sed "s/\..*$//").$(date '+%Y-%m-%d_%H-%M').$(echo ! | awk -F"." '{ print $NF }') | ||
+ | </code> | ||
==== Rename a File with Current Date and Time ==== | ==== Rename a File with Current Date and Time ==== | ||
- | ··mv ! $(echo "!" | sed "s/\..*$//").$(date '+%Y-%m-%d_%H-%M').$(echo ! | awk -F"." '{ print $NF }') | + | <code custom-command-remote> |
+ | mv ! $(echo "!" | sed "s/\..*$//").$(date '+%Y-%m-%d_%H-%M').$(echo ! | awk -F"." '{ print $NF }') | ||
+ | </code> | ||
===== [[fxp]] Remote Transfer (FXP) ===== | ===== [[fxp]] Remote Transfer (FXP) ===== | ||
Line 161: | Line 201: | ||
Use following remote custom command to transfer selected remote files to an another server: | Use following remote custom command to transfer selected remote files to an another server: | ||
- | ··scp -p -r !& !?Username:?!@!?Host:?!:!?Destination path:?! | + | <code custom-command-remote> |
+ | scp -p -r !& !?Username:?!@!?Host:?!:!?Destination path:?! | ||
+ | </code> | ||
You may want to hard-code the //Username// and //Host//, if you work with one destination server only. Or you can use a single prompt for both (possibly even for //Destination Path//) to keep the flexibility, yet to reduce number of prompts: | You may want to hard-code the //Username// and //Host//, if you work with one destination server only. Or you can use a single prompt for both (possibly even for //Destination Path//) to keep the flexibility, yet to reduce number of prompts: | ||
- | ··scp -p -r !& !?Username@Host:?!:!?Destination path:?! | + | <code custom-command-remote> |
+ | scp -p -r !& !?Username@Host:?!:!?Destination path:?! | ||
+ | </code> | ||
Note that you need to ensure you can connect and authenticate to the destination server without any prompts: | Note that you need to ensure you can connect and authenticate to the destination server without any prompts: | ||
Line 198: | Line 242: | ||
* Redirect error output to ''/dev/null'', to discard it: \\ <code> | * Redirect error output to ''/dev/null'', to discard it: \\ <code> | ||
command_that_prints_non_interesting_progress_on_error_output > /dev/null</code> | command_that_prints_non_interesting_progress_on_error_output > /dev/null</code> | ||
- | * Redirect error output to standard output, to see it in terminal, but avoid error message: \\ <code> | + | * Redirect error output to standard output, to see it in terminal, but avoid error message: \\ <code custom-command-remote> |
command_that_prints_interesting_info_on_error_output 2>&1</code> | command_that_prints_interesting_info_on_error_output 2>&1</code> | ||
- | * Use ''|| true'' to discard exit code: \\ <code> | + | * Use ''|| true'' to discard exit code: \\ <code custom-command-remote> |
command_that_returns_255_code || true</code> | command_that_returns_255_code || true</code> | ||
- | * Or combine these together: <code> | + | * Or combine these together: <code custom-command-remote> |
command_that_prints_interesting_info_on_error_output_and_returns_255_code 2>&1 || true</code> | command_that_prints_interesting_info_on_error_output_and_returns_255_code 2>&1 || true</code> |