22.1 C
Texas
Melhttp://www.osradar.com
Guru Unix /Linux and GNU supporter

Useful BASH scripts for every Linux user

Called Bash-Snippets They are a collection of useful BASH scripts for all Linux users. you can much things without browsing. just from Terminal you find many useful things. let me  tell you in this  the name of scripts and  what you can do with them .

First Installing  Scripts :

Install from Git 

why chosing this way ? because its working in all  Linux distributions
First clone the repository:

git clone https://github.com/alexanderepstein/Bash-Snippets
- Advertisement -

Then cd into the cloned directory:

cd Bash-Snippets

Git checkout to the latest stable release

git checkout v1.22.1

Run the guided install script with

Install all the scripts

./install.sh all

Done

What are these commands  installed?

Cheat – Linux Commands cheat sheet.
Cloudup – A tool to backup your GitHub repositories to bitbucket.
Crypt – Encrypt and decrypt files.
Cryptocurrency – Converts Cryptocurrency based on realtime exchange rates of the top 10 cryptos.
Currency – Currency converter.
Geo – Provides the details of wan, lan, router, dns, mac, and ip.
Lyrics – Grab lyrics for a given song quickly from the command line.
Meme – Command line meme creator.
Movies – Search and display a movie details.
Newton – Performs numerical calculations all the way up to symbolic math parsing.
Qrify – Turns the given string into a qr code.
Short – URL Shortner
Siteciphers – Check which ciphers are enabled / disabled for a given https site.
Stocks – Provides certain Stock details.
Taste – Recommendation engine that provides three similar items like the supplied item (The items can be books, music, artists, movies, and games etc).
Todo – Command line todo manager.
Transfer – Quickly transfer files from the command line.
Weather – Displays weather details of your place.
Youtube-Viewer – Watch YouTube from Terminal.

Lets make some tests from  the commands:

1-weather Command

This  command will display weather in the next 3 days based on your IP address. if you want to display weather for a Specific Town . please  add the name of the city  behind

#weather  paris

2-Crypt – to Encrypt and Decrypt files

Please use the options  (-e)  and (-d) to encrypt and decrypt files

Example of decryption /etc/passwd file

root@osradar-mint:~# cat passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/
root@osradar-mint:~# crypt -e passwd encrypted_passwd

Please put the  encryption password  and remember it

Decrypt the file

crypt -d encrypted_passwd decrypted_password

3-Currency – the Currency Converter

Just enter the base currency code and the currency to exchange to, the results are based  on Realtime exchange rates.

Supported Currencies:
_______________________
| AUD | BGN | BRL | CAD |
| CHF | CNY | CZK | DKK |
| EUR | GBP | HKD | HRK |
| HUF | IDR | ILS | INR |
| JPY | KRW | MXN | MYR |
| NOK | NZD | PHP | PLN |
| RON | RUB | SEK | SGD |
| THB | TRY | USD | ZAR |
_______________________

Lets try from EUR to Singapore Dollar

root@osradar-mint:~# currency
What is the base currency: EUR
What currency to exchange to: SGD
What is the amount being exchanged: 100
=========================
| EUR to SGD
| Rate: 1.5582
| EUR: 100
| SGD: 155.8200
=========================
root@osradar-mint:~#

4-Movies – details over Movie 

Get information about movies. like Year release. the  actors , the director

4-Short  : Shorten urls and unmask shortened urls

very nice tool

5- Geo – Find details  over your network

Find  details like s wan, lan, router, dns, mac, and ip geolocation.

Usage: geo [flag]
-w Returns WAN IP
-l Returns LAN IP(s)
-r Returns Router IP
-d Returns DNS Nameserver
-m Returns MAC address for interface. Ex. eth0
-g Returns Current IP Geodata

To know everything about your netwrok:

root@osradar-mint:~# geo -wlrdgm enp0s3  #enp0s3 is  device Ethernet name) 
77.170.242.---
192.168.2.19
192.168.2.254
127.0.0.53
Netherlands
NH
Amsterdam
1103
KPN
77.170.242.---
08:00:27:5c:74:04
root@osradar-mint:~#

6- Youtube-Viewer – Watch YouTubefrom terminal

Ytview command

Description: Search and play youtube videos right from the terminal.
Usage: ytview [flag] [string] or ytview [videoToSearch]
-s Searches youtube
-c Shows the latest videos of a channel
-u Update Bash-Snippet Tools
-h Show the help
-v Get the tool version
Examples:
ytview -s Family Guy Chicken Fight
ytview -c Numberphile

root@osradar-mint:~# ytview The Pursuit of Happyness

7-Newton. The math helper 

From the matrix bellow you can what kind of function you can solve with this script.

 

 ===================================================
|Operations    Sample Expression Sample Result|
|---------------------------------------------------|
|Simplify           [[2x^2]+7]*[4x^2] 8 x^4 + 28 x^2 |
|Factor             x^2 + 2x x       (x + 2) |
|Derive             x^2+2x          2 x + 2 |
|Integrate          x^2+2x 1/3 x^3 + x^2 +C|
|Roots/Zeroes       x^2+2x 2, 0 |
|Tangent            2~x^3 12 x + -16 | (Finding tangent line when x=2 for expression x^3)
|Area               2:4~x^3 60 | (Finding area under curve from 2 to 4 for expression x^3)
|Cos                pi -1 |
|Sin                pi 0 |
|Tan                pi/4 1 |
|ArcCos             1 0 |
|ArcSin             0 0 |
|ArcTan             pi arcsin(pi) |
|Abs                -2 2 |
|Log                2~8 3 | (Log base 2 of eight)
==================================================

8-Stocks – the stock price details

Show  information about  Cisco Company

root@osradar-mint:~# stocks cisco
CSCO stock info
=============================================
| Exchange Name: Nasdaq Global Select
| Latest Price: 46.12
| Open (Current Trading Day): 45.45
| High (Week52): 49.47
| Low (Week52): 36.5
| Close (Previous Trading Day): 46.12
| Price Change: 0.55
| Price Change Percentage: 0.01207
| Volume (Current Trading Day): 21453876
| Last Updated: 1543352400286
=============================================
root@osradar-mint:~#

 

9-lyrics Fetch lyrics for a certain song.

Its also good tool

lyrics -a singer -s song

if you want to dump the words to an file

lyrics -a singer  -s song  -f ~/runItLyrics.txt

Its time that you have to try this beautiful script

To see  and try all the tools just insert bash-snippets  command

#bash-snippets

Enjoy

 

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article