Convert Figma logo to code with AI

alexanderepstein logoBash-Snippets

A collection of small bash scripts for heavy terminal users

9,635
843
9,635
9

Top Related Projects

📖 A collection of pure bash alternatives to external processes.

Master the command line, in one page

A curated list of awesome command-line frameworks, toolkits, guides and gizmos. Inspired by awesome-php.

A curated list of delightful Bash scripts and resources.

Python best practices guidebook, written for humans.

Quick Overview

Bash-Snippets is a collection of small bash scripts for heavy terminal users. It provides a variety of useful command-line utilities for tasks such as checking the weather, converting currency, performing network diagnostics, and more. These scripts are designed to be lightweight, easy to use, and require minimal dependencies.

Pros

  • Wide range of useful utilities for everyday tasks
  • Easy to install and use with minimal setup required
  • Lightweight and fast, with low system resource usage
  • Actively maintained and open for community contributions

Cons

  • Limited to bash environments, not cross-platform
  • Some scripts may require external dependencies or API keys
  • May not offer as much functionality as dedicated full-featured applications
  • Potential for inconsistent user experience across different utilities

Code Examples

  1. Checking the weather:
weather New York

This command displays the current weather conditions for New York City.

  1. Converting currency:
currency 100 USD EUR

This command converts 100 US Dollars to Euros.

  1. Performing a speed test:
speedtest

This command runs a network speed test and displays the results.

Getting Started

To install Bash-Snippets, run the following commands:

git clone https://github.com/alexanderepstein/Bash-Snippets
cd Bash-Snippets
git checkout v1.23.0
sudo ./install.sh

After installation, you can use any of the utilities by typing their name in the terminal, for example:

weather
stocks
movies

For more information on each utility, use the -h or --help flag, like this:

weather -h

Competitor Comparisons

📖 A collection of pure bash alternatives to external processes.

Pros of pure-bash-bible

  • Comprehensive collection of pure Bash solutions without external dependencies
  • In-depth explanations and examples for each snippet
  • Focuses on Bash-native alternatives to common commands

Cons of pure-bash-bible

  • Less user-friendly for beginners due to its advanced nature
  • Lacks ready-to-use command-line tools
  • May require more setup and integration for practical use

Code Comparison

pure-bash-bible snippet (string manipulation):

trim_string() {
    : "${1#"${1%%[![:space:]]*}"}"
    : "${_%"${_##*[![:space:]]}"}"
    printf '%s\n' "$_"
}

Bash-Snippets example (from currency tool):

getBase=$(echo "$currency" | tr '[:lower:]' '[:upper:]')
getExchange=$(echo "$exchangeTo" | tr '[:lower:]' '[:upper:]')

Summary

pure-bash-bible offers a deep dive into Bash programming techniques, ideal for advanced users seeking to optimize their scripts. It provides pure Bash solutions without relying on external tools.

Bash-Snippets, on the other hand, offers ready-to-use command-line tools for various tasks, making it more accessible for everyday use and beginners. It focuses on practical applications rather than in-depth Bash techniques.

The choice between the two depends on the user's needs: pure-bash-bible for advanced Bash programming knowledge, or Bash-Snippets for quick, practical command-line tools.

Master the command line, in one page

Pros of The Art of Command Line

  • Comprehensive guide covering a wide range of command-line topics
  • Well-organized with clear sections for different skill levels
  • Regularly updated with community contributions

Cons of The Art of Command Line

  • Primarily text-based, lacking executable scripts
  • May be overwhelming for beginners due to its extensive content

Code Comparison

The Art of Command Line provides command examples within its documentation:

# Find a command in your history
history | grep ping

# Quick directory navigation
cd -      # go to previous directory

Bash-Snippets offers executable scripts like:

#!/usr/bin/env bash
# Cheat sheet script
curl cheat.sh/"$1"

Summary

The Art of Command Line is a comprehensive guide for learning and mastering command-line skills, suitable for various skill levels. It offers a wide range of topics and is regularly updated. However, it may be overwhelming for beginners and lacks executable scripts.

Bash-Snippets, on the other hand, provides ready-to-use scripts for specific tasks, making it more practical for immediate use. It's more focused on providing tools rather than extensive documentation.

Choose The Art of Command Line for in-depth learning and reference, or Bash-Snippets for quick, practical command-line utilities.

A curated list of awesome command-line frameworks, toolkits, guides and gizmos. Inspired by awesome-php.

Pros of awesome-shell

  • Comprehensive collection of shell-related tools, frameworks, and resources
  • Regularly updated with community contributions
  • Covers a wide range of shell-related topics beyond just Bash

Cons of awesome-shell

  • Not a standalone tool or script collection, just a curated list
  • Requires users to explore and install tools separately
  • May be overwhelming for beginners due to the large number of options

Code comparison

While a direct code comparison isn't applicable due to the nature of these repositories, here's a brief example of how they differ:

awesome-shell (list entry):

- [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) - A delightful community-driven framework for managing your zsh configuration.

Bash-Snippets (actual script):

#!/usr/bin/env bash
# Author: Alexander Epstein https://github.com/alexanderepstein

currentVersion="1.23.0"
configuredClient=""

Summary

awesome-shell is a comprehensive list of shell-related resources, while Bash-Snippets is a collection of standalone shell scripts. awesome-shell offers a broader scope and community-driven updates but requires more effort to explore and implement. Bash-Snippets provides ready-to-use scripts but has a more limited focus on specific utilities.

A curated list of delightful Bash scripts and resources.

Pros of awesome-bash

  • Comprehensive collection of Bash resources, tools, and tutorials
  • Community-driven with regular updates and contributions
  • Covers a wide range of Bash-related topics, from basics to advanced techniques

Cons of awesome-bash

  • Not a standalone tool or script collection, requires additional effort to implement
  • May contain outdated or deprecated resources due to its extensive nature
  • Less focused on specific use cases compared to Bash-Snippets

Code comparison

While awesome-bash doesn't provide direct code snippets, Bash-Snippets offers ready-to-use scripts. For example:

Bash-Snippets (weather script):

#!/bin/bash
currentVersion="1.23.0"
configuredClient=""
city=""
checkInternet()
{
  wget -q --spider http://github.com
  if [ $? -eq 0 ]; then
    return 0
  else
    return 1
  fi
}

awesome-bash typically links to external resources rather than providing code directly.

Summary

Bash-Snippets offers a curated set of ready-to-use Bash scripts for specific tasks, while awesome-bash serves as a comprehensive resource hub for Bash-related content. Bash-Snippets is more suitable for users seeking immediate solutions, whereas awesome-bash caters to those looking to explore and learn about various Bash topics and tools.

Python best practices guidebook, written for humans.

Pros of python-guide

  • Comprehensive Python learning resource covering a wide range of topics
  • Well-organized structure with clear sections for beginners, intermediate, and advanced users
  • Regularly updated with contributions from the Python community

Cons of python-guide

  • Primarily text-based documentation, lacking executable scripts or tools
  • May require more time to find specific information compared to Bash-Snippets' focused utilities

Code comparison

python-guide (example from documentation):

import requests
r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
print(r.status_code)
print(r.headers['content-type'])

Bash-Snippets (example from 'weather' utility):

curl -s "http://api.openweathermap.org/data/2.5/weather?APPID=$API&q=$1&units=metric" > "$DATAFILE"
grep -q "city not found" "$DATAFILE" && echo "City not found" && rm "$DATAFILE" && exit 1

Summary

python-guide offers a comprehensive Python learning resource with community-driven content, while Bash-Snippets provides ready-to-use command-line utilities. python-guide is better suited for in-depth learning and reference, whereas Bash-Snippets excels in quick, practical tools for common tasks. The choice between them depends on whether you need educational resources or immediate command-line solutions.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Bash-Snippets

A collection of small bash scripts for heavy terminal users with no dependencies

Version Codacy Badge Build Status platform license

All of these scripts have been heavily tested on macOS and Linux

Most of these scripts have been tested on Windows 10 and the official developer bash instance. Does not work with Cygwin or Mysys2.

Looking for maintainers: I have been and probably will forever be too busy to maintain this properly on my own. I am looking for a few others to help out, if you want to be a maintainer either email me or raise an issue. I will probably only accept maintainers who have made a few contributions (no matter how small) and seem to understand the vision of this project.

Tools

Cheat

The fastest way to find {command options|code pieces} you need

Supports multiple languages and many bash commands

Cloudup

A tool that facilitates backing up github repositories to bitbucket

If you have ever felt the fear of the github unicorn this could be your savior

Furthermore you can backup the repositories of any github user to your bitbucket.

Backup all github repositories of the designated user at once with the -a option. Or run it with no flags and backup individual repositories.

Crypt

A wrapper for openssl that allows for quickly encrypting and decrypting files

crypt -e [original file] [encrypted file] # encrypts files
crypt -d [encrypted file] [output file] # decrypts files

Encryption Details

  • Uses AES 256 level encryption
  • Key is salted before creation
  • Password is never in plain text, and OpenSSL generates key based on password
  • Encrypted data is encoded in Base64, so it can be used as plain text in an email. (Not usually necessary if attached as a file)

Tested With .pdf, .txt, .docx, .doc, .png, .jpeg

CAUTION Make sure to use different filenames, otherwise your file will be overwritten!

Cryptocurrency

Converts Cryptocurrency based on realtime exchange rates of the top 10 cryptos

Originally written by: Jonas-Taha El Sesiy Heavy modifications by: Alex Epstein

Currency

Converts currency based on realtime exchange rates

If you want to bypass to guided input you can pass in 3 arguments and it will run from there ex.currency [baseCurrency] [exchangeToCurrency] [amountBeingExchanged] so a valid use case would be currency USD EUR 12.35

Geo

Provides data for wan, lan, router, dns, mac, and ip geolocation

Written by: Jake Meyer

Gist

Manage your gist like a pro

Clone your owned gists and starred gists as git repos, and Fetch/Create/Edit/Delete them with Github API. It also supports quick search with hashtag and contents.

For more information, please go through the guide

Written by: typebrook

Lyrics

Grab lyrics for a given song quickly from the command line.

Meme

A lightning fast meme generator.

Movies

Quick search that grabs relevant information about a movie

Newton

Performs numerical calculations all the way up to symbolic math parsing.

Qrify

Takes any string of text and turns it into a qr code

This is useful for sending links or saving a string of commands to your phone

Written by: Linyos Torovoltos

Short

Gets the link that is being masked by a url shortner

Siteciphers

Check which ciphers are enabled / disabled for a given https site.

Sometimes ciphers are deemed vulnerable, so when you are changing configuration, this can be used to confirm that the cipher truly is disabled.

Some browsers (For example old versions of IE) don't support some of the newer ciphers, which would be a good example of when a SysAdmin would need a list of currently supported ciphers so that changes can be made.

Stocks

Provides information about a certain stock symbol

Taste

Recommendation engine that provides three similar items like the supplied item

Also can provide information on a given item

Valid items are: shows, books, music, artists, movies, authors, games

Needs an API Key (don't worry it's free)

  • Get the API key here
  • After getting the API key run the following line export TASTE_API_KEY="yourAPIKeyGoesHere" >> ~/.bash_profile
Todo

A simplistic command line todo list

Transfer

Quickly transfer files from the command line.

Weather

Provides a 3 day forecast

With no arguments it will grab the weather for your location as determined by your ip

With arguments you can pass in a city or country and get the weather in that area

Also can show the current moon phase

Youtube-Viewer

Provides a way to watch youtube videos from the terminal.

You can use ytview -c [channel name] to see recent videos by that artist.

You can use ytview -s [videoToSearch] or just ytview [videoToSearch] to search for videos.

Written by: Linyos Torovoltos

API's Used

All API's
  • To get location based on ip address: ipinfo
  • To get and print weather based on a location: wttr
  • To grab the stock information in JSON format: alphavantage
  • To grab the latest exchange rate between currencies: fixer
  • To grab information on movies: omdbapi
  • To grab recommendations based on an item: tastedive
  • To determine masked link behind url shortner: ki.tc
  • To grab cheatsheets for commands and languages: cheat
  • To encode text into a qr code: qrenco
  • To grab a list of a users repositories: github
  • To upload a repository to bitbucket: bitbucket
  • To get your WAN ip address: ipify
  • To grab the latest exchange rate between cryptocurrencies to standard currencies: coinmarketcap
  • To perform symbolic math and other computations: newton
  • To transfer files: transfer
  • To grab lyrics from a song: lyrics.ovh
  • To generate memes: MemeGen
  • To get a chart of the top 10 cryptocurrencies rate.sx

Installing

Packaging status

AUR

bash-snippets is available in two different AUR packages: bash-snippets and bash-snippets-git.

yay -S bash-snippets # or bash-snippets-git
APT Package Manager
sudo add-apt-repository ppa:navanchauhan/bash-snippets # add bash-snippets PPA
sudo apt update # update package list
sudo apt install bash-snippets # install bash-snippets package
homebrew (macOS) / linuxbrew (Linux)
brew install bash-snippets # installs all tools
brew install bash-snippets --without-all-tools --with-newton --with-weather # specifying install for individual tools
From Source
git clone https://github.com/alexanderepstein/Bash-Snippets # clone the repository
cd Bash-Snippets # cd into the cloned directory
git checkout v1.23.0 # Git checkout to the latest stable release
./install.sh all # install all scripts

or

./install.sh stocks # to install individual scripts

Updating

AUR
yay -S bash-snippets # or bash-snippets-git
APT Package Manager
sudo apt update # update package list
sudo apt upgrade bash-snippets # upgrade bash-snippets package
homebrew (macOS) / linuxbrew (Linux)
brew install bash-snippets --without-all-tools --with-newton --with-weather # specifying install for individual tools
From Source

With any of the installed tools you can automate the update by running it with the -u option or passing in update as the arguments Ex.

stocks update

or

stocks -u

This will clone the repository and install the new versions of scripts that were installed, if you didn’t install a certain tool this script will not install the new version of that tool.

Uninstalling

AUR
pacman -Rns bash-snippets # or bash-snippets-git
APT Package Manager
sudo apt purge bash-snippets # you can also use remove instead of purge
homebrew (macOS) / linuxbrew (Linux)
brew uninstall bash-snippets
Git Uninstall
git clone https://github.com/alexanderepstein/Bash-Snippets # If you don't have the Bash-Snippets folder anymore clone the repository
cd Bash-Snippets # cd into the Bash-Snippets directory:
To go through a guided uninstall ```bash ./uninstall.sh ```
To uninstall all installed bash-snippets
./uninstall.sh all
To go through a guided uninstall
./uninstall.sh
To uninstall all installed bash-snippets
./uninstall.sh all

Donate

If this project helped you in any way and you feel like supporting me

Donate Donate

BTC: 38Q5VbH63MtouxHu8BuPNLzfY5B5RNVMDn
ETH: 0xf7c60C06D298FF954917eA45206426f79d40Ac9D
LTC: LWZ3T19YUk66dgkczN7dRhiXDMqSYrXUV4

Inspired by: Ruby-Scripts

License

MIT License

Copyright (c) 2017 Alex Epstein

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.