├── .gitignore ├── README.md ├── blink ├── browse.sh ├── build-htools.sh ├── code-local.sh ├── code-remote.sh ├── facecam.sh ├── geolocalize.sh ├── link-files-app.sh ├── open-share-sheet.sh └── whatsnew.sh ├── curl ├── download-multiple.sh ├── download.sh ├── post-json-file.sh ├── post-json.sh ├── post.sh ├── upload-multiple.sh └── upload.sh ├── files ├── append-content.sh ├── append-output.sh ├── disk-usage-folders.sh ├── disk-usage.sh ├── md5-checksum.sh ├── read-for-changes.sh ├── read-from-head.sh ├── read-from-tail.sh ├── read-in-hex.sh ├── remove-larger-than.sh ├── remove-named.sh ├── symbolic-link.sh ├── type-info.sh ├── write-content.sh └── write-output.sh ├── find ├── files-and-execute.sh ├── files-and-remove.sh ├── files-larger-than.sh ├── files-smaller-than.sh └── files.sh ├── mosh ├── connect-and-start.sh ├── connect-manually.sh └── connect.sh ├── net ├── domain-info.sh ├── list-all-ports-status.sh ├── list-interfaces.sh ├── list-tcp-ports-status.sh ├── list-udp-ports-status.sh ├── ping-ipv6.sh ├── ping-path.sh └── ping.sh ├── permissions ├── all-can-all.sh ├── change-owner-all.sh ├── change-owner-like.sh ├── change-owner.sh ├── remove.sh ├── set.sh ├── user-all-others-execute.sh ├── user-all-others-read-exec.sh ├── user-all-others-read.sh └── user-read-write-others-read.sh ├── process ├── force-kill-all-by-name.sh ├── force-kill-all-by-user.sh ├── force-kill-by-id.sh ├── kill-all-by-user.sh ├── kill-all-named.sh ├── kill-by-id.sh ├── list-all-by-port.sh ├── list-all-by-user.sh ├── list-all.sh └── status.sh ├── ssh ├── connect-and-execute.sh ├── connect-and-forward-port.sh ├── connect-and-reverse-port.sh ├── connect-and-start.sh ├── connect-forward-port-and-exec.sh ├── connect.sh ├── copy-local-to-remote.sh ├── copy-remote-to-local.sh └── copy-remote-to-remote.sh └── tar ├── archive-elements.sh ├── archive-folder-bzip.sh ├── archive-folder-gzip.sh ├── archive-folder.sh ├── extract-discarding-structure.sh ├── extract-element-by-pattern.sh ├── extract-element.sh ├── extract.sh └── list.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Snips 2 | This is a WIP. For an introduction, please visit the [documentation](https://docs.blink.sh/basics/snips). 3 | 4 | This is the default Index that is automatically updated by Blink within the app. Its purpose is to provide basic and common UNIX functionality. We have mainly referred to https://www.stationx.net/unix-commands-cheat-sheet/ while creating this Index, but we welcome your assistance in improving the guidelines and adding new commands to this Index through PRs. 5 | 6 | Before release, we plan to add the functionality to include other Index locations, which will allow for additional community-maintained Indexes such as Linux commands or even specific development tools (I need one for Rust :D). We found creating this Index to be incredibly helpful and we hope that others can benefit and learn from it as well. 7 | 8 | ## Guidelines 9 | 10 | Nothing here is written in stone. So please let us know if something does not make sense or it could be improved. 11 | 12 | ### Naming 13 | - Incorporate recognizable command names into the action name. For example, for a command like `head` we named a snip `read-from-head` to convey its command and purpose more clearly. 14 | - For commands that are already recognizable verbs, consider organizing them into separate folders. For example, use `ssh` instead of `remote-connection` or `grep` instead of `search/strings`. By doing so, you can focus the snips within the folder on specific action names. For example, within the "ssh" folder, you can have Snippets like `ssh/connect` while in the "grep" folder, you can have Snippets like `grep/string`. This enhances clarity and makes it easier to discover. 15 | - Focus on describing the action, specially with abbreviated commands. For instance, instead of `netstat-ports` we use a more descriptive `net/list-ports-status` to accurately reflect the Snip's purpose. 16 | - To make it easier to discover relevant snips, consider dividing actions with multiple flags. When getting more specific, incorporate additional details into the names. For instance, we have `tar/extract` and `tar/extract-element`. 17 | - Use descriptive verbs when naming actions. Opt for terms like "list" or "read" instead of generic terms like "display" or "show." This consistency makes it easier to surface snips with fuzzy search, for example, `net/ls` will show `net/list-interface`, `net/list-ports`, etc… 18 | 19 | ### Template tags 20 | - The same template tag can be used multiple times and it will be replaced everywhere at once. 21 | - For commands that may accept multiple sequential parameters, use sequential names. For example `${file_1}` `${file_2}`. 22 | - Use tag names that feel like a continuation of the whole action. For example, in `files/symbolic-link` we use `${path}` `${to_link_name}` 23 | - If a parameter can be optional, try to embed in the tag. For example `ssh/connect` uses `${user@}``${host_hash_port}` 24 | - A parameter may have multiple options. You can embed them all in the tag, and (upcoming) comments will context on what they do. For instance, `permissions/set` uses `${ago}` for **a**ll, **g**roup, **o**thers. 25 | -------------------------------------------------------------------------------- /blink/browse.sh: -------------------------------------------------------------------------------- 1 | browse https://${url} -------------------------------------------------------------------------------- /blink/build-htools.sh: -------------------------------------------------------------------------------- 1 | build mosh -------------------------------------------------------------------------------- /blink/code-local.sh: -------------------------------------------------------------------------------- 1 | code ./${local_path} 2 | -------------------------------------------------------------------------------- /blink/code-remote.sh: -------------------------------------------------------------------------------- 1 | code ${host}:~/${remote_path} -------------------------------------------------------------------------------- /blink/facecam.sh: -------------------------------------------------------------------------------- 1 | facecam -------------------------------------------------------------------------------- /blink/geolocalize.sh: -------------------------------------------------------------------------------- 1 | geo start -------------------------------------------------------------------------------- /blink/link-files-app.sh: -------------------------------------------------------------------------------- 1 | link-files -------------------------------------------------------------------------------- /blink/open-share-sheet.sh: -------------------------------------------------------------------------------- 1 | open ${file} -------------------------------------------------------------------------------- /blink/whatsnew.sh: -------------------------------------------------------------------------------- 1 | whatsnew -------------------------------------------------------------------------------- /curl/download-multiple.sh: -------------------------------------------------------------------------------- 1 | curl -L -O ${url1} -O ${url2} -o ${file_name_1} -o ${file_name_2} -------------------------------------------------------------------------------- /curl/download.sh: -------------------------------------------------------------------------------- 1 | curl -L ${url} > ${file_name} -------------------------------------------------------------------------------- /curl/post-json-file.sh: -------------------------------------------------------------------------------- 1 | curl -X POST ${post_url} \ 2 | -H 'Content-Type: application/json' \ 3 | -d '@${local_file}.json' -------------------------------------------------------------------------------- /curl/post-json.sh: -------------------------------------------------------------------------------- 1 | curl -X POST ${post_url} \ 2 | -H 'Content-Type: application/json' \ 3 | -d '{${key}:${value}}' -------------------------------------------------------------------------------- /curl/post.sh: -------------------------------------------------------------------------------- 1 | curl -d "${param_1}=${value_1}&${param_2}=${value_2}" ${post_url} -------------------------------------------------------------------------------- /curl/upload-multiple.sh: -------------------------------------------------------------------------------- 1 | curl -F "${param_1}=@${local_file_1}" -F "${param_2}=@${local_file_2}" ${upload_url} -------------------------------------------------------------------------------- /curl/upload.sh: -------------------------------------------------------------------------------- 1 | curl -F "${parameter}=@${local_file}" ${upload_url} -------------------------------------------------------------------------------- /files/append-content.sh: -------------------------------------------------------------------------------- 1 | cat << EOF >> ${file} 2 | ${content} 3 | EOF -------------------------------------------------------------------------------- /files/append-output.sh: -------------------------------------------------------------------------------- 1 | ${command} >> ${file} -------------------------------------------------------------------------------- /files/disk-usage-folders.sh: -------------------------------------------------------------------------------- 1 | du -sh ${folders} -------------------------------------------------------------------------------- /files/disk-usage.sh: -------------------------------------------------------------------------------- 1 | du -ah -------------------------------------------------------------------------------- /files/md5-checksum.sh: -------------------------------------------------------------------------------- 1 | md5 ${files} -------------------------------------------------------------------------------- /files/read-for-changes.sh: -------------------------------------------------------------------------------- 1 | tail -f ${file} -------------------------------------------------------------------------------- /files/read-from-head.sh: -------------------------------------------------------------------------------- 1 | head -n ${lines} ${file} -------------------------------------------------------------------------------- /files/read-from-tail.sh: -------------------------------------------------------------------------------- 1 | tail -n ${lines} ${file} -------------------------------------------------------------------------------- /files/read-in-hex.sh: -------------------------------------------------------------------------------- 1 | od -t x1 -j ${skip_num_bytes} -N ${read_num_bytes} ${file} -------------------------------------------------------------------------------- /files/remove-larger-than.sh: -------------------------------------------------------------------------------- 1 | find . -type f -size +${larger_than}M -exec rm {} -------------------------------------------------------------------------------- /files/remove-named.sh: -------------------------------------------------------------------------------- 1 | find . -name "${file_pattern}" -exec rm {} -------------------------------------------------------------------------------- /files/symbolic-link.sh: -------------------------------------------------------------------------------- 1 | ln -s ${path} ${to_link_name} -------------------------------------------------------------------------------- /files/type-info.sh: -------------------------------------------------------------------------------- 1 | file ${file} -------------------------------------------------------------------------------- /files/write-content.sh: -------------------------------------------------------------------------------- 1 | cat << EOF > ${file} 2 | ${content} 3 | EOF -------------------------------------------------------------------------------- /files/write-output.sh: -------------------------------------------------------------------------------- 1 | ${command} > ${file} -------------------------------------------------------------------------------- /find/files-and-execute.sh: -------------------------------------------------------------------------------- 1 | find . -iname "${file_pattern}" -exec ${command} 2 | -------------------------------------------------------------------------------- /find/files-and-remove.sh: -------------------------------------------------------------------------------- 1 | find . -name "${file_pattern}" -exec rm {} 2 | -------------------------------------------------------------------------------- /find/files-larger-than.sh: -------------------------------------------------------------------------------- 1 | find . -size +${size}M ${-exec} ${cmd} -------------------------------------------------------------------------------- /find/files-smaller-than.sh: -------------------------------------------------------------------------------- 1 | find . -size -${size}M ${-exec} ${command} 2 | -------------------------------------------------------------------------------- /find/files.sh: -------------------------------------------------------------------------------- 1 | find . -name "${name_pattern}" 2 | -------------------------------------------------------------------------------- /mosh/connect-and-start.sh: -------------------------------------------------------------------------------- 1 | mosh ${user@}${host} -- ${start_command} -------------------------------------------------------------------------------- /mosh/connect-manually.sh: -------------------------------------------------------------------------------- 1 | mosh -p ${server_port}${:port_range} -k ${mosh_key} ${host} -------------------------------------------------------------------------------- /mosh/connect.sh: -------------------------------------------------------------------------------- 1 | mosh ${user}@${host} -------------------------------------------------------------------------------- /net/domain-info.sh: -------------------------------------------------------------------------------- 1 | dig ${domain} ANY -------------------------------------------------------------------------------- /net/list-all-ports-status.sh: -------------------------------------------------------------------------------- 1 | ss -ltu 2 | -------------------------------------------------------------------------------- /net/list-interfaces.sh: -------------------------------------------------------------------------------- 1 | ip link show 2 | -------------------------------------------------------------------------------- /net/list-tcp-ports-status.sh: -------------------------------------------------------------------------------- 1 | ss -lt 2 | -------------------------------------------------------------------------------- /net/list-udp-ports-status.sh: -------------------------------------------------------------------------------- 1 | ss -lu 2 | -------------------------------------------------------------------------------- /net/ping-ipv6.sh: -------------------------------------------------------------------------------- 1 | ping6 -c 10 ${host} -------------------------------------------------------------------------------- /net/ping-path.sh: -------------------------------------------------------------------------------- 1 | ping ${hop_1} ${hop_2} ${host} -------------------------------------------------------------------------------- /net/ping.sh: -------------------------------------------------------------------------------- 1 | ping -c 10 ${host} -------------------------------------------------------------------------------- /permissions/all-can-all.sh: -------------------------------------------------------------------------------- 1 | chmod 777 ${element} -------------------------------------------------------------------------------- /permissions/change-owner-all.sh: -------------------------------------------------------------------------------- 1 | chown -R ${user}:${group} ${in_path} -------------------------------------------------------------------------------- /permissions/change-owner-like.sh: -------------------------------------------------------------------------------- 1 | chown --reference=${like_file} ${file} -------------------------------------------------------------------------------- /permissions/change-owner.sh: -------------------------------------------------------------------------------- 1 | chown ${user}:${group} ${files} -------------------------------------------------------------------------------- /permissions/remove.sh: -------------------------------------------------------------------------------- 1 | chmod ${ago}-${rwx} ${element} -------------------------------------------------------------------------------- /permissions/set.sh: -------------------------------------------------------------------------------- 1 | chmod ${ago}+${rwx} ${element} -------------------------------------------------------------------------------- /permissions/user-all-others-execute.sh: -------------------------------------------------------------------------------- 1 | chmod 711 ${element} -------------------------------------------------------------------------------- /permissions/user-all-others-read-exec.sh: -------------------------------------------------------------------------------- 1 | chmod 755 ${element} -------------------------------------------------------------------------------- /permissions/user-all-others-read.sh: -------------------------------------------------------------------------------- 1 | chmod 744 ${element} -------------------------------------------------------------------------------- /permissions/user-read-write-others-read.sh: -------------------------------------------------------------------------------- 1 | chmod 644 ${element} -------------------------------------------------------------------------------- /process/force-kill-all-by-name.sh: -------------------------------------------------------------------------------- 1 | pkill -9 ${process_name} -------------------------------------------------------------------------------- /process/force-kill-all-by-user.sh: -------------------------------------------------------------------------------- 1 | pkill -9 -u ${user} -------------------------------------------------------------------------------- /process/force-kill-by-id.sh: -------------------------------------------------------------------------------- 1 | kill -9 ${process_ids} -------------------------------------------------------------------------------- /process/kill-all-by-user.sh: -------------------------------------------------------------------------------- 1 | pkill -u ${user} -------------------------------------------------------------------------------- /process/kill-all-named.sh: -------------------------------------------------------------------------------- 1 | pkill ${process_name} -------------------------------------------------------------------------------- /process/kill-by-id.sh: -------------------------------------------------------------------------------- 1 | kill ${process_ids} -------------------------------------------------------------------------------- /process/list-all-by-port.sh: -------------------------------------------------------------------------------- 1 | sudo lsof -i :${port_number} -------------------------------------------------------------------------------- /process/list-all-by-user.sh: -------------------------------------------------------------------------------- 1 | ps -u ${user_name} -x -------------------------------------------------------------------------------- /process/list-all.sh: -------------------------------------------------------------------------------- 1 | ps aux -------------------------------------------------------------------------------- /process/status.sh: -------------------------------------------------------------------------------- 1 | ps aux | grep ${name_or_id} -------------------------------------------------------------------------------- /ssh/connect-and-execute.sh: -------------------------------------------------------------------------------- 1 | ssh ${user@}${host} -- ${command} -------------------------------------------------------------------------------- /ssh/connect-and-forward-port.sh: -------------------------------------------------------------------------------- 1 | ssh -L ${local_port}:${to_remote_host}:${remote_port} ${user@}${host} -------------------------------------------------------------------------------- /ssh/connect-and-reverse-port.sh: -------------------------------------------------------------------------------- 1 | ssh -R ${remote_port}:${to_local_host}:${local_port} ${user@}${host} -------------------------------------------------------------------------------- /ssh/connect-and-start.sh: -------------------------------------------------------------------------------- 1 | ssh -t ${user@}${host} -- ${start_command} -------------------------------------------------------------------------------- /ssh/connect-forward-port-and-exec.sh: -------------------------------------------------------------------------------- 1 | ssh -L ${local_port}:${to_remote_host}:${remote_port} ${user@}${host} -- ${command} -------------------------------------------------------------------------------- /ssh/connect.sh: -------------------------------------------------------------------------------- 1 | ssh ${user@}${host} -------------------------------------------------------------------------------- /ssh/copy-local-to-remote.sh: -------------------------------------------------------------------------------- 1 | scp ${local_path} ${user}@${host#port}:${remote_path} -------------------------------------------------------------------------------- /ssh/copy-remote-to-local.sh: -------------------------------------------------------------------------------- 1 | scp ${user}@${host#port}:${remote_path} ${local_path} -------------------------------------------------------------------------------- /ssh/copy-remote-to-remote.sh: -------------------------------------------------------------------------------- 1 | scp ${user_1}@${host_1#port}:${remote_path_1} ${user_2}@${host_2#port]}:${remote_path_2} -------------------------------------------------------------------------------- /tar/archive-elements.sh: -------------------------------------------------------------------------------- 1 | tar cvf ${archive_name}.tar -C ${path_to} ${elements} -------------------------------------------------------------------------------- /tar/archive-folder-bzip.sh: -------------------------------------------------------------------------------- 1 | tar cvfj ${archive_name}.tar.bz2 ${path}/ -------------------------------------------------------------------------------- /tar/archive-folder-gzip.sh: -------------------------------------------------------------------------------- 1 | tar cvzf ${archive_name}.tar.gz ${path}/ -------------------------------------------------------------------------------- /tar/archive-folder.sh: -------------------------------------------------------------------------------- 1 | tar cvf ${archive_name}.tar ${path}/ -------------------------------------------------------------------------------- /tar/extract-discarding-structure.sh: -------------------------------------------------------------------------------- 1 | tar xvf ${archive_name}.tar.${extension} --strip=${num_path_segments} -C ${to_path} -------------------------------------------------------------------------------- /tar/extract-element-by-pattern.sh: -------------------------------------------------------------------------------- 1 | tar xvf ${archive_name}.tar.${extension} --wildcards '${wildcard}' -------------------------------------------------------------------------------- /tar/extract-element.sh: -------------------------------------------------------------------------------- 1 | tar xvf ${archive_name}.tar.${extension} ${path_to_file} -------------------------------------------------------------------------------- /tar/extract.sh: -------------------------------------------------------------------------------- 1 | tar xvf ${archive_name}.tar.${extension} -C ${to_path} -------------------------------------------------------------------------------- /tar/list.sh: -------------------------------------------------------------------------------- 1 | tar tvf ${archive_name}.tar --------------------------------------------------------------------------------