In the next article we are going to take a look at Wgetpaste. If you've ever had the need to share code snippets, the first service you think of may be Pastebin.com. In addition to this, today we can find several alternative services to share text.
If you share your code often using services similar to Pastebin, you will find Wgetpaste very useful. It is a command-line BASH utility to easily load text snippets into pastebin-like services. Using the Wgetpaste script, anyone can quickly share snippets of text from the Command line on Unix-like systems.
Install Wgetpaste
If you are interested in trying this application, you will see that any user will be able to download this utility from project website wgetpaste. Then you just have to install it manually as described below.
First open a terminal (Ctrl + Alt + T) and download the latest tar file from Wgetpaste:
wget http://wgetpaste.zlin.dk/wgetpaste-2.28.tar.bz2
Extract it typing:
tar -xjvf wgetpaste-2.28.tar.bz2
After head over to the directory:
cd wgetpaste-2.28/
Now you just have to copy the binary from wgetpaste to your $ PATH, for example / usr / local / bin /.
sudo cp wgetpaste /usr/local/bin/
Finish by doing the executable file:
sudo chmod +x /usr/local/bin/wgetpaste
Load text snippets with Wgetpaste
Upload text files
To load a text file, just run:
wgetpaste mi-texto.txt
This command will load the contents of the my-text.txt file.
It can share the generated url via any medium like mail, message, etc. Whoever receives this URL will be able to see the content of the file from their web browser.
It also can see what is going to be uploaded. To do so, use the -t option as it's shown in the following:
wgetpaste -t mi-texto.txt
Upload text snippets to different services
By default, Wgetpaste will load the text fragments into the poundpython service, but there is more. To see the list of supported services, run:
wgetpaste -S
The * indicates the default service.
As you can see, Wgetpaste currently supports five text sharing services. I didn't try all of them, but all three options that I did try worked fine.
For upload content to other services, for example dpaste.com, just use the -s option in the command:
wgetpaste -s dpaste mi-texto.txt
Read input from stdin
Wgetpaste can also read input from stdin.
uname -a | wgetpaste
This command will load the output of the command 'uname -a'.
Load COMMAND and COMMAND output together
Sometimes it may be necessary to paste a COMMAND and its output. To do this, enclose the content of the command in quotation marks:
wgetpaste -c ‘pwd’
With this option will load the 'pwd' command along with its output. This can be useful when we want others to clearly know what the exact command we just ran and its output is.
Set language
By default, Wgetpaste will load text snippets in plain text. For list the languages supported by the default service, you can use the -L option.
wgetpaste -L
This command will list all the languages supported by the default service, i.e. poundpython.
We can change this using -l option.
wgetpaste -l Bash mi-texto.txt
Turn off syntax or html highlighting in output
As I mentioned earlier, the text snippets will be displayed in a specific language format (plain text, bash, etc.). However, we will be able to change this behavior to display the plain text snippets, with the -r option.
wgetpaste -r mi-texto.txt
As you can see from the output above, there is no syntax highlighting, no html formatting. Just one raw output.
Change the default values of Wgetpaste
All defaults can be changed globally in /etc/wgetpaste.conf or in the user's folder, in the file ~ / .wgetpaste.conf.
These files are not available by default on my Ubuntu system. I guess you need to create them manually. Sample content for both files has been made available to everyone by the developer here y here.
If the new configuration does not convince you, you are always in time either to change it yourself or to delete these two files that you just created. Wgetpaste will go back to working with the default values.
Get help
To show the help section, run:
wgetpaste -h