less {filename}
Navigation | |
---|---|
SPACE |
forward one window |
b |
backward one window |
d |
forward half window |
Quitting | |
:x Exit, saving changes | |
:q Exit as long as there have been no changes | |
:wq Write and Quit. Saves any changes made to the file | |
ZZ Exit and save changes if any have been made | |
:q! Exit and ignore any changes | |
Inserting Text |
#!/bin/sh | |
# Make the script to abort if any command fails. Use set +e to change the behaviour and ignore failed command. | |
set -e | |
# Prints the commands as it is executed. Useful for debugging. Use set +x to disable debugging. | |
set -x | |
# Set default values | |
ORGANISATION_NAME="${ORGANISATION_NAME:-com.example}" |
#!/bin/bash | |
# Make the script to abort if any command fails. Use set +e to change the behaviour and ignore failed command. | |
set -e | |
# Uncomment below line to print the commands as it is executed. Useful for debugging. Use set +x to disable debugging. | |
# set -x | |
# Source the functions from an url | |
source <(curl -s "https://gist.githubusercontent.com/harishkannarao/58d317f2743c842b5323165a492db81c/raw/75ee691d4d4568c59443a070c6e5d192d717b6bc/reusable_functions.sh") |
#!/bin/bash | |
function add() | |
{ | |
echo "$1 + $2" | bc -l | |
} | |
function subtract() | |
{ | |
echo "$1 - $2" | bc -l |
The following blog post shows example of bash script with for loop, while loop, if elif else conditional statements.
#!/bin/bash | |
# Make the script to abort if any command fails. Use set +e to change the behaviour and ignore failed command. | |
set -e | |
# Uncomment below line to print the commands as it is executed. Useful for debugging. Use set +x to disable debugging. | |
# set -x | |
echo "Example of numerical comparison with if elif else" | |
for (( c=-5; c<=5; c=$c+1 )) |
#!/bin/bash | |
# Make the script to abort if any command fails. Use set +e to change the behaviour and ignore failed command. | |
set -e | |
# Uncomment below line to print the commands as it is executed. Useful for debugging. Use set +x to disable debugging. | |
# set -x | |
while [[ $# -gt 0 ]] | |
do |
youtube-dl is an opensource command line tool to download video or audio from online video streaming services.
Videos downloaded in mkv
or webm
extensions can be played by VLC Media player in all major devices and operating systems including iPhone, Android devices.
Tool website: https://youtube-dl.org/
This gist shows the example commands to use the tool and doesn't support or encourage piracy or violation of copyrights of the online streaming service or the author of the content
Copy new files from source to target and skip files if it already exist in target
rsync --dry-run -avzurh --stats --delete --progress /tmp/source/ /tmp/target/
-a
-> Archive mode, preserve the file system properties-v
-> Verbose output-vv
-> Higher Verbose output-vvv
-> Even Higher Verbose output