4 ms·
Just use tail -f and a bash function. Put this in your .bashrc file: function talk { echo "$USER: $@" >> talkfile; } then run: tail -f talkfile & T
by JamesMcMinn 11y ago
Just use tail -f and a bash function.
Put this in your .bashrc file:
function talk { echo "$USER: $@" >> talkfile; }
then run:
tail -f talkfile &
The & puts tail into the background so it continues running, and "talkfile" needs to be a file that both of you have write access to.
You can both communicate simply by using the talk function like any other bash command:
talk whatever you want and it'll be written to talkfile
This works on Linux, not sure about Mac.
It's nice because it records what you say, so there's no need for the other person to be logged in to get your message, and you get a printout of the last few lines of conversation when you "login" (run the tail -f command). There's nothing extra to install either.
(edit, apparently say is already installed on OS X, so I renamed the function "talk")
- wampus 11y agoYou definitely don't want to name the alias 'say' because there's already an OS X command by that name. In fact, if you both have Macs and want to have some fun, create accounts for each other and use the 'say' command to use the speech synthesizer for chat. You can even choose different voices: man say
- aaronharnly 11y agoNice suggestion! Just to note, on the Mac there's already a /usr/bin/say, which invokes the text-to-speech. So if you don't create your function, SSHing to the friend's Mac and typing 'say whatever you want' will have an interesting but probably not desired effect :) I'll admit to having used this on a friend's machine once or twice for amusement. (And invoking 'say' invokes the TTS even if you SSH in as a user other than the one logged in to the main GUI. I'm pretty sure this wasn't always the case; not sure when it changed.)
- madeofpalk 11y ago> (And invoking 'say' invokes the TTS even if you SSH in as a user other than the one logged in to the main GUI Been this way since at least 2008 - I remember doing this back in school when bored in class.
- ars 11y agoBTW you can get say in linux too. Install the program festival and invoke it with: echo hello | festival -b --tts
- simi_ 11y agoUbuntu and Fedora come with espeak. Stumbled upon that fact when doing https://github.com/andreis/different https://github.com/andreis/different
- rakoo 11y agoCombine this with multitail (http://www.vanheusden.com/multitail/ http://www.vanheusden.com/multitail/) and you can even have multiparty conversation !
- tvon 11y agoThere are existing (old) *nix commands for this. E.g., the `talk` command which I believe needs the talkd daemon running (ntalkd on OS X). There are also `wall` and `write`. https://wiki.archlinux.org/index.php/Talkd_and_the_talk_command https://wiki.archlinux.org/index.php/Talkd_and_the_talk_comm...
- secabeen 11y agoBack in the day, we made much use of ytalk. One of talk, ntalk or ytalk should be available for any system you use.
- zik 11y agoytalk is only an "apt-get install" away in Ubuntu. "write" is installed as standard, but ytalk is way better.
- stephancoral 11y agoI love wall. We have a 'jump' server, used to ssh into remote boxes, a truly public space with numerous users, such as myself, logged in poking around looking for the right hostnames etc. Having just learned of the wall command, I alt-tabbed to a session and thinking it fun to give a whirl. My message? "Whats up playas" A brief reprieve. But ah the word! "Yo." So came the flurry. A new message. And another. And another. Messages scratched across the server wall as though all the company had congregated outside this massive sleek black edifice where our words so glowed. I'm sure even some HR slavers or sales kin made the trek through the Terminal Wastes to bear witness to this spectacle. It was our digital Wailing wall except our shrieks were laughter. We were posting ASCII art by the time a sysadmin stepped in and put a stop to our revelry. Anymore posting would result in bans, temporary of course, but exile nonetheless. Silence. Then the CEO: "Sup."
- StavrosK 11y agoI'd just use libpurple, to match the prose! (Sorry)
- 11y ago
- davesque 11y agoAlso, if you have a terminal multiplexer like tmux, you can have a very small horizontal split at the bottom to execute the `talk` command and use `less +F talkfile` in the top split to view the chat log with the ability to scroll back and search. You could also use tmux's built-in scrolling and just use `tail -f talkfile` but that would only show you the content which was tailed after you executed that command.
- davesque 11y agoActually I just realized you can use `tail -f -n +0 talkfile` to tail starting from the first line of `talkfile`. This works with both the BSD and GNU coreutils versions of `tail`.
- T3RMINATED 11y agothats awesome
- dmytrish 11y agoOr, to get a continuous loop with timestamps: function talk { while read line ; do echo "$USER [`date +%T`]: $line" >> $talkfile ; done }
- lamontcg 11y agokids these days don't know how to talk(1), write(1) or finger(1)
- baby 11y agoeven more gettho, just use tmux and both connect on it to write on the same file.