Two Linux magic tools that Java developers must master

<font color='blue'>Zi said: "If you want to do good things, you must first use the tools."</font>

Be a positive person
Code, bug fix, improve yourself
I have a park for programming, spring blossom!

Learning should be happy. In this park, I try my best to explain knowledge or technology with simple and easy-to-understand (funny) expressions, so that the learning journey will be fun. This is the beginning of blogging.

Story narration:

In Harry Potter movies, each wizard has his own magic wand, which is used to perform magic.Today we will also learn to use magic wands (tools) to perform our magic.

Magic Map:

1. Magic List Memo Tool-cheat

Cheat allows you to create and view interactive memos on the command line.It helps * nix system administrators to remind them of command options they often use, but don't remember them often.We can also build our own Magic List memo through cheat. Here's how to install and use it:

# 1. Install wget
[root@localhost ~]# yum -y install wget
...Installation process log omission
# 2. Run the command to install pip:
[root@localhost ~]# wget https://bootstrap.pypa.io/get-pip.py
...Installation process log omission
[root@localhost ~]# python get-pip.py
...Installation process log omission
# 3. Use pip to install cheat:https://github.com/cheat/cheat/wiki/Installing
# 3.1 pip is the recommended installation method for most users.Simply run:
[root@localhost ~]# pip install cheat
... Installation process log omission
Successfully
# Or use the pip install --user cheat command

# 3.2 Then add to PATH including $HOME/.local/bin:
[root@localhost ~]# echo $HOME
/root
[root@localhost ~]# export PATH="root/.local/bin:$PATH"
[root@localhost ~]# echo $PATH
root/.local/bin:/usr/local/java/jdk1.8.0_191/bin:/usr/local/java/jdk1.8.0_191/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

# 4. Use cheat and find it unavailable. Look down
[root@localhost ~]# cheat tar
No cheatsheet found for tar
[root@localhost ~]# cheat mv
No cheatsheet found for mv

# The value of a cheat sheet is that it allows you to create your own memo - the default value is used only as a starting point and can and should be modified.
# Cheatsheets are stored in the /.cheat/directory and named as each keyword.
# In other words, the contents of the tar cheatsheet are in the /.cheat/tar file.~: Indicates home directory!

# 5. Add your Cheatsheets
[root@localhost ~]# cd .cheat/
[root@localhost .cheat]# ll
//Total dosage 0
[root@localhost .cheat]# touch tar
[root@localhost .cheat]#  vim tar 
#Add the corresponding content, look down
[root@localhost .cheat]# ll
-rw-r--r--. 1 root root 770 3 January 1622:50 tar
[root@localhost .cheat]# The following are
# 6. View the tar memo
[root@localhost .cheat]# cheat tar 
p or bzip. 
#
#Create an archive from a file:
   tar -cf target.tar file1 file2 file3
#
#Create a gzip Compressed file:
   tar -czf target.tar.gz file1 file2 file3
#
#Unzip archives in the target directory:
   tar -xf source.tar -C Catalog
#
#Unzip from the current directory gzip Compressed file:
   tar -xzf source.tar.gz
#
#Unzip from the current directory bzip Compressed file:
   tar -xjf source.tar.bz2
#
#Create a compressed archive and use the archive suffix to determine the compressor:
   tar -caf target.tar.xz file1 file2 file3
#
#list tar Contents of the file:
   tar -tvf source.tar

In this way, add your own cheating memo list.In fact, the memo can also be highlighted in grammar, which I have time to study later.

cheat github address: https://github.com/cheat/cheat

2. Document Query Magic Tool-cheat.sh

If we want a magic tool, an ideal memo, imagine it.What should it be?What functions should I have?

  • Simplicity - It should contain only what you need, not anything else.
  • Fast - It should be ready to use.Full - it should contain answers to every possible question.
  • Universal - It should be available anytime, anywhere, without any preparation.Not noticeable - it should not distract your main tasks.
  • Tutorial - It should help you with this course.
  • Not conspicuous - should be able to use it completely unnoticed.

The cheat.sh described below is such a powerful magic tool, let's see its features together!

Characteristic:

  • There is a simple curl/browser interface.
  • Covers 55 programming languages, multiple DBMS s, and more than 1000 of the most important UNIX / Linux commands.
  • Provides access to the world's best community-driven memo repository, the same as StackOverflow.
  • It is available everywhere and does not require installation.
  • Ultra fast, usually returning the answer in 100 milliseconds.
  • With a convenient command line client, cht.sh is very helpful, though not mandatory.
  • It can be used directly in a code editor without opening a browser without switching the psychological context.
  • Supports a special invisible mode that can be used completely invisibly without touching keys and making sounds.

1. Online Web Page Edition

cheat.sh : https://cheat.sh/ , a command line document query site, as shown in the figure

For example, query the web page for the use of grep magic:

2. Server Client

To get a memo for UNIX / Linux commands from the command line, use curl or any other HTTP / HTTPS client query service that specifies the command name in the query:

curl cheat.sh/tar
curl cht.sh/curl
curl https://cheat.sh/rsync
curl https://cht.sh/tr

As shown above, you can use HTTPS and HTTP to access the service, along with the long (cheat.sh) and short (cht.sh) service names!

For example:

# View grep memo and web page alignment
[root@localhost ~]# curl cheat.sh/grep
# Search a file for a pattern
grep pattern file
.... Omit other content
ps aux | grep -E --color 'bash|$'
[root@localhost ~]# 

Cheat.sh: GitHub address: https://github.com/chubin/che...

3. Summary

This article introduces two magic widgets on github. If you use these two magic widgets well, they will certainly improve your work efficiency and enable you to learn more through magic tools. The above article is only a simple description and use, especially the cheat.sh magic tool, which has a lot of functions.And it's also powerful!<font color='red'>To learn magic, we need to learn good magic. To use tools, we also need to use tools to improve efficiency, not black magic and tools.</font>

Recommended reading

Linux commands that Java developers must master (1)
Linux commands that Java developers must master (2)
Linux commands that Java developers must master (3)
Two Linux magic tools that Java developers must master (4)
Linux commands that Java developers must master - Learn to use (5)

Thank you for reading. If you think this blog post is helpful to you, please comment on it or like it so that more people can see it!Have a good day!

<center><font color='red'>Java programming technology park</font>: A public number for sharing programming knowledge.Follow the old driver and make a little progress every day.</center>
<p/>
<center><font color='blue'>Scan attention, reply back to [resources] to get the dried goods!99.9% of partners like </font></center>
<p/>

<center>Feiyun is getting better every day</center>

Keywords: Linux curl Java pip

Added by NTGr on Thu, 25 Jul 2019 03:07:47 +0300