Shellshare: Difference between revisions

From ICO wiki
Jump to navigationJump to search
 
(10 intermediate revisions by the same user not shown)
Line 8: Line 8:


==Paigaldamine==
==Paigaldamine==
'''Uusima shellshare'i versiooni kiire paigaldus Linuxis'''
'''Uusima shellshare'i versiooni kiire paigaldus Linuxis kestprogrammi [https://en.wikipedia.org/wiki/Bash_(Unix_shell) Bash] korral'''
  mkdir -p ~/.local/bin/ && wget -q --show-progress https://raw.githubusercontent.com/vitorbaptista/shellshare/master/public/bin/shellshare -O ~/.local/bin/shellshare && chmod u+x ~/.local/bin/shellshare
  mkdir -p ~/.local/bin/ && wget -q --show-progress https://raw.githubusercontent.com/vitorbaptista/shellshare/master/public/bin/shellshare -O ~/.local/bin/shellshare && chmod u+x ~/.local/bin/shellshare


Line 32: Line 32:


==Edastamine==
==Edastamine==
* käsurea (peaaegu) reaalajas edastamise alustamiseks:
Kui Ubuntus puudub link '''python''', mis viitaks uusimale paigaldatud python'i versioonile, siis tuleb see luua.
<syntaxhighlight lang="python">
Vaatame, mis on olemas: kirjutada '''python''' ja vajutada vähemalt 2x kiirelt TAB-klahvi. Kui pakutute hulgas puudub '''python''', siis on vastav symlink vaja luua:
python /asukoht/shellshare.py --server http://linux.itcollege.ee:3000 --room ruuminimi --password salasõna
sudo ln -s /usr/bin/python3 /usr/bin/python
</syntaxhighlight>
 
Käsurea (peaaegu) reaalajas edastamise alustamiseks:
* kiire lahendus
shellshare
See käivitab juhuslikult loodud räsiga aadressi, nähtav https://shellshare.net/r/<räsi>
* saab ka ette anda ruumi ja salasõna
shellshare --room ruuminimi --password salasõna
Siis on see nähtav aadressil https://shellshare.net/r/ruuminimi
 
IT Kolledži serveri kaudu edastamine:
shellshare --server http://linux.itcollege.ee:3000 --room ruuminimi --password salasõna
Siis on see nähtav aadressil http://linux.itcollege.ee:3000/r/ruuminimi
* asendada
* asendada
** ''asukoht'' tegeliku ''shellshare.py'' asukohaga arvuti kõvakettal
** ''asukoht'' tegeliku ''shellshare.py'' asukohaga arvuti kõvakettal
** ''ruuminimi'' soovitud nimega
** ''ruuminimi'' soovitud nimega
** ''salasõna'' soovitud salasõnaga
** ''salasõna'' soovitud salasõnaga
* terminali edastamine on nähtav peale ülalnimetatud käsu käivitamist käsureal näidatud aadressil '''http://linux.itcollege.ee:3000/r/ruuminimi''' kus ''ruuminimi'' asemel on valitud nimetus
* veebi edastatud käsud on kopeeritavad, ajalugu vaadatav tagasi kerides (ei ole soovitav käsurida vahepeal puhastada)
* veebi edastatud käsud on kopeeritavad, ajalugu vaadatav tagasi kerides (ei ole soovitav käsurida vahepeal puhastada)
* ka käsureal avatavad failid, man-lehed jne on kuvatavad; liikumine, klaviatuuri abil teksti märkimine kuvatakse ka veebivoos
* ka käsureal avatavad failid, man-lehed jne on kuvatavad; liikumine, klaviatuuri abil teksti märkimine kuvatakse ka veebivoos


Toetatud on ka mitmest terminalist korraga samale aadressile käsurea edastamine - nii on võimalik samaaegselt edastada käsurida klassiarvutist, [https://et.wikipedia.org/wiki/Virtuaalmasin virtuaalmasinast] jne korraga samale sessioonile - nii on õppuri jaoks info ühes kohas. Info tuleb ära kopeerida, sest edastamise lõppemisel ja akna sulgemisel ajalugu ei säili.
Toetatud on ka mitmest terminalist korraga samale aadressile käsurea edastamine - nii on võimalik samaaegselt edastada käsurida klassiarvutist, [https://et.wikipedia.org/wiki/Virtuaalmasin virtuaalmasinast] jne korraga samale sessioonile - nii on õppuri jaoks info ühes kohas. Info tuleb ära kopeerida, sest edastamise lõppemisel ja akna sulgemisel ajalugu ei säili.
Kui kirjutada:
<syntaxhighlight lang="python">
python /asukoht/shellshare.py --room ruuminimi --password salasõna
</syntaxhighlight>
... siis edastatakse ''shellshare.net'' serveri kaudu kui see töötab.


==Kiire kasutamine==
==Kiire kasutamine==
Line 77: Line 79:
==Setup==
==Setup==


'''Quick install for newest version of shellshare in Linux'''
'''Quick install for newest version of shellshare in Linux in case of [https://en.wikipedia.org/wiki/Bash_(Unix_shell) Bash] shell'''
  mkdir -p ~/.local/bin/ && wget -q --show-progress https://raw.githubusercontent.com/vitorbaptista/shellshare/master/public/bin/shellshare -O ~/.local/bin/shellshare && chmod u+x ~/.local/bin/shellshare
  mkdir -p ~/.local/bin/ && wget -q --show-progress https://raw.githubusercontent.com/vitorbaptista/shellshare/master/public/bin/shellshare -O ~/.local/bin/shellshare && chmod u+x ~/.local/bin/shellshare


Line 84: Line 86:
Please replace ''shortname, roomname, roompassword'' with appropriate values, you wish to use.
Please replace ''shortname, roomname, roompassword'' with appropriate values, you wish to use.


For ensuring the used path works in case of [https://en.wikipedia.org/wiki/Bash_(Unix_shell) Bash] there must be in ''~/.bashrc'' following lines:
For ensuring the used path works in case of [https://en.wikipedia.org/wiki/Bash_(Unix_shell) Bash] there must be in ''~/.bashrc'' the following lines:
  # set PATH so it includes user's private bin if it exists
  # set PATH so it includes user's private bin if it exists
  if [ -d "$HOME/.local/bin" ] ; then
  if [ -d "$HOME/.local/bin" ] ; then
Line 101: Line 103:


==Streaming==
==Streaming==
* to start streaming the command-line in (almost) real time:
If Ubuntu does not have a '''python''' link pointing to a newest version of python installed, you need to create one.
<syntaxhighlight lang="python">
Let's see what's there: type '''python''' and press the TAB key at least twice quickly. If '''python''' is not included in the list, you need to create it:
python /location/shellshare.py --server http://linux.itcollege.ee:3000 --room roomname --password qwerty
sudo ln -s /usr/bin/python3 /usr/bin/python
</syntaxhighlight>
* replace
** ''location'' with real ''shellshare.py'' location on computer hard drive
** ''roomname'' with wanted name
** ''qwerty'' with real password
* command-line streaming is visible at '''http://linux.itcollege.ee:3000/r/roomname''' after running mentioned command, where instead of ''roomname'' there is chosen name
* streamed commands online can be copied, history is reviewable by scrolling up (do not clear the screen in command-line)
* also files that can be opened in command-line, man-pages, etc; moving, marking text with keyboard are shown in web stream


Also streaming simultaneously from multiple command-line interfaces to the same address is supported. You can stream from classroom computer, virtual machine, etc to the same session - in that way all information is on the same place. The information should be copied to permanent place because after stopping the streaming and closing the window also history will be gone.
To start (almost) real-time command line streaming:
* fast connection
shellshare
This will launch a randomly generated hashed address, visible at https://shellshare.net/r/<hash>
* you can also specify a room and password
shellshare --room roomname --password password
Then it will be visible at https://shellshare.net/r/roomname


If to write:
Streaming via IT College server:
 
shellshare --server http://linux.itcollege.ee:3000 --room roomname --password password
<syntaxhighlight lang="python">
Then it will be visible at http://linux.itcollege.ee:3000/r/roomname
python /asukoht/shellshare.py --room roomname --password qwerty
* replace
</syntaxhighlight>
** ''roomname'' with the name
** ''password'' with the password
* commands sent to the web are copyable, history can be viewed by scrolling back (it is not recommended to clean the command line while using shellshare)
* files opened on the command line, man pages, etc. are also displayed; movement, text marking using the keyboard are also displayed in the web stream


... then through the ''shellshare.net'' server will be streamed if it works.
Transmitting a command line from multiple terminals to the same address at the same time is also supported - this way it is possible to simultaneously transmit a command line from a class computer, [https://en.wikipedia.org/wiki/Virtual_machine from a virtual machine], etc. to the same session at the same time - this way the information is in one place for the student. The information must be copied, because the history is not preserved when the transmission ends and the window is closed.


==Fast usage==
==Fast usage==

Latest revision as of 08:46, 11 March 2025

Eesti keeles

IT Kolledž: http://linux.itcollege.ee:3000
avalik teenus: https://shellshare.net/

Versioon 1.1.0 lisab MS Windowsi toetuse ilma emuleerimiseta.

Võimalus jagada käsurida Pythoni abil reaalajas veebipõhiselt ja võimaldada õppuritel paremini jälgida tunnis antud käske ja nende väljundit ja vältida ümberkirjutamisest tekkivaid vigu. Võimalus ka virtuaalmasinast otse käsurida edastada. Edastamine toimub vaid vaatamisrežiimis. Kui soovitakse muutmisrežiimis (aka collaborative hacking) siis näiteks vabavaraline upterm võib huvi pakkuda.

Paigaldamine

Uusima shellshare'i versiooni kiire paigaldus Linuxis kestprogrammi Bash korral

mkdir -p ~/.local/bin/ && wget -q --show-progress https://raw.githubusercontent.com/vitorbaptista/shellshare/master/public/bin/shellshare -O ~/.local/bin/shellshare && chmod u+x ~/.local/bin/shellshare
echo "alias lühikäsunimi='shellshare --server http://linux.itcollege.ee:3000 --room ruuminimi --password ruumisalasõna'" >> ~/.bash_aliases && source ~/.bash_aliases

Palun asendada lühikäsunimi, ruuminimi, ruumisalasõna soovitud väärtustega.

Kasutatud otsiteekonna (path) toimimiseks Bash'i korral tuleb jälgida, et ~/.bashrc sisaldaks ridu:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
   PATH="$HOME/.local/bin:$PATH"
fi

~/.bashrc muudatuste jõustamiseks:

source ~/.bashrc

... või siis sulgeda kõik senised terminalide sessioonid ja avada uuesti terminal. Kui on mõni teine kestprogramm kasutusel, siis tuleb jälgida selle seadistuse nõudeid.

Edaspidi piisab terminali avamisest ja saab määratud lühikäsunime sisestades kiirelt kasutada. Selle käivitamisel öeldakse terminalis ka aadress, mille pealt teised siis terminali sisestatud käske näevad, peaaegu reaalajas. Seda aadressi saab aegsasti ka õppuritele jagada, mida tunni ajal siis avada saab.

  • skripti allalaadimine https://github.com/vitorbaptista/shellshare/releases - valida Latest Release
    • on olemas ka programmi koduleht kus allalaadimise viide kuid võib juhtuda, et see ei tööta
  • lahtipakitud kaustast leiab skripti public/bin/shellshare - selle võib ka ringi nimetada shellshare.py ja kopeerida endale meelepärasesse asukohta, võib paralleelselt ka sobivasse kohta veebis paigutada, et kiirelt näiteks virtuaalmasinasse alla laadida

Edastamine

Kui Ubuntus puudub link python, mis viitaks uusimale paigaldatud python'i versioonile, siis tuleb see luua. Vaatame, mis on olemas: kirjutada python ja vajutada vähemalt 2x kiirelt TAB-klahvi. Kui pakutute hulgas puudub python, siis on vastav symlink vaja luua:

sudo ln -s /usr/bin/python3 /usr/bin/python

Käsurea (peaaegu) reaalajas edastamise alustamiseks:

  • kiire lahendus
shellshare

See käivitab juhuslikult loodud räsiga aadressi, nähtav https://shellshare.net/r/<räsi>

  • saab ka ette anda ruumi ja salasõna
shellshare --room ruuminimi --password salasõna

Siis on see nähtav aadressil https://shellshare.net/r/ruuminimi

IT Kolledži serveri kaudu edastamine:

shellshare --server http://linux.itcollege.ee:3000 --room ruuminimi --password salasõna

Siis on see nähtav aadressil http://linux.itcollege.ee:3000/r/ruuminimi

  • asendada
    • asukoht tegeliku shellshare.py asukohaga arvuti kõvakettal
    • ruuminimi soovitud nimega
    • salasõna soovitud salasõnaga
  • veebi edastatud käsud on kopeeritavad, ajalugu vaadatav tagasi kerides (ei ole soovitav käsurida vahepeal puhastada)
  • ka käsureal avatavad failid, man-lehed jne on kuvatavad; liikumine, klaviatuuri abil teksti märkimine kuvatakse ka veebivoos

Toetatud on ka mitmest terminalist korraga samale aadressile käsurea edastamine - nii on võimalik samaaegselt edastada käsurida klassiarvutist, virtuaalmasinast jne korraga samale sessioonile - nii on õppuri jaoks info ühes kohas. Info tuleb ära kopeerida, sest edastamise lõppemisel ja akna sulgemisel ajalugu ei säili.

Kiire kasutamine

Võimalus teha ka lühikäsk ehk alias (vt Alias bash shellis, .bash_aliases), skript vms käsurea jagamise kiireks käivitamiseks soovitud ruuminimega

Edastamise lõpetamine

Käsurea edastamise lõpetamine: exit+Enter, sageli toimib ka CTRL+D

Erilised tänud

Erilised tänud TalTechi IT Kolledži Linuxi administraatorile Veiko Tuul serveripoole käivitamise ja selle suurepärase võimaluse loomise eest!

Viited

in English

IT College: http://linux.itcollege.ee:3000
public service: https://shellshare.net/

Version 1.1.0 adds MS Windows support without emulation.

There is an option to share command-line over Internet in real time using Python. This allows for students to follow lecturer commands and its output and avoid mistakes of rewriting commands. Streaming is going only in read-only mode. If there is edit mode needed (aka collaborative hacking) then probably free and open-source upterm is one of the choices you may be interested in.

Setup

Quick install for newest version of shellshare in Linux in case of Bash shell

mkdir -p ~/.local/bin/ && wget -q --show-progress https://raw.githubusercontent.com/vitorbaptista/shellshare/master/public/bin/shellshare -O ~/.local/bin/shellshare && chmod u+x ~/.local/bin/shellshare
echo "alias shortname='shellshare --server http://linux.itcollege.ee:3000 --room roomname --password roompassword'" >> ~/.bash_aliases && source ~/.bash_aliases

Please replace shortname, roomname, roompassword with appropriate values, you wish to use.

For ensuring the used path works in case of Bash there must be in ~/.bashrc the following lines:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
   PATH="$HOME/.local/bin:$PATH"
fi

for applying changes in ~/.bashrc:

source ~/.bashrc

... or close all existing Bash terminal sessions and reopen the terminal. If there is any other shell in use, then its configuration requirements must be followed.

From now on, it is enough to open the terminal and you can quickly use it by entering the specified short command name. When started, the terminal also says the address from which others can then see the commands entered in the terminal, in near real time. This address can also be shared with students in a timely manner, which students can then open during class.

  • download the appropriate script at https://github.com/vitorbaptista/shellshare/releases - choose Latest Release
    • there is also program homepage where download command is described but it might happen that the site is offline
  • from unpacked folder there can be found the script in public/bin/shellshare - this can be renamed to shellshare.py and copy whenever needed. There is also possible to copy unpacked shellshare script to somewhere in the web so you can quickly download e.g. into virtual machine.

Streaming

If Ubuntu does not have a python link pointing to a newest version of python installed, you need to create one. Let's see what's there: type python and press the TAB key at least twice quickly. If python is not included in the list, you need to create it:

sudo ln -s /usr/bin/python3 /usr/bin/python

To start (almost) real-time command line streaming:

  • fast connection
shellshare

This will launch a randomly generated hashed address, visible at https://shellshare.net/r/<hash>

  • you can also specify a room and password
shellshare --room roomname --password password

Then it will be visible at https://shellshare.net/r/roomname

Streaming via IT College server:

shellshare --server http://linux.itcollege.ee:3000 --room roomname --password password

Then it will be visible at http://linux.itcollege.ee:3000/r/roomname

  • replace
    • roomname with the name
    • password with the password
  • commands sent to the web are copyable, history can be viewed by scrolling back (it is not recommended to clean the command line while using shellshare)
  • files opened on the command line, man pages, etc. are also displayed; movement, text marking using the keyboard are also displayed in the web stream

Transmitting a command line from multiple terminals to the same address at the same time is also supported - this way it is possible to simultaneously transmit a command line from a class computer, from a virtual machine, etc. to the same session at the same time - this way the information is in one place for the student. The information must be copied, because the history is not preserved when the transmission ends and the window is closed.

Fast usage

There can be an alias created (see also .bash_aliases), script etc to start quickly streaming command-line with appropriate settings.

Stop streaming

To stop command-line streaming: exit+Enter, usually also CTRL+D works.

Special thanks

Special thanks goes to TalTech IT College Linux administrator Veiko Tuul to set up server side and offering such a great opportunity!

Links