Thursday, July 20, 2017

Seashells – Pipe Your Linux Command’s Output To Web In Real-time

Seashells – Pipe Your Linux Command’s Output To Web In Real-time

Important – Read before before using it

  • Seashells is currently in beta stage. Please don’t use it for any uptime-critical applications.
  • It is not a data storage medium. All old sessions (links) will be deleted after a day.
  • Seashells doesn’t have any account system yet, so each IP address is limited to 5 concurrent sessions.

Using Seashells.io

Like I already said, you don’t have to install anything to use Seashells web service. Just pipe your Linux command’s output to “nc seashells.io 1337” as shown below. As you might already know, nc(netcat) comes pre-installed in most Linux operating systems.
Say for example, I am going to pipe the output of ‘echo’ command as shown below.
echo 'Welcome To OSTechNix!' | nc seashells.io 1337
Sample output would be:
serving at https://seashells.io/v/ckWCBZbA
Now, your command’s output using the above URL on any web browser.
Seashells
Cool, isn’t it? It’s just an example. You can pipe the output of any Linux command or program that takes a long time to complete.

Install Seashells Client

If you use Seashells often, it is recommended to install the Seashells client.
Seashells client is written using Python. So, it can be easily installed using pip utility. To install pip in your Linux distribution, do the following steps.
To install PIP on Arch Linux and its derivatives, run:
sudo pacman -S python-pip
On RHEL, Fedora, CentOS:
sudo yum install epel-release
sudo yum install python-pip
Or,
sudo dnf install epel-release
sudo dnf install python-pip
On Debian, Ubuntu, Linux Mint:
sudo apt-get install python-pip
Once PIP installed, run the following command to install ‘Seashells’.
sudo pip install seashells

Using Seashells Client

Once you have the client installed, you don’t have to pipe the output to “nc seashells.io 1337”. Instead, you can directly pipe the output to seashells. The client has some additional features, such as showing output on stdout as well as forwarding to Seashells.
Now, let me pipe the ls command’s output:
ls -al | seashells
Sample output from my system:
serving at https://seashells.io/v/Jba3TUv2
total 36
drwxr-xr-x 3 sk sk 4096 Jul 17 15:18 .
drwxr-xr-x 3 root root 4096 Jun 6 2016 ..
-rw------- 1 sk sk 589 Jul 11 18:43 .bash_history
-rw-r--r-- 1 sk sk 220 Jun 6 2016 .bash_logout
-rw-r--r-- 1 sk sk 3771 Jun 6 2016 .bashrc
drwx------ 3 sk sk 4096 Jul 17 15:17 .cache
-rw-r--r-- 1 sk sk 5123 Jul 11 18:24 client.ovpn
-rw-r--r-- 1 sk sk 675 Jun 6 2016 .profile
-rw-r--r-- 1 sk sk 0 Jun 6 2016 .sudo_as_admin_successful
Now, your friend can view the above command’s output using URL: https://seashells.io/v/Jba3TUv2.
Seashells output in browser
If you want to display the output in plain text, replace, replace the /v/{url} (for view) with /p/{url} (p for plain text). For example, we can pipe the above command’s output as plain text using URL – https://seashells.io/p/Jba3TUv2.
Seashells2
Please note that I have replaced the letter “v” with “p” in the URL.
You can delay the command’s output with –delay switch.
htop | seashells --delay 5
The above command will wait for 5 seconds before displaying the output.
Seashells
For more details about Seashells usage, run:
seashells --help
Have you got a long-running program on your remote system? Just keep an eye on it from your local system using Seashells. I hope this tool will help you in someway. I will be soon here with another helpful article. Until then, stay tuned with OSTechNix.
Cheers!
Resource: 

No comments: