From eb6d8189de54fba5e8e967de7badeface91b0241 Mon Sep 17 00:00:00 2001 From: EmilySeville7cfg Date: Sun, 4 Dec 2022 08:19:13 +1000 Subject: [PATCH 1/3] Quote urls --- ab | 4 ++-- aria2c | 4 ++-- curl | 14 +++++++------- wget | 26 +++++++++++++------------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/ab b/ab index 304aaa2..929ab10 100644 --- a/ab +++ b/ab @@ -1,5 +1,5 @@ # To send 100 requests with a concurency of 50 requests to a URL: -ab -n 100 -c 50 +ab -n 100 -c 50 "" # To send requests for 30 seconds with a concurency of 50 requests to a URL: -ab -t 30 -c 50 +ab -t 30 -c 50 "" diff --git a/aria2c b/aria2c index 1a06c66..96f3798 100644 --- a/aria2c +++ b/aria2c @@ -1,9 +1,9 @@ # To download a file: # The url can be a http(s), ftp, .torrent file or even a magnet link -aria2c +aria2c "" # To prevent downloading the .torrent file: -aria2c --follow-torrent=mem +aria2c --follow-torrent=mem "" # Download 1 file at a time (-j) # continuing (-c) any partially downloaded ones diff --git a/curl b/curl index 772de7f..08d2544 100644 --- a/curl +++ b/curl @@ -1,20 +1,20 @@ # To download a file: -curl +curl "" # To download and rename a file: -curl -o +curl "" -o # To download multiple files: -curl -O -O +curl -O "" -O "" # To download all sequentially numbered files (1-24): curl http://example.com/pic[1-24].jpg # To download a file and pass HTTP authentication: -curl -u : +curl -u : "" # To download a file with a proxy: -curl -x : +curl -x : "" # To download a file over FTP: curl -u : -O ftp://example.com/pub/file.zip @@ -23,10 +23,10 @@ curl -u : -O ftp://example.com/pub/file.zip curl ftp://username:password@example.com # To resume a previously failed download: -curl -C - -o +curl -C - -o "" # To fetch only the HTTP headers from a response: -curl -I +curl -I "" # To fetch your external IP and network info as JSON: curl http://ifconfig.me/all.json diff --git a/wget b/wget index 301de5d..df69fbd 100644 --- a/wget +++ b/wget @@ -1,26 +1,26 @@ -# To download : -wget +# To download "": +wget "" # # To download multiples files with multiple URLs: -wget ... +wget ""... -# To download and change its name: -wget -O +# To download "" and change its name: +wget "" -O -# To download into : -wget -P +# To download "" into : +wget -P "" # To continue an aborted downloaded: -wget -c +wget -c "" # To parse a file that contains a list of URLs to fetch each one: wget -i url_list.txt # To mirror a whole page locally: -wget -pk +wget -pk "" # To mirror a whole site locally: -wget -mk +wget -mk "" # To download files according to a pattern: wget http://example.com/files-{1..15}.tar.bz2 @@ -29,10 +29,10 @@ wget http://example.com/files-{1..15}.tar.bz2 wget -r -l1 -A.extension http://example.com/directory # To download only response headers (-S --spider) and display them on stdout (-O -).: -wget -S --spider -O - +wget -S --spider -O - "" # To change the User-Agent to 'User-Agent: toto': -wget -U 'toto' +wget -U 'toto' "" # To download a file with specific speed EX:500kb/sec: -wget --limit-rate=500k +wget --limit-rate=500k "" From e2810df5faa09753d19453a4b8b6f29aaabfd596 Mon Sep 17 00:00:00 2001 From: EmilySeville7cfg Date: Sun, 4 Dec 2022 08:23:34 +1000 Subject: [PATCH 2/3] Use `""` placeholder --- acl | 14 +++++++------- ag | 2 +- bat | 6 +++--- cat | 6 +++--- chown | 10 +++++----- csplit | 4 ++-- cups | 2 +- dnf | 2 +- ffmpeg | 2 +- fmt | 2 +- gdb | 6 +++--- git | 2 +- grep | 14 +++++++------- head | 12 ++++++------ hg | 2 +- more | 4 ++-- mv | 2 +- ncdu | 12 ++++++------ nkf | 16 ++++++++-------- pacman | 2 +- paste | 6 +++--- patch | 4 ++-- rpm | 4 ++-- ruby | 4 ++-- scp | 4 ++-- sed | 12 ++++++------ sha256sum | 4 ++-- shred | 6 +++--- sort | 10 +++++----- split | 6 +++--- ssh | 2 +- stdout | 12 ++++++------ tail | 20 ++++++++++---------- touch | 10 +++++----- truncate | 12 ++++++------ uniq | 12 ++++++------ wc | 12 ++++++------ 37 files changed, 131 insertions(+), 131 deletions(-) diff --git a/acl b/acl index edd70c9..3fc168a 100644 --- a/acl +++ b/acl @@ -1,13 +1,13 @@ # Get ACL -getfacl +getfacl "" # Add or modify ACL on file -setfacl -m u:username:rX -setfacl -m g:groupname:rw -setfacl -m o::- +setfacl -m u:username:rX "" +setfacl -m g:groupname:rw "" +setfacl -m o::- "" # or provide all permissions at once -setfacl -m u::rwx,g:groupname:rX,o::- +setfacl -m u::rwx,g:groupname:rX,o::- "" # Copy ACL from file-A to file-B getfacl file-A | setfacl -M - file-B @@ -16,10 +16,10 @@ getfacl file-A | setfacl -M - file-B setfacl -R -m u:username:rX # Delete ACL -setfacl -x u:username,g:groupname +setfacl -x u:username,g:groupname "" # Delete all ACL on file, including default -setfacl -b +setfacl -b "" # Same operations works for default ACLs setfacl -m d:u:username:rx diff --git a/ag b/ag index 528dab0..592f43c 100644 --- a/ag +++ b/ag @@ -2,7 +2,7 @@ ag --ignore-dir= # To exclude a file from a search: -ag --ignore= +ag --ignore="" # To force colorization: ag --color | less -R diff --git a/bat b/bat index 08f65ca..1fafd1b 100644 --- a/bat +++ b/bat @@ -1,11 +1,11 @@ # Display a single file on the terminal: -bat +bat "" # Display multiple files at once: -bat +bat "" "" # Show and highlight non-printable characters: -bat -A +bat -A "" # Display all supported languages: bat --list-languages diff --git a/cat b/cat index b9834fe..b8cd595 100644 --- a/cat +++ b/cat @@ -1,8 +1,8 @@ # To display the contents of a file: -cat +cat "" # To display file contents with line numbers -cat -n +cat -n "" # To display file contents with line numbers (blank lines excluded) -cat -b +cat -b "" diff --git a/chown b/chown index e8dcffa..49b6098 100644 --- a/chown +++ b/chown @@ -1,17 +1,17 @@ # Change a file's owner: -chown +chown "" # Change a file's owner and group: -chown : +chown : "" # Set user to match group value -chown : +chown : "" # Set group to match user value -chown : +chown : "" # Change a directory's owner recursively: chown -R # Change ownership to match another file: -chown --reference= +chown --reference= "" diff --git a/csplit b/csplit index a8e4840..fde5191 100644 --- a/csplit +++ b/csplit @@ -1,5 +1,5 @@ # To split a file based on a pattern: -csplit '/PATTERN/' +csplit "" '/PATTERN/' # To use prefix/suffix to improve output file names: -csplit -f 'prefix-' -b '%d.extension' '/PATTERN/' '{*}' +csplit -f 'prefix-' -b '%d.extension' "" '/PATTERN/' '{*}' diff --git a/cups b/cups index 64c35e5..36f9a72 100644 --- a/cups +++ b/cups @@ -2,7 +2,7 @@ http://localhost:631 (in web browser) # To print a file: -lp +lp "" # To display the print queue: lpq diff --git a/dnf b/dnf index dc9ce1b..c7cfd8c 100644 --- a/dnf +++ b/dnf @@ -16,7 +16,7 @@ dnf provides dnf download # To install the build dependencies for a SRPM or from a .spec file: -dnf builddep +dnf builddep "" # List installed packages dnf list installed diff --git a/ffmpeg b/ffmpeg index 60d10ac..6405227 100644 --- a/ffmpeg +++ b/ffmpeg @@ -1,5 +1,5 @@ # To print file metadata: -ffmpeg -i +ffmpeg -i "" # To convert all m4a files to mp3 for f in *.m4a; do ffmpeg -i "$f" -acodec libmp3lame -vn -b:a 320k "${f%.m4a}.mp3"; done diff --git a/fmt b/fmt index 322ec7c..a3283c8 100644 --- a/fmt +++ b/fmt @@ -1,2 +1,2 @@ # To format lines, 50 words in each line: -cat | fmt -w 50 +cat "" | fmt -w 50 diff --git a/gdb b/gdb index f2267b0..f44e9a9 100644 --- a/gdb +++ b/gdb @@ -9,7 +9,7 @@ b, break # To set a (conditional) breakpoint at a general location: b, break [if ] - with as |:||*
|-offset|+offset + with as |"":||*
|-offset|+offset # To set a watchpoint, i.e., stop when expression changes its value: watch @@ -21,7 +21,7 @@ info breakpoints, info watchpoints clear, delete delete clear - with as |:||*
|-offset|+offset + with as |"":||*
|-offset|+offset # To disable a breakpoint: dis, disable @@ -47,7 +47,7 @@ ni, nexti # To run until given location is reached advance - with as |:||*
|-offset|+offset + with as |"":||*
|-offset|+offset # To run until function ends, i.e., jump out of a function: fin, finish diff --git a/git b/git index 15a8828..37531cd 100644 --- a/git +++ b/git @@ -108,7 +108,7 @@ git branch --merged | egrep -v "(^*|main|dev)" | xargs git branch -d git branch -u upstream/foo # To see who commited which line in a file: -git blame +git blame "" # To sync a fork with the master repo: git remote add upstream git@github.com:/.git # Set a new repo diff --git a/grep b/grep index 220de29..9aa75db 100644 --- a/grep +++ b/grep @@ -1,24 +1,24 @@ # To search a file for a pattern: -grep +grep "" # To perform a case-insensitive search (with line numbers): -grep -in +grep -in "" # To recursively grep for string in : grep -R # Read search patterns from a file (one per line): -grep -f +grep -f "" # Find lines NOT containing pattern: -grep -v +grep -v "" # Set how many lines to show before (-B) and after (-A) pattern: -grep -B 3 -A 2 +grep -B 3 -A 2 "" # To grep with regular expressions: -grep "^00" # Match lines starting with 00 -grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" # Find IP add +grep "^00" "" # Match lines starting with 00 +grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" "" # Find IP add # To find all files that match in grep -rnw -e diff --git a/head b/head index 3a912e4..ab5cd4a 100644 --- a/head +++ b/head @@ -1,8 +1,8 @@ -# To show the first 10 lines of : -head +# To show the first 10 lines of "": +head "" -# To show the first lines of : -head -n +# To show the first lines of "": +head -n "" -# To show the first bytes of : -head -c +# To show the first bytes of "": +head -c "" diff --git a/hg b/hg index 2844999..3c940fe 100644 --- a/hg +++ b/hg @@ -5,7 +5,7 @@ tags: [ vcs ] hg clone # To add files to hg tracker: -hg add +hg add "" # To add all files in to hg tracker: hg add diff --git a/more b/more index 3c549d2..a89e027 100644 --- a/more +++ b/more @@ -1,2 +1,2 @@ -# To show beginning at line number 5: -more +5 +# To show "" beginning at line number 5: +more +5 "" diff --git a/mv b/mv index 2ff826f..cd3b7ef 100644 --- a/mv +++ b/mv @@ -14,4 +14,4 @@ mv -i mv -n # To move listed file(s) to a directory -mv -t ... +mv -t ""... diff --git a/ncdu b/ncdu index 5e183b9..a88ad37 100644 --- a/ncdu +++ b/ncdu @@ -1,11 +1,11 @@ -# To save results to : -ncdu -o +# To save results to "": +ncdu -o "" -# To read from : -ncdu -f +# To read from "": +ncdu -f "" # To save results to a compressed file: -ncdu -o- | gzip > +ncdu -o- | gzip > "" # To read from a compressed file: -zcat | ncdu -f- +zcat "" | ncdu -f- diff --git a/nkf b/nkf index 4b97a1f..d832a29 100644 --- a/nkf +++ b/nkf @@ -1,26 +1,26 @@ # To check the file's charactor code: -nkf -g +nkf -g "" # To convert charactor code to UTF-8: -nkf -w --overwrite +nkf -w --overwrite "" # To convert charactor code to EUC-JP: -nkf -e --overwrite +nkf -e --overwrite "" # To convert charactor code to Shift-JIS: -nkf -s --overwrite +nkf -s --overwrite "" # To convert charactor code to ISO-2022-JP: -nkf -j --overwrite +nkf -j --overwrite "" # To convert newline to LF: -nkf -Lu --overwrite +nkf -Lu --overwrite "" # To convert newline to CRLF: -nkf -Lw --overwrite +nkf -Lw --overwrite "" # To convert newline to CR: -nkf -Lm --overwrite +nkf -Lm --overwrite "" # To MIME encode: echo ใƒ†ใ‚นใƒˆ | nkf -WwMQ diff --git a/pacman b/pacman index b9e6a44..caf6f22 100644 --- a/pacman +++ b/pacman @@ -20,7 +20,7 @@ pacman -Rcs ... pacman -Si ... # To install a package from builded package file (.tar.xz): -pacman -U +pacman -U "" # To list the commands provided by an installed package: pacman -Ql ... | sed -n -e 's/.*\/bin\///p' | tail -n +2 diff --git a/paste b/paste index 1059400..dc214b5 100644 --- a/paste +++ b/paste @@ -1,14 +1,14 @@ # To concat columns from files: -paste ... +paste ""... # To list the files in the current directory in three columns: ls | paste - - - # To combine pairs of lines from a file into single lines: -paste -s -d '\t\n' +paste -s -d '\t\n' "" # To number the lines in a file, similar to nl(1): -sed = | paste -s -d '\t\n' - - +sed = "" | paste -s -d '\t\n' - - # To create a colon-separated list of directories named bin, suitable for use in the PATH environment variable: find / -name bin -type d | paste -s -d : - diff --git a/patch b/patch index 62a4db2..0aedc16 100644 --- a/patch +++ b/patch @@ -1,8 +1,8 @@ # To patch one file: -patch < +patch "" < # To reverse a patch: -patch -R < +patch -R "" < # To patch all files in a directory, adding any missing new files: # -p strips leading slashes diff --git a/rpm b/rpm index ff84fd3..2f41741 100644 --- a/rpm +++ b/rpm @@ -14,7 +14,7 @@ rpm -e rpm -e --nodeps # To find what package installs a file: -rpm -qf +rpm -qf "" # To find what files are installed by a package: rpm -ql @@ -22,7 +22,7 @@ rpm -qpl # To find what packages require a package or file: rpm -q --whatrequires -rpm -q --whatrequires +rpm -q --whatrequires "" # To list all installed packages: rpm -qa diff --git a/ruby b/ruby index fd429df..b96a628 100644 --- a/ruby +++ b/ruby @@ -6,13 +6,13 @@ ruby -run -e httpd . -p # To execute a script file: -ruby +ruby "" # To execute one line of script: ruby -e 'command' # To check script file syntax: -ruby -c +ruby -c "" # To specify $LOAD_PATH directory: ruby -Idirectory diff --git a/scp b/scp index 02ffb91..8295b75 100644 --- a/scp +++ b/scp @@ -1,11 +1,11 @@ # To copy a file from your local machine to a remote server: -scp @: +scp "" @: # To copy a file from a remote server to your local machine: scp @: # To scp a file over a SOCKS proxy on localhost and port 9999 (see ssh for tunnel setup): -scp -o "ProxyCommand nc -x 127.0.0.1:9999 -X 4 %h %p" @: +scp -o "ProxyCommand nc -x 127.0.0.1:9999 -X 4 %h %p" "" @: # To scp between two remote servers from the third machine: scp -3 @: @: diff --git a/sed b/sed index c506e17..7efa5a7 100644 --- a/sed +++ b/sed @@ -1,20 +1,20 @@ # To replace all occurrences of "day" with "night" and write to stdout: -sed 's/day/night/g' +sed 's/day/night/g' "" -# To replace all occurrences of "day" with "night" within : -sed -i 's/day/night/g' +# To replace all occurrences of "day" with "night" within "": +sed -i 's/day/night/g' "" # To replace all occurrences of "day" with "night" on stdin: echo 'It is daytime' | sed 's/day/night/g' # To remove leading spaces: -sed -i -r 's/^\s+//g' +sed -i -r 's/^\s+//g' "" # To remove empty lines and print results to stdout: -sed '/^$/d' +sed '/^$/d' "" # To replace newlines in multiple lines: -sed ':a;N;$!ba;s/\n//g' +sed ':a;N;$!ba;s/\n//g' "" # To insert a line before a matching pattern: sed '/Once upon a time/i\Chapter 1' diff --git a/sha256sum b/sha256sum index 11e40d4..243f599 100644 --- a/sha256sum +++ b/sha256sum @@ -1,8 +1,8 @@ --- tags: [ cryptography, hash, checksum, verification ] --- -# To compute hash (checksum) of : -sha256sum +# To compute hash (checksum) of "": +sha256sum "" # To compute hash (checksum) from input text: # Enter text in keyboard and finish by ctrl-D at beginning of line diff --git a/shred b/shred index 89c606f..e00670c 100644 --- a/shred +++ b/shred @@ -1,11 +1,11 @@ # To shred a file (5 passes) and verbose output: -shred -n 5 -v +shred -n 5 -v "" # To shred a file (5 passes) and a final overwrite of zeroes: -shred -n 5 -vz +shred -n 5 -vz "" # To do the above, and then truncate and rm the file: -shred -n 5 -vzu +shred -n 5 -vzu "" # To shred a partition: shred -n 5 -vz /dev/sda diff --git a/sort b/sort index e6ec2cd..8d748bd 100644 --- a/sort +++ b/sort @@ -1,17 +1,17 @@ # To sort a file: -sort +sort "" # To sort a file by keeping only unique: -sort -u +sort -u "" # To sort a file and reverse the result: -sort -r +sort -r "" # To sort a file randomly: -sort -R +sort -R "" # To sort a file and store the output in another file: sort -o # Sort by default uses /var/tmp to store temp files but size of /var/tmp directory is limited. In order to sort huge use a directory with adequate size: -sort -T \ No newline at end of file +sort -T "" \ No newline at end of file diff --git a/split b/split index bd19c1e..e263a88 100644 --- a/split +++ b/split @@ -1,8 +1,8 @@ # To split a large text file into smaller files of 1000 lines each: -split -l 1000 +split "" -l 1000 # To split a large binary file into smaller files of 10M each: -split -b 10M +split "" -b 10M # To consolidate split files into a single file: -cat x* > +cat x* > "" diff --git a/ssh b/ssh index 357177f..a49ef78 100644 --- a/ssh +++ b/ssh @@ -50,4 +50,4 @@ sshfs @:/path/to/folder /path/to/mount/point # Emacs can read file through SSH # Doc: http://www.gnu.org/software/emacs/manual/html_node/emacs/Remote-Files.html -emacs /ssh:@: +emacs /ssh:@:"" diff --git a/stdout b/stdout index 43535e9..f20e9dc 100644 --- a/stdout +++ b/stdout @@ -1,13 +1,13 @@ # To redirect stderr to stdout: some-command 2>&1 -# To redirect stdout to : -some-command > +# To redirect stdout to "": +some-command > "" -# To redirect stderr to : -some-command 2> +# To redirect stderr to "": +some-command 2> "" # To redirect all output (stderr and stdout) to file: -some-command > 2>&1 +some-command > "" 2>&1 -# Replace with `/dev/null` to silence output +# Replace "" with `/dev/null` to silence output diff --git a/tail b/tail index dfc5b7b..ea544db 100644 --- a/tail +++ b/tail @@ -1,14 +1,14 @@ -# To show the last 10 lines of : -tail +# To show the last 10 lines of "": +tail "" -# To show the last lines of : -tail -n +# To show the last lines of "": +tail -n "" -# To show the last lines of starting with : -tail -n + +# To show the last lines of "" starting with : +tail -n + "" -# To show the last bytes of : -tail -c +# To show the last bytes of "": +tail -c "" -# To show the last 10 lines of and to wait for to grow: -tail -f +# To show the last 10 lines of "" and to wait for "" to grow: +tail -f "" diff --git a/touch b/touch index 05a33b8..d8e419b 100644 --- a/touch +++ b/touch @@ -1,9 +1,9 @@ # To change a file's modification time: -touch -d