From 1117659de96e5a6d5d364e661520f7099dbd4775 Mon Sep 17 00:00:00 2001 From: MjSeven <33125422+MjSeven@users.noreply.github.com> Date: Mon, 13 Aug 2018 15:43:07 +0800 Subject: [PATCH 1/2] Delete 20170713 A Collection Of Useful BASH Scripts For Heavy Commandline Users.md --- ...ASH Scripts For Heavy Commandline Users.md | 603 ------------------ 1 file changed, 603 deletions(-) delete mode 100644 sources/tech/20170713 A Collection Of Useful BASH Scripts For Heavy Commandline Users.md diff --git a/sources/tech/20170713 A Collection Of Useful BASH Scripts For Heavy Commandline Users.md b/sources/tech/20170713 A Collection Of Useful BASH Scripts For Heavy Commandline Users.md deleted file mode 100644 index f1d24d113b..0000000000 --- a/sources/tech/20170713 A Collection Of Useful BASH Scripts For Heavy Commandline Users.md +++ /dev/null @@ -1,603 +0,0 @@ -Translating by MjSeven - -A Collection Of Useful BASH Scripts For Heavy Commandline Users -====== - -![](https://www.ostechnix.com/wp-content/uploads/2017/07/A-Collection-Of-Useful-BASH-Scripts-720x340.png) - -Today, I have stumbled upon a collection of useful BASH scripts for heavy commandline users. These scripts, known as **Bash-Snippets** , might be quite helpful for those who live in Terminal all day. Want to check the weather of a place where you live? This script will do that for you. Wondering what is the Stock price? You can run the script that displays the current details of a stock. Feel bored? You can watch some youtube videos. All from commandline. You don’t need to install any heavy memory consumable GUI applications. - -As of writing this, Bash-Snippets provides the following 19 useful tools: - - 1. **Cheat** – Linux Commands cheat sheet. - 2. **Cloudup** – A tool to backup your GitHub repositories to bitbucket. - 3. **Crypt** – Encrypt and decrypt files. - 4. **Cryptocurrency** – Converts Cryptocurrency based on realtime exchange rates of the top 10 cryptos. - 5. **Currency** – Currency converter. - 6. **Geo** – Provides the details of wan, lan, router, dns, mac, and ip. - 7. **Lyrics** – Grab lyrics for a given song quickly from the command line. - 8. **Meme** – Command line meme creator. - 9. **Movies** – Search and display a movie details. - 10. **Newton** – Performs numerical calculations all the way up to symbolic math parsing. - 11. **Qrify** – Turns the given string into a qr code. - 12. **Short** – URL Shortner - 13. **Siteciphers** – Check which ciphers are enabled / disabled for a given https site. - 14. **Stocks** – Provides certain Stock details. - 15. **Taste** – Recommendation engine that provides three similar items like the supplied item (The items can be books, music, artists, movies, and games etc). - 16. **Todo** – Command line todo manager. - 17. **Transfer** – Quickly transfer files from the command line. - 18. **Weather** – Displays weather details of your place. - 19. **Youtube-Viewer** – Watch YouTube from Terminal. - - - -The author might add more utilities and/or features in future, so I recommend you to keep an eye on the project’s website or GitHub page for future updates. - -### Bash-Snippets – A Collection Of Useful BASH Scripts For Heavy Commandline Users - -#### Installation - -You can install these scripts on any OS that supports BASH. - -First, clone the GIT repository using command: -``` -$ git clone https://github.com/alexanderepstein/Bash-Snippets - -``` - -Go to the cloned directory: -``` -$ cd Bash-Snippets/ - -``` - -Git checkout to the latest stable release: -``` -$ git checkout v1.22.0 - -``` - -Finally, install the Bash-Snippets using command: -``` -$ sudo ./install.sh - -``` - -This will ask you which scripts to install. Just type **Y** and press ENTER key to install the respective script. If you don’t want to install a particular script, type **N** and hit ENTER. -``` -Do you wish to install currency [Y/n]: y - -``` - -To install all scripts, run: -``` -$ sudo ./install.sh all - -``` - -To install a specific script, say currency, run: -``` -$ sudo ./install.sh currency - -``` - -You can also install it using [**Linuxbrew**][1] package manager. - -To installs all tools, run: -``` -$ brew install bash-snippets - -``` - -To install specific tools: -``` -$ brew install bash-snippets --without-all-tools --with-newton --with-weather - -``` - -Also, there is a PPA for Debian-based systems such as Ubuntu, Linux Mint. -``` -$ sudo add-apt-repository ppa:navanchauhan/bash-snippets -$ sudo apt update -$ sudo apt install bash-snippets - -``` - -#### Usage - -**An active Internet connection is required** to use these tools. The usage is fairly simple. Let us see how to use some of these scripts. I assume you have installed all scripts. - -**1\. Currency – Currency Converter** - -This script converts the currency based on realtime exchange rates. Enter the base currency code and the currency to exchange to, and the amount being exchanged one by one as shown below. -``` -$ currency -What is the base currency: INR -What currency to exchange to: USD -What is the amount being exchanged: 10 - -========================= -| INR to USD -| Rate: 0.015495 -| INR: 10 -| USD: .154950 -========================= - -``` - -You can also pass all arguments in a single command as shown below. -``` -$ currency INR USD 10 - -``` - -Refer the following screenshot. - -[![Bash-Snippets][2]][3] - -**2\. Stocks – Display stock price details** - -If you want to check a stock price details, mention the stock item as shown below. -``` -$ stocks Intel - -INTC stock info -============================================= -| Exchange Name: NASDAQ -| Latest Price: 34.2500 -| Close (Previous Trading Day): 34.2500 -| Price Change: 0.0000 -| Price Change Percentage: 0.00% -| Last Updated: Jul 12, 4:00PM EDT -============================================= - -``` - -The above output the **Intel stock** details. - -**3\. Weather – Display Weather details** - -Let us check the Weather details by running the following command: -``` -$ weather - -``` - -**Sample output:** - -![][4] - -As you see in the above screenshot, it provides the 3 day weather forecast. Without any arguments, it will display the weather details based on your IP address. You can also bring the weather details of a particular city or country like below. -``` -$ weather Chennai - -``` - -Also, you can view the moon phase by entering the following command: -``` -$ weather moon - -``` - -Sample output would be: - -![][5] - -**4\. Crypt – Encrypt and Decrypt files** - -This script is a wrapper for openssl that allows you to encrypt and decrypt files quickly and easily. - -To encrypt a file, use the following command: -``` -$ crypt -e [original file] [encrypted file] - -``` - -For example, the following command will encrypt a file called **ostechnix.txt** , and save it as **encrypt_ostechnix.txt **in the current working directory. -``` -$ crypt -e ostechnix.txt encrypt_ostechnix.txt - -``` - -Enter the password for the file twice. -``` -Encrypting ostechnix.txt... -enter aes-256-cbc encryption password: -Verifying - enter aes-256-cbc encryption password: -Successfully encrypted - -``` - -The above command will encrypt the given file using **AES 256 level encryption**. The password will not be saved in plain text. You can encrypt .pdf, .txt, .docx, .doc, .png, .jpeg type files. - -To decrypt the file, use the following command: -``` -$ crypt -d [encrypted file] [output file] - -``` - -Example: -``` -$ crypt -d encrypt_ostechnix.txt ostechnix.txt - -``` - -Enter the password to decrypt. -``` -Decrypting encrypt_ostechnix.txt... -enter aes-256-cbc decryption password: -Successfully decrypted - -``` - -**5\. Movies – Find Movie details** - -Using this script, you can find a movie details. - -The following command displays the details of a movie called “mother”. -``` -$ movies mother - -================================================== -| Title: Mother -| Year: 2009 -| Tomato: 95% -| Rated: R -| Genre: Crime, Drama, Mystery -| Director: Bong Joon Ho -| Actors: Hye-ja Kim, Bin Won, Goo Jin, Je-mun Yun -| Plot: A mother desperately searches for the killer who framed her son for a girl's horrific murder. -================================================== - -``` - -**6\. Display similar items like the supplied item** - -To use this script, you need to get the API key **[here][6]**. No worries, it is completely FREE! Once the you got the API, add the following line to your **~/.bash_profile** : **export TASTE_API_KEY=”yourAPIKeyGoesHere”**`` - -Now, you can view the similar item like the supplied item as shown below: -``` -$ taste -i Red Hot Chilli Peppers - -``` - -**7\. Short – Shorten URLs** - -This script shortens the given URL. -``` -$ short - -``` - -**8\. Geo – Display the details of your network** - -This script helps you to find out the details of your network, such as wan, lan, router, dns, mac, and ip geolocation. - -For example, to find out your LAN ip, run: -``` -$ geo -l - -``` - -Sample output from my system: -``` -192.168.43.192 - -``` - -To find your Wan IP: -``` -$ geo -w - -``` - -For more details, just type ‘geo’ in the Terminal. -``` -$ geo -Geo -Description: Provides quick access for wan, lan, router, dns, mac, and ip geolocation data -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 -Examples: - geo -g - geo -wlrdgm eth0 -Custom Geo Output => -[all] [query] [city] [region] [country] [zip] [isp] -Example: geo -a 8.8.8.8 -o city,zip,isp - -o [options] Returns Specific Geodata - -a [address] For specific ip in -s - -v Returns Version - -h Returns Help Screen - -u Updates Bash-Snippets - -``` - -**9\. Cheat – Display cheatsheets of Linux commands** - -Want to refer the cheatsheet of Linux command? Well, it is also possible. The following command will display the cheatsheet of **curl** command: -``` -$ cheat curl - -``` - -Just replace **curl** with the command of your choice to display its cheatsheet. This can be very useful for the quick reference to any command you want to use. - -**10\. Youtube-Viewer – Watch YouTube videos** - -Using this script, you can search or watch youtube videos right from the Terminal. - -Let us watch some **Ed Sheeran** videos. -``` -$ ytview Ed Sheeran - -``` - -Choose the video you want to play from the list. The selected will play in your default media player. - -![][7] - -To view recent videos by an artist, you can use: -``` -$ ytview -c [channel name] - -``` - -To search for videos, just enter: -``` -$ ytview -s [videoToSearch] - -``` - -or just, -``` -$ ytview [videoToSearch] - -``` - -**11\. cloudup – Backup GitHub repositories to bitbucket** - -Have you hosted any project on GitHub? Great! You can backup the GitHub repositories to **bitbucket** , a web-based hosting service used for source code and development projects, at any time. - -You can either backup all github repositories of the designated user at once with the **-a** option. Or run it with no flags and backup individual repositories. - -To backup GitHub repository, run: -``` -$ cloudup - -``` - -You will be asked to enter your GitHub username, name of the repository to backup, and bitbucket username and password etc. - -**12\. Qrify – Convert Strings into QR code** - -This script converts any given string of text into a QR code. This is useful for sending links or saving a string of commands to your phone -``` -$ qrify convert this text into qr code - -``` - -Sample output would be: - -![][8] - -Cool, isn’t it? - -**13\. Cryptocurrency** - -It displays the top ten cryptocurrencies realtime exchange rates. - -Type the following command and hit ENTER to run it: -``` -$ cryptocurrency - -``` - -![][9] - -**14\. Lyrics** - -This script grabs the lyrics for a given song quickly from the command line. - -Say for example, I am going to fetch the lyrics of **“who is it”** song, a popular song sung by **Michael Jackson**. -``` -$ lyrics -a michael jackson -s who is it - -``` - -![][10] - -**15\. Meme** - -This script allows you to create simple memes from command line. It is quite faster than GUI-based meme generators. - -To create a meme, just type: -``` -$ meme -f mymeme -Enter the name for the meme's background (Ex. buzz, doge, blb ): buzz -Enter the text for the first line: THIS IS A -Enter the text for the second line: MEME - -``` - -This will create jpg file in your current working directory. - -**16\. Newton** - -Tired of solving complex Maths problems? Here you go. The Newton script will perform numerical calculations all the way up to symbolic math parsing. - -![][11] - -**17\. Siteciphers** - -This script helps you to check which ciphers are enabled / disabled for a given https site. -``` -$ siteciphers google.com - -``` - -![][12] - -**18\. Todo** - -It allows you to create everyday tasks directly from the Terminal. - -Let us create some tasks. -``` -$ todo -a The first task -01). The first task Tue Jun 26 14:51:30 IST 2018 - -``` - -To add another task, simply re-run the above command with the task name. -``` -$ todo -a The second task -01). The first task Tue Jun 26 14:51:30 IST 2018 -02). The second task Tue Jun 26 14:52:29 IST 2018 - -``` - -To view the list of tasks, run: -``` -$ todo -g -01). The first task Tue Jun 26 14:51:30 IST 2018 -02). A The second task Tue Jun 26 14:51:46 IST 2018 - -``` - -Once you completed a task, remove it from the list as shown below. -``` -$ todo -r 2 -Sucessfully removed task number 2 -01). The first task Tue Jun 26 14:51:30 IST 2018 - -``` - -To clear all tasks, run: -``` -$ todo -c -Tasks cleared. - -``` - -**19\. Transfer** - -The transfer script allows you to quickly and easily transfer files and directories over Internet. - -Let us upload a file. -``` -$ transfer test.txt -Uploading test.txt -################################################################################################################################################ 100.0% -Success! -Transfer Download Command: transfer -d desiredOutputDirectory ivmfj test.txt -Transfer File URL: https://transfer.sh/ivmfj/test.txt - -``` - -The file will be uploaded to transfer.sh site. Transfer.sh allows you to upload files up to **10 GB** in one go. All shared files automatically expire after **14 days**. As you can see, anyone can download the file either by visiting the second URL via a web browser or using the transfer command (it is installed in his/her system, of course). - -Now remove the file from your system. -``` -$ rm -fr test.txt - -``` - -Now, you can download the file from transfer.sh site at any time (within 14 days) like below. -``` -$ transfer -d Downloads ivmfj test.txt - -``` - -For more details about this utility, refer our following guide. - -##### Getting help - -If you don’t know how to use a particular script, just type that script’s name and press ENTER. You will see the usage details. The following example displays the help section of **Qrify** script. -``` -$ qrify -Qrify -Usage: qrify [stringtoturnintoqrcode] -Description: Converts strings or urls into a qr code. - -u Update Bash-Snippet Tools - -m Enable multiline support (feature not working yet) - -h Show the help - -v Get the tool version -Examples: - qrify this is a test string - qrify -m two\\nlines - qrify github.com # notice no http:// or https:// this will fail - -``` - -#### Updating scripts - -You can update the installed tools at any time suing -u option. The following command updates “weather” tool. -``` -$ weather -u - -``` - -#### Uninstall - -You can uninstall these tools as shown below. - -Git clone the repository: -``` -$ git clone https://github.com/alexanderepstein/Bash-Snippets - -``` - -Go to the Bash-Snippets directory: -``` -$ cd Bash-Snippets - -``` - -And uninstall the scripts by running the following command: -``` -$ sudo ./uninstall.sh - -``` - -Type **y** and hit ENTER to remove each script. -``` -Do you wish to uninstall currency [Y/n]: y - -``` - -**Also read: ** - -And, that’s all for now folks. I must admit that I’m very impressed when testing this scripts. I really liked the idea of combing all useful scripts into a single package. Kudos to the developer. Give it a try, you won’t be disappointed. - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/collection-useful-bash-scripts-heavy-commandline-users/ - -作者:[SK][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.ostechnix.com/author/sk/ -[1]:https://www.ostechnix.com/linuxbrew-common-package-manager-linux-mac-os-x/ -[3]:http://www.ostechnix.com/wp-content/uploads/2017/07/sk@sk_001.png -[4]:http://www.ostechnix.com/wp-content/uploads/2017/07/sk@sk_002-1.png -[5]:http://www.ostechnix.com/wp-content/uploads/2017/07/sk@sk_003.png -[6]:https://tastedive.com/account/api_access -[7]:http://www.ostechnix.com/wp-content/uploads/2017/07/ytview-1.png -[8]:http://www.ostechnix.com/wp-content/uploads/2017/07/sk@sk_005.png -[9]:http://www.ostechnix.com/wp-content/uploads/2017/07/cryptocurrency.png -[10]:http://www.ostechnix.com/wp-content/uploads/2017/07/lyrics.png -[11]:http://www.ostechnix.com/wp-content/uploads/2017/07/newton.png -[12]:http://www.ostechnix.com/wp-content/uploads/2017/07/siteciphers.png From 7094ef3c023aaefaf7e870db0025eab3010a3e06 Mon Sep 17 00:00:00 2001 From: MjSeven <33125422+MjSeven@users.noreply.github.com> Date: Mon, 13 Aug 2018 15:43:34 +0800 Subject: [PATCH 2/2] Create 20170713 A Collection Of Useful BASH Scripts For Heavy Commandline Users.md --- ...ASH Scripts For Heavy Commandline Users.md | 599 ++++++++++++++++++ 1 file changed, 599 insertions(+) create mode 100644 translated/tech/20170713 A Collection Of Useful BASH Scripts For Heavy Commandline Users.md diff --git a/translated/tech/20170713 A Collection Of Useful BASH Scripts For Heavy Commandline Users.md b/translated/tech/20170713 A Collection Of Useful BASH Scripts For Heavy Commandline Users.md new file mode 100644 index 0000000000..3e11502df4 --- /dev/null +++ b/translated/tech/20170713 A Collection Of Useful BASH Scripts For Heavy Commandline Users.md @@ -0,0 +1,599 @@ +献给命令行重度用户的一组实用 BASH 脚本 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2017/07/A-Collection-Of-Useful-BASH-Scripts-720x340.png) + +今天,我偶然发现了一组用于命令行重度用户的实用 BASH 脚本,这些脚本被称为 **Bash-Snippets**,它们对于那些整天都与终端打交道的人来说可能会很有帮助。想要查看你居住地的天气情况?它为你做了。想知道股票价格?你可以运行显示股票当前详细信息的脚本。觉得无聊?你可以看一些 YouTube 视频。这些全部在命令行中完成,你无需安装任何严重消耗内存的 GUI 应用程序。 + +在撰写本文时,Bash-Snippets 提供以下 19 个实用工具: + + 1. **Cheat** – Linux 命令备忘单。 + 2. **Cloudup** – 一个将 GitHub 仓库备份到 bitbucket 的工具。 + 3. **Crypt** – 加解密文件。 + 4. **Cryptocurrency** – 前 10 大加密货币的实时汇率转换。 + 5. **Currency** – 货币转换器。 + 6. **Geo** – 提供 wan、lan、router、dns、mac 和 ip 的详细信息。 + 7. **Lyrics** – 从命令行快速获取给定歌曲的歌词。 + 8. **Meme** – 创造命令行表情包。 + 9. **Movies** – 搜索并显示电影详情。 + 10. **Newton** – 执行数值计算一直到符号数学解析。(to 校正:这里不理解) + 11. **Qrify** – 将给定的字符串转换为二维码。 + 12. **Short** – 缩短 URL + 13. **Siteciphers** – 检查给定 https 站点启用或禁用的密码。 + 14. **Stocks** – 提供某些股票的详细信息。 + 15. **Taste** – 推荐引擎提供三个类似的项目,如提供物品(如书籍、音乐、艺术家、电影和游戏等。) + 16. **Todo** – 命令行待办事项管理。 + 17. **Transfer** – 从命令行快速传输文件。 + 18. **Weather** – 显示你所在地的天气详情。 + 19. **Youtube-Viewer** – 从终端观看 YouTube 视频。 + +作者可能会在将来添加更多实用程序和/或功能,因此我建议你密切关注该项目的网站或 GitHub 页面以供将来更新。 + +### Bash-Snippets – 一组实用 BASH 脚本献给命令行重度用户 + +#### 安装 + +你可以在任何支持 BASH 的操作系统上安装这些脚本。 + +首先,克隆 git 仓库,使用以下命令: +``` +$ git clone https://github.com/alexanderepstein/Bash-Snippets + +``` + +进入目录: +``` +$ cd Bash-Snippets/ + +``` + +切换到最新的稳定版本: +``` +$ git checkout v1.22.0 + +``` + +最后,使用以下命令安装 Bash-Snippets: +``` +$ sudo ./install.sh + +``` + +这将询问你要安装哪些脚本。只需输入**Y** 并按 ENTER 键即可安装相应的脚本。如果你不想安装某些特定脚本,输入 **N** 并按 Enter 键。 +``` +Do you wish to install currency [Y/n]: y + +``` + +要安装所有脚本,运行: +``` +$ sudo ./install.sh all + +``` + +要安装特定的脚本,比如 currency,运行: +``` +$ sudo ./install.sh currency + +``` + +你也可以使用 [**Linuxbrew**][1] 包管理器来安装它。 + +安装所有的工具,运行: +``` +$ brew install bash-snippets + +``` + +安装特定的工具: +``` +$ brew install bash-snippets --without-all-tools --with-newton --with-weather + +``` + +另外,对于那些基于 Debian 系统的,例如 Ubuntu, Linux Mint,可以添加 PPA 源: +``` +$ sudo add-apt-repository ppa:navanchauhan/bash-snippets +$ sudo apt update +$ sudo apt install bash-snippets + +``` + +#### 用法 + +**需要网络连接**才能使用这些工具。用法很简单。让我们来看看如何使用其中的一些脚本,我假设你已经安装了所有脚本。 + +**1\. Currency – 货币转换器** + +这个脚本根据实时汇率转换货币。输入当前货币代码和要交换的货币,以及交换的金额,如下所示: +``` +$ currency +What is the base currency: INR +What currency to exchange to: USD +What is the amount being exchanged: 10 + +========================= +| INR to USD +| Rate: 0.015495 +| INR: 10 +| USD: .154950 +========================= + +``` + +你也可以在单条命令中传递所有参数,如下所示: +``` +$ currency INR USD 10 + +``` + +参考以下屏幕截图: + +[![Bash-Snippets][2]][3] + +**2\. Stocks – 显示股票价格详细信息** + +如果你想查看一只股票价格的详细信息,输入股票即可,如下所示: +``` +$ stocks Intel + +INTC stock info +============================================= +| Exchange Name: NASDAQ +| Latest Price: 34.2500 +| Close (Previous Trading Day): 34.2500 +| Price Change: 0.0000 +| Price Change Percentage: 0.00% +| Last Updated: Jul 12, 4:00PM EDT +============================================= + +``` + +上面输出了 **Intel 股票** 的详情。 + +**3\. Weather – 显示天气详细信息** + +让我们查看以下天气详细信息,运行以下命令: +``` +$ weather + +``` + +**示例输出:** + +![][4] + +正如你在上面屏幕截图中看到的那样,它提供了 3 天的天气预报。不使用任何参数的话,它将根据你的 IP 地址显示天气详细信息。你还可以显示特定城市或国家/地区的天气详情,如下所示: +``` +$ weather Chennai + +``` + +同样,你可以查看输入以下命令来从查看月相(月亮的形态): +``` +$ weather moon + +``` + +示例输出: + +![][5] + +**4\. Crypt – 加解密文件** + +此脚本对 openssl 做了一层包装,允许你快速轻松地加密和解密文件。 + +要加密文件,使用以下命令: +``` +$ crypt -e [original file] [encrypted file] + +``` + +例如,以下命令将加密 **ostechnix.txt**,并将其保存在当前工作目录下,名为 **encrypt_ostechnix.txt**。 +``` +$ crypt -e ostechnix.txt encrypt_ostechnix.txt + +``` + +输入两次文件密码: +``` +Encrypting ostechnix.txt... +enter aes-256-cbc encryption password: +Verifying - enter aes-256-cbc encryption password: +Successfully encrypted + +``` + +上面命令将使用 **AES 256 位密钥**加密给定文件。密码不会以纯文本格式保存。你可以加密 .pdf, .txt, .docx, .doc, .png, .jpeg 类型的文件。 + +要解密文件,使用以下命令: +``` +$ crypt -d [encrypted file] [output file] + +``` + +例如: +``` +$ crypt -d encrypt_ostechnix.txt ostechnix.txt + +``` + +输入密码解密: +``` +Decrypting encrypt_ostechnix.txt... +enter aes-256-cbc decryption password: +Successfully decrypted + +``` + +**5\. Movies – 查看电影详情** + +使用这个脚本,你可以查看电影详情。 + +以下命令显示了一部名为 “mother” 的电影的详情: +``` +$ movies mother + +================================================== +| Title: Mother +| Year: 2009 +| Tomato: 95% +| Rated: R +| Genre: Crime, Drama, Mystery +| Director: Bong Joon Ho +| Actors: Hye-ja Kim, Bin Won, Goo Jin, Je-mun Yun +| Plot: A mother desperately searches for the killer who framed her son for a girl's horrific murder. +================================================== + +``` + +**6\. 显示类似条目** + +要使用这个脚本,你需要从**[这里][6]** 获取 API 密钥。不过不用担心,它完全是免费的。一旦你获得 API 密钥后,将以下行添加到 **~/.bash_profile**:**export TASTE_API_KEY=”你的 API 密钥放在这里”** + +现在你可以查看类似的项目,如提供的项目,如下所示:(to 校正者:不理解这个脚本的意思肿么办) +``` +$ taste -i Red Hot Chilli Peppers + +``` + +**7\. Short – 缩短 URL** + +这个脚本会缩短给定的 URL。 +``` +$ short + +``` + +**8\. Geo – 显示网络的详情** + + +这个脚本会帮助你查找网络的详细信息,例如 wan, lan, router, dns, mac 和 ip 地址。 + +例如,要查找你的局域网 ip,运行: +``` +$ geo -l + +``` + +我系统上的输出: +``` +192.168.43.192 + +``` + +查看广域网 ip: +``` +$ geo -w + +``` + +在终端中输入 `geo` 来查看更多详细信息。 +``` +$ geo +Geo +Description: Provides quick access for wan, lan, router, dns, mac, and ip geolocation data +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 +Examples: + geo -g + geo -wlrdgm eth0 +Custom Geo Output => +[all] [query] [city] [region] [country] [zip] [isp] +Example: geo -a 8.8.8.8 -o city,zip,isp + -o [options] Returns Specific Geodata + -a [address] For specific ip in -s + -v Returns Version + -h Returns Help Screen + -u Updates Bash-Snippets + +``` + +**9\. Cheat – 显示 Linux 命令的备忘单** + +想参考 Linux 命令的备忘单吗?这是可能的。以下命令将显示 **curl** 命令的备忘单: +``` +$ cheat curl + +``` + +只需用你选择的命令替换 **curl** 即可显示其备忘单。这对于快速参考你要使用的任何命令非常有用。 + +**10\. Youtube-Viewer – 观看 YouTube 视频** + +使用此脚本,你可以直接在终端上搜索或观看 YouTube 视频。 + +让我们来看一些有关 **Ed Sheeran** 的视频。 +``` +$ ytview Ed Sheeran + +``` + +从列表中选择要播放的视频。所选内容将在你的默认媒体播放器中播放。 + +![][7] + +要查看艺术家的近期视频,你可以使用: +``` +$ ytview -c [channel name] + +``` + +要寻找视频,只需输入: +``` +$ ytview -s [videoToSearch] + +``` + +或者: +``` +$ ytview [videoToSearch] + +``` + +**11\. cloudup – 备份p GitHub 仓库到 bitbucket** + +你在 GitHub 上托管过任何项目吗?如果托管过,那么你可以随时间 GitHub 仓库备份到 **bitbucket**,它是一种用于源代码和开发项目的基于 Web 的托管服务。 + +你可以使用 **-a** 选项一次性备份指定用户的所有 GitHub 仓库,或者不使用它来备份单个仓库。 + +要备份 GitHub 仓库,运行: +``` +$ cloudup + +``` + +系统将要求你输入 GitHub 用户名, 要备份的仓库名称以及 bitbucket 用户名和密码等。 + +**12\. Qrify – 将字符串转换为二维码** + +这个脚本将任何给定的文本字符串转换为二维码。这对于发送链接或者保存一串命令到手机非常有用。 +``` +$ qrify convert this text into qr code + +``` + +示例输出: + +![][8] + +很酷,不是吗? + +**13\. Cryptocurrency** + +它将显示十大加密货币实时汇率。 + +输入以下命令,然后单击 ENTER 来运行: +``` +$ cryptocurrency + +``` + +![][9] + + +**14\. Lyrics** + +这个脚本从命令行快速获取一首歌曲的歌词。 + +例如,我将获取 **“who is it”** 歌曲的歌词,这是一首由 **Michael Jackson(迈克尔·杰克逊)** 演唱的流行歌曲。 +``` +$ lyrics -a michael jackson -s who is it + +``` + +![][10] + +**15\. Meme** +这个脚本允许你从命令行创建简单的表情包。它比基于 GUI 的表情包生成器快得多。 + +要创建一个表情包,只需输入: +``` +$ meme -f mymeme +Enter the name for the meme's background (Ex. buzz, doge, blb ): buzz +Enter the text for the first line: THIS IS A +Enter the text for the second line: MEME + +``` + +这将在你当前的工作目录创建 jpg 文件。 + +**16\. Newton** + +厌倦了解决复杂的数学问题?你来对了。Newton 脚本将执行数值计算,直到符号数学解析。(to 校正者:这里不太理解) + +![][11] + +**17\. Siteciphers** + +这个脚本可以帮助你检查在给定的 https 站点上启用/禁用哪些密码。 +``` +$ siteciphers google.com + +``` + +![][12] + +**18\. Todo** + +它允许你直接从终端创建日常任务。 + +让我们来创建一些任务。 +``` +$ todo -a The first task +01). The first task Tue Jun 26 14:51:30 IST 2018 + +``` + +要添加其它任务,只需添加任务名称重新运行上述命令即可。 +``` +$ todo -a The second task +01). The first task Tue Jun 26 14:51:30 IST 2018 +02). The second task Tue Jun 26 14:52:29 IST 2018 + +``` + +要查看任务列表,运行: +``` +$ todo -g +01). The first task Tue Jun 26 14:51:30 IST 2018 +02). A The second task Tue Jun 26 14:51:46 IST 2018 + +``` + +一旦你完成了任务,就可以将其从列表中删除,如下所示: +``` +$ todo -r 2 +Sucessfully removed task number 2 +01). The first task Tue Jun 26 14:51:30 IST 2018 + +``` + +要清除所有任务,运行: +``` +$ todo -c +Tasks cleared. + +``` + +**19\. Transfer** + +Transfer 脚本允许你通过 Internet 快速轻松地传输文件和目录。 + +让我们上传一个文件: +``` +$ transfer test.txt +Uploading test.txt +################################################################################################################################################ 100.0% +Success! +Transfer Download Command: transfer -d desiredOutputDirectory ivmfj test.txt +Transfer File URL: https://transfer.sh/ivmfj/test.txt + +``` + +该文件将上传到 transfer.sh 站点。Transfer.sh 允许你一次上传最大 **10 GB** 的文件。所有共享文件在 **14 天**后自动过期。如你所见,任何人都可以通过 Web 浏览器访问 URL 或使用 transfer 目录来下载文件,当然,transfer 必须安装在他/她的系统中。 + +现在从你的系统中移除文件。 +``` +$ rm -fr test.txt + +``` + +现在,你可以随时(14 天内)从 transfer.sh 站点下载该文件,如下所示: +``` +$ transfer -d Downloads ivmfj test.txt + +``` + +获取关于此实用脚本的更多详情,参考以下指南。 +* [从命令行在 Internet 上共享文件的一个简单快捷方法](https://www.ostechnix.com/easy-fast-way-share-files-internet-command-line/) + +##### 获得帮助 + +如果你不知道如何使用特定脚本,只需输入该脚本的名称,然后按下 ENTER 键,你将会看到使用细节。以下示例显示 **Qrify** 脚本的帮助信息。 +``` +$ qrify +Qrify +Usage: qrify [stringtoturnintoqrcode] +Description: Converts strings or urls into a qr code. + -u Update Bash-Snippet Tools + -m Enable multiline support (feature not working yet) + -h Show the help + -v Get the tool version +Examples: + qrify this is a test string + qrify -m two\\nlines + qrify github.com # notice no http:// or https:// this will fail + +``` + +#### 更新脚本 + +你可以随时使用 -u 选项更新已安装的工具。以下命令更新 “weather” 工具。 +``` +$ weather -u + +``` + +#### 卸载 + +你可以使用以下命令来卸载这些工具。 + +克隆仓库: +``` +$ git clone https://github.com/alexanderepstein/Bash-Snippets + +``` + +进入 Bash-Snippets 目录: +``` +$ cd Bash-Snippets + +``` + +运行以下命令来卸载脚本: +``` +$ sudo ./uninstall.sh + +``` + +输入 **y**,并按下 ENTER 键来移除每个脚本。 +``` +Do you wish to uninstall currency [Y/n]: y + +``` + +**另请阅读:** + +好了,这就是全部了。我必须承认,在测试这些脚本时我印象很深刻。我真的很喜欢将所有有用的脚本组合到一个包中的想法。感谢开发者。试一试,你不会失望的。 + +干杯! + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/collection-useful-bash-scripts-heavy-commandline-users/ + +作者:[SK][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.ostechnix.com/author/sk/ +[1]:https://www.ostechnix.com/linuxbrew-common-package-manager-linux-mac-os-x/ +[3]:http://www.ostechnix.com/wp-content/uploads/2017/07/sk@sk_001.png +[4]:http://www.ostechnix.com/wp-content/uploads/2017/07/sk@sk_002-1.png +[5]:http://www.ostechnix.com/wp-content/uploads/2017/07/sk@sk_003.png +[6]:https://tastedive.com/account/api_access +[7]:http://www.ostechnix.com/wp-content/uploads/2017/07/ytview-1.png +[8]:http://www.ostechnix.com/wp-content/uploads/2017/07/sk@sk_005.png +[9]:http://www.ostechnix.com/wp-content/uploads/2017/07/cryptocurrency.png +[10]:http://www.ostechnix.com/wp-content/uploads/2017/07/lyrics.png +[11]:http://www.ostechnix.com/wp-content/uploads/2017/07/newton.png +[12]:http://www.ostechnix.com/wp-content/uploads/2017/07/siteciphers.png