Tutorial – Mastodon
Command-Line Tooting
There are some interesting command-line clients. Mastotool [11], for example, allows you to log in to your account, search for keywords in your toots, and grab some stats (number of toots, followers, most boosted toot, highest scoring toot, accounts from other people with whom you frequently interact, etc.). That's it, and that is the author's stated purpose for it. It is kind of useful. However, since collecting data is its main point, the fact that the stats are not very comprehensive limits mastotool's usefulness.
On the other hand, toot [12] is more the real deal, allowing you to post, boost, delete, and do all sorts of things from the command line.
To configure your account run
toot login
and follow the instructions. As with Whalebird, at one point you will be required to authorize the toot with your Mastodon instance and copy and post an authorization code into the command line.
Once you are done, tooting with toot is pretty simple. The following
toot post "Tooting from toot" -m Pictures/someimage.jpg
will post "Tooting from toot" and the image to your timeline.
To print out all the available commands that allow you to poll your account, manage lists, follow other users, and so on, use:
toot help
Toot also has an experimental curses interface to read toots (Figure 5). You can scroll through your timeline's list, but that is about it – as far as I can see, you cannot boost, reply, or even switch to another timeline from the curses interface. Maybe these will be features added in a future version.

Also interesting is madonctl
[13], especially as a tool you can integrate into your own scripts.
To log into your account, run:
madonctl config dump -i your_mastodon.instance -L your@email.com -P "Your secret login password" > config.yaml
You usually need to copy the file that this creates into .config/madonctl/madonctrl.yaml
, although you can point madonctl
to other configuration files with the --config
option
madonctl account show --config .config/madonctl/myotheraccount.yaml
This will show stats and data from your non-default account.
If you need to change anything, you can edit the file directly. A typical madonctl
configuration file looks like Listing 1.
Listing 1
madonctl.yaml
01 instance: 'https://your_mastodon.instance' 02 app_id: 'e6d56c608a350735868c7884985f1f849f24d3bf43cc316a0fdfc3b1e17bccaf' 03 app_secret: '2fd94d21455cb0f494a4ef09d994f00d84ccb025e6f576ca5f0eaaa05e5b8f9b' 04 05 token: 'f-G932jfd83erfjdfij847WIOSWKsDw9sekdeII' 06 login: 'your@email.com' 07 password: 'Your secret login password' 08 safe_mode: false 09 10 #default_visibility: unlisted 11 12 #template_directory: '' 13 #default_output: theme 14 #default_theme: ansi 15 #color: auto 16 #verbose: false 17 ...
The instance
value on line 1 refers to your Mastodon instance (i.e., wherever your account is hosted – mastodon.social, mastodon.technology, etc.). You do not have to supply the app_id
(line 2) or the app_secret
(line 3), but you do have to get a token
(line 5) from your Mastodon instance. You do that by registering a new application as explained earlier when discussing Mastodon Scheduler.
Once you have completed and saved the configuration file, you can start interacting with your new account.
The command
madonctl account show
will give you data about the account you are logged into, such as the description, its ID, number of followers, number of statuses (posts), and so on. And
madonctl toot "Hello"
will post a message to your timeline.
Although neither toot nor madonctl
have commands to schedule toots, it is not difficult to imagine ways of using Linux tools to do the scheduling for you. You can use the traditional at
[14] command, for example, to do the trick (Figure 6). The disadvantage is that your machine will have to be on at the time the toot is scheduled.
Conclusion
The variety of Mastodon clients is wide and diverse, which is a testimony to how easy it is to create applications that interact with Mastodon. Although the mobile applications seem to cover most of the features that make Mastodon great (and then some), their web, desktop, and command-line counterparts all fall short.
That's why in my next installment, I'll be showing you how to easily write your own client and give it the features you need.
Until then, toot along!
Infos
- "Welcome to the Fediverse," by Paul Brown, Linux Magazine, issue 227, October 2019, pp. 90-94
- The Fediverse: https://fediverse.party/
- Mastodon: https://joinmastodon.org/
- Halcyon: https://halcyon.cybre.space/
- Mastodon Scheduler: https://scheduler.mastodon.tools/
- Pinafore: https://pinafore.social/
- Tusky: https://tusky.app/
- SubwayTooter: https://github.com/tateisu/SubwayTooter
- Fedilab: https://fedilab.app/
- Whalebird: https://whalebird.org/en/desktop/contents
- mastotool: https://github.com/muesli/mastotool
- toot: https://toot.readthedocs.io/en/latest/
- madonctl: https://lilotux.net/~mikael/pub/madonctl/
- at: https://www.computerhope.com/unix/uat.htm
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.
News
-
Red Hat Migrates RHEL from Xorg to Wayland
If you've been wondering when Xorg will finally be a thing of the past, wonder no more, as Red Hat has made it clear.
-
PipeWire 1.0 Officially Released
PipeWire was created to take the place of the oft-troubled PulseAudio and has finally reached the 1.0 status as a major update with plenty of improvements and the usual bug fixes.
-
Rocky Linux 9.3 Available for Download
The latest version of the RHEL alternative is now available and brings back cloud and container images for ppc64le along with plenty of new features and fixes.
-
Ubuntu Budgie Shifts How to Tackle Wayland
Ubuntu Budgie has yet to make the switch to Wayland but with a change in approaches, they're finally on track to making it happen.
-
TUXEDO's New Ultraportable Linux Workstation Released
The TUXEDO Pulse 14 blends portability with power, thanks to the AMD Ryzen 7 7840HS CPU.
-
AlmaLinux Will No Longer Be "Just Another RHEL Clone"
With the release of AlmaLinux 9.3, the distribution will be built entirely from upstream sources.
-
elementary OS 8 Has a Big Surprise in Store
When elementary OS 8 finally arrives, it will not only be based on Ubuntu 24.04 but it will also default to Wayland for better performance and security.
-
OpenELA Releases Enterprise Linux Source Code
With Red Hat restricting the source for RHEL, it was only a matter of time before those who depended on that source struck out on their own.
-
StripedFly Malware Hiding in Plain Sight as a Cryptocurrency Miner
A rather deceptive piece of malware has infected 1 million Windows and Linux hosts since 2017.
-
Experimental Wayland Support Planned for Linux Mint 21.3
As with most Linux distributions, the migration to Wayland is in full force. While some distributions have already made the move, Linux Mint has been a bit slower to do so.