Category: CLI

Install Mutt correctly

No Comments
  1. Install mutt or neomutt with your favourite package manager:

apt install neomutt

or install from source

git clone https://github.com/neomutt/neomutt

Here are the sample commands to configure and build NeoMutt:

./configure --gnutls --gpgme --gss --sasl --tokyocabinet
make

2. create a muttrc using mutt-wizard

git clone https://github.com/LukeSmithxyz/mutt-wizard
cd mutt-wizard
sudo make install

The mutt-wizard is run with the command mw. It also installs the mailsync command. Once everything is setup, you’ll use neomutt to access your mail.>

  • mw add — add a new email account
  • mw ls — list existing accounts
  • mw pass — revise an account’s password
  • mw delete — deleted an added account
  • mw purge — delete all accounts and settings
  • mw cron — toggle/configure a cronjob to sync mail

3. create mutt mailboxes correctly using maildirmake utility from courier mail server. The individual components can be downloaded here. Most tutorials leave out this part, and so I struggled with a persistent mailbox format error.

mkdir ~/Mail

cd Mail

maildirmake gmail

4. Use pass to initialise and store mailbox passwords

pass pass init <gpgemail>

5. More Information

Mutt Wiki

Categories: Apps CLI Ubuntu

Tags: ,

Zenplayer

No Comments

This is a useful script for playing di.fm stations with mplayer (requires zenity, curl and mplayer)
1. open a terminal

sudo gedit /usr/bin/zenplayer

2. Add a bash shebang

#!/bin/bash

3. paste this:
zenity --list --width 500 --height 500 --column 'radio' --column 'url' --print-column 2$(curl -s http://www.di.fm/ | awk -F '"' '/href="http:.*\.pls.*96k/ {print $2}' | sort | awk -F '/|\.' '{print $(NF-1) " " $0}') | xargs mplayer
4. Save
5. Make executable

sudo chmod +x /usr/bin/zenplayer

Then to run, just type zenplayer in a terminal and choose a station
otherwise make a new menu entry in your gnome menu and add zenplayer to properties.
If you want notifications when the track changes, add this:
| grep --line-buffered "StreamTitle='.*S" -o | grep --line-buffered "'.*'" -o > mus & tail -n0 -f mus | while read line; do notify-send "Zen Player" "$line";done
THANKS polaco and spiffwalker at commandlinefu.com

Categories: CLI Ubuntu

Tags:

CLIcompanion and Cheatsheet

No Comments

Although U8UNTU eLXR’s much vaunted migration to Blogetery.Com appears to have run aground, with the site disappearing off the Bermuda Triangle — word only now reaches us about the server getting impounded by authorities for copyright violations related to free and open source software — we can still report about two amazing command line / console apps. Both fit the bill for “wish I had this when I started out” with the new fangled Ubuntu craze featuring. Return to the Command Line by the Open Source Kid.

CLIcompanion


You can get CLIcompanion by running the following command in a Terminal:
bzr branch lp:~duanedesign/+junk/clicompanion
Move the .clicompanion file found in the clicompanion directory into your $HOME. You may need to select View –> Show hidden files (Ctrl +H) to see the .clicompanion file.
After moving the file return to the Terminal and run the following to move into the clicompanion directory:
cd clicompanion/
Start the application with the command:
python clicompanion.0.0.7.py
THANKS okiebuntu
2. Cheatsheet
A console app which pretty much does the same thing, but from the command line.

You can get the cheatsheet code with the command:

bzr branch lp:cheatsheet

then move into the directory
cd cheatsheet/
Make the file executable:
chmod +x cheatsheet.py
Then move it to one of your $PATH directories. You can view these with the command: echo $PATH
I chose /usr/local/bin/ for the next command
Move the file with the command:
sudo cp cheatsheet.py /usr/local/bin/cheat
Then from a Terminal you can view the command usage by running:
cheat –help

Categories: Cheats CLI Ubuntu

Tags: ,

Google Command interface launched

No Comments

It had to happen, an official google application that provides access to google services via the command line. In April we showed you how to do this, the unofficial way using surfraw. Now you can do it with the blessing of the worlds most popular search engine company, Google
GoogleCL can be used to google the following services (examples shown):

  • Blogger
    $ google blogger post –title “foo” “command line posting”
  • Calendar
    $ google calendar add “Lunch with Jim at noon tomorrow”
  • Contacts
    $ google contacts list name,email > contacts.csv
  • Docs
    $ google docs edit –title “Shopping list”
  • Picasa
    $ google picasa create –album “Cat Photos” ~/photos/cats/*.jpg
  • Youtube
    $ google youtube post –category Education killer_robots.avi

Unfortunately, the deb which was released yesterday, doesn’t automatically setup the terminal browser. You will have to do this yourself:

gedit /home/user/.googlecl/config

After running one of the services for the first time, the above config was created. I opened it with gedit and added

auth_browser = w3m

Which is the w3m text-based browser. There are a lot more services on the way, and one can only hope this is a sign of things to come. I can think of a number of Net services which could do with a CLI interface.
( Remember to fill in forms with w3m , to log into your google account, you have to hit the enter key.)
Please check the official development page site for the last update.
Please visit the official download page to download GoogleCL (You’ll find a nice deb there waiting for U8UNTU users!)
THANKS Panoet

Categories: Apps CLI Ubuntu

Tags:

Google via the command line

2 Comments

Sometimes opening a terminal is a lot faster than opening a browser. If you like me, then you will enjoy having some extra supercow powers at the command line.
Here is how to set up Google on the command line.
1. Install the surfraw essentials
apt-get install surfraw surfraw-extra w3m
2. Setup surfraw

sudo gedit /etc/surfraw.conf

Change the following:
SURFRAW_graphical=no
SURFRAW_text_browser=/usr/bin/w3m
save.
3. Now you have three choices:
A)  You can stick with the default action, which is:

sr google <subject>

B) You can add an alias to your bashrc

gedit /home/<user>/.bashrc

ADD under aliases section:

alias google="sr google"

Save
C) You can add the surfraw ELVIS   dirctory to yout PATH variable
usually /usr/lib/surfraw/ or /usr/local/lib/surfraw/
eg. PATH=/usr/lib/surfraw/:$PATH
This is probably not such a good option since it will also give you instant access to the 80 or so “Elvi” which are  in the surfraw directory and part of the Surfraw suite. Since  some of the commands might conflict with commands already on your system,  we might want to first check to see which Surfraw “Elvi” commands and powers you need and which ones you don’t.
Remove the ELVIS  you don’t need by deleting or moving the ELVIS from the /usr/lib/surfraw/ and placing it in /usr/local/lib/surfraw/ or vice versa. You really only want one surfraw directory in your path!!!

That’s right ELVIS isn’t dead, he just lives on as the Shell Users’ Revolutionary Front Against the World wide web.
You can still command ELVIS to do your bidding.
More info

Categories: Apps CLI Ubuntu

Tags:

BashStyle-NG 7.9 – Colors in terminal

No Comments

BashStyle-NG is a graphical tool that allows us to easily change the behavior and appearance of the terminal. It comes with 15 pre-defined styles that you can change as well as create your own. You can define up to 7 Alias, control the type and amount of orders to recall in history, put a message of welcome, change the startup path and lots of other options.
http://www.nanolx.org/apt/pool/main/b/bashstyle-ng/bashstyle-ng_7.10-1nano_all.deb

Multi-User Dungeons in Ubuntu

No Comments

Yes there’s always IRC but if you want something a little more counter-cultural, why not try MUD? Multi-User Dungeons are the mainstay of the old-school UNIX BBS. Similar to IRC, the text-based chat & role-play is a lot more entertaining. To log into a MUD you will need to set up a shell account with an online BBS.
There are a number of shell accounts & BBSs available. The telnet BBS guide is a good place to start.
I ssh’ed into the Super Dimension Fortress, a Seattle-based BBS with an evocative name and set-up my account like this:

ssh new@<name-of-the-server>

This took me through a setup in which I was asked to supply a username and password.  I could then login with username@server.
Then using the unix commode programme available from the shell I quickly learnt how to join a room. Sound familier? MUDs are essentially chatrooms, but with a slightly different ethos and character. Some are exceedingly elaborate. I actuallyprefer the good old cyberspace hackers meeting up in text-mode. B&W or Colour, toggle on of off, you choose. To enter the real MUD game using the mud command, I chose a character and became a samurai leprechaun.
My first realisation on returning, was that today’s MUD, apart from the game, could make a nice addition to Pidgin, as a plugin. A better nCurses interface would also be cool in terms of development.
Whereas IRC is usually organised around a topic or channel, MUDs are very connected to a sense of place and presence on the Net. You can feel like you live and work in Seattle for instance, by joining SDF which also has a Texas presence.
MUD, considered by many to be some kind of Pre-Mosaic relic,, may have slipt under the radar, but thanks to Ubuntu, the shell is making a come-back. Chatting via a MUD is more anonymous than Facebook, and less of a chore than IRC, which is geared towards rapid communication. MUD is also a lot slower, and laid-back. Give it a try and let us know what you like or dislike.
UPDATE: There are two clients in the repos which one should consider.  PuTTY is an sh client with some excellent options such as proxy. There is also Gnome-MUD, a GTK MUD client.

Categories: CLI Culture Ubuntu

Smart autocompletion of BASH commands

No Comments

I have been looking for a way to favourite my commands. Turning on Bash Smart autocompletion is a start. I found this posting at Ubuntu Blog:

The Bash shell has this sweet feature where you can use the TAB key to auto-complete certain things. For example, when I am in my home directory, the following command:
$cd Do[TAB-key]
will automatically yield:
$cd Documents
If you are an absolute novice, like I was, not so long ago, discovering tab completion in the terminal can make you go “Wow!”. Wait till you hear the rest now 🙂
Though you can use the TAB key to complete the names of files and directories, by default the completion is pretty “dumb”. If you have already typed $cd D you would expect that the tab key would cause only the directory names to be completed, but if I try it on my machine, the tab completion tool uses filenames too.
Now, don’t despair! There is now a smart bash tab completion trick you can use. Smart completion even complete the arguments to commands!!
To enable smart completion, edit your /etc/bash.bashrc file. Uncomment the following lines, by removing the # in the beginning of the lines:
#if [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
#fi

Now you can use tab completion to power your way through commands.
You can even extend bash smart completion to your own favourite commands by using /etc/bash_completion, the “complete” utility and /etc/bash_completion.d . Explaining the nitty-gritty is beyond me. I refer you to the Debian Administration gurus for more information regarding smarter bash completion.

Thanks Carthik, I do believe this is the solution. First turn on smart autocompletion, check to see if your favourite commands autocomplete, and if not, then create a file containing these commands using the link provided.
UPDATE: Working with history in Bash

Categories: CLI Ubuntu

Tags: ,

Some cool consoles for Ubuntu

No Comments

After struggling with a number of consoles, all of which claimed to provide the drop-down “Quake” experience, I found Yeah Console, which does exactly what it promises, nothing more, nothing less. I was pleasantly surprised, even though the installation details are not what one could call smooth sailing. If you want to grab the console, you’ll have to pop over to this page
While waiting for the release of Guake for Hardy Heron, I came across Tilda, which is another nifty console, that is less of a killer app, than a good excuse to play around with an alternative to the default. Good work people, keep up the pressure on Canonical, to develop even better terminals.
Instructions for setting up YeahConsole
First, it needs to run every time you log in. So, go to System > Preferences > Session, select Startup Programs, click Add, and add a new command, name “YeahConsole”, command “yeahconsole”. Next, it looks a bit rubbish when you start it up. Here’s how bare-bones yeahconsole is: you configure it with X resources. Party like it’s 1989! I had to go look up how to do this; for the more tender in years among us, X resources were a sort of central configuration for all your apps, round about the same time that humanity was fighting off sabre-toothed tigers and wondering whether that hot flamey thing in the corner could actually be useful. On Ubuntu, you need to edit (actually, you probably need to create) a file called .Xresources in your home folder*. In that file, you put the configuration for yeahconsole, like this:

yeahconsole*toggleKey: None+F2
yeahconsole*consoleHeight: 20
yeahconsole*aniDelay: 0
yeahconsole*stepSize: 10
yeahconsole*faceName: ProFontWindows:style=Regular
yeahconsole*faceSize: 9

The toggleKey one is the important one: it sets which key you use to summon the terminal. I like F2, myself, but pick whatever. What all this stuff means is documented in the man page (man yeahconsole), apart from which font to use. This is the faceName and faceSize options above, and here you have to delve a bit (I told you this was old-fashioned; I started writing a yeahconsole-properties configuration utility that did all this for you, but couldn’t be bothered). In a terminal, run fc-list. This lists all the TrueType fonts that you can use in an xterm. Choose one, and put it in faceName above. Now, simply start yeahconsole for the first time (press Alt+F2, type yeahconsole), and then press F2 (or your key of choice). Pow, a dropdown terminal, like Tilda, but one that won’t keep crashing and make you cry. One other thing: if you hit Ctrl-D to log out by mistake, it’ll close yeahconsole (tilda did this too), and that’s really irritating. To fix this, put the following in a file called bashloop in your home folder:

#!/bin/bash
while true; do bash; done

and change your Startup Programs command above to be yeahconsole -e /home/username/bashloop. Now Ctrl-D won’t close yeahconsole.

Categories: BASH CLI Ubuntu