In the event that you decide to, or for some reason have to go completely command line for a while, you will likely be wondering how to do certain things. There are some things that have to be done on any computer to make the computer in question worth it’s plastic. So, here is part one of a discussion on doing these important tasks from the command line. Some of this may be covered elsewhere here but I am including it again for the sake of completeness. To get to the console from gnome, press control+alt+f1 through f6. You have six consoles to choose from, but when you wanna go back to gnome, it is control+alt+f7. If you want to use the console you will need a screen reader for it like Speakup. For information on installing Speakup in Ubuntu read "Speakup Revisited".
If you are completely new to the command line, you can use these two tutorials to get started with it quickly:
Into the Linux Command Line Interface (CLI) and Introduction to Command Line Interface (CLI) 2.
Multiple Terminals With Screen
I am pretty sure that Ubuntu comes with screen installed. I don’t ever remember installing it, but it could have sneaked in as a dependency for something else though I doubt it. If you don’t have screen, you need it. To launch it, type screen. You will have to press enter after it starts to get your prompt back. Screen makes it so you can have several terminals all at once. To create a new one, press control+a followed by c. You can have as many as you want, one for music, one for email, one for instant messaging, etc. To switch between terminals, press control+a followed by n for the next one or p for the previous one. To close a terminal that you no longer need, type exit. Another great feature that screen has is the ability to copy and paste. When you need to copy something, press control+a followed by either the escape key or [. Use the arrow keys to position the cursor on the first of the text you would like to copy and press space. Find the last part you want to copy and position the cursor on it with the arrow keys and press space again. Now, when you need to past the copied information press control+a followed by the ] key.
The use of a ~/.screenrc file can help Orca users to copy from the terminal. Installing xclip is helpful for this. To get it:
sudo apt-get install xclip
Here is the .screenrc file that I use:
bind b eval "writebuf" 'exec !!! xclip -selection "clipboard" -i /tmp/screen-exchange'
termcapinfo xterm|xterms|xs|rxvt ti@:te@
If you want to download this file, enter the following command in terminal:
wget -O ~/.screenrc http://stormdragon.us/scripts/screenrc
Using this .screenrc file you can press control+a b after following the above instructions to copy text to place the copied text into the clipboard. If you are using screen in the console where the X clipboard is not available, you can still easily get the copied information from the file:
To move up and down through the terminal’s buffer press shift+pageup and shift+pagedown. This is slightly different from gnome-terminal with out screen in which you press control+shift+pageup and control+shift+pagedown to move through the buffer.
Twitter From The Command Line
The program twidge is an excellent command line Twitter client. A lot of distros include it in the repositories. In Ubuntu, for example, you can get it by typing in terminal:
sudo apt-get install twidge
If your distro doesn’t include it you can download it from http://software.complete.org/software/projects/show/twidge.
After installing Twidge, you need to configure it. To do this, type:
There are only two questions and they should be very easy to answer. After twidge is configured, you can get the latest tweets very easily. First though, you should run:
twidge lsrecent -su
This gets the last 20 tweets and also sets a place marker so you won’t see them or anything before them if you do not wish to do so. After running this command, you can then get all new tweets by typing:
twidge lsrecent -asu
To post an update type twidge update and press enter. Type your update and press enter again, just remember not to go over the 140 character limit. For more detailed instructions on Twidge and its uses, type:
You may also be interested in TTYtter.
I wrote an article on weather a while ago. There is a great program called weather-util for the console. To find out how to install and configure it, please read "…And Weather For All".
Command Line Music Player
I have tried several terminal based music players. None of them worked well with Speakup. I was about to lose hope in ever finding a good one to use with a screen reader when I heard of cmus. In Ubuntu, get it by typing:
sudo apt-get install cmus
Launch it with the command:
and close by typing:
After the first time you start and close the music player open the ~/.cmus/autosave file. Find the line that reads:
Change it to true and save the file. softvol allows you to change the music players volume without changing volume for the whole computer. There are a lot of other settings that can be changed in this file including repeat and shuffle. To add music to the library use :add and the directory where the music is stored. You can use :a as a short cut if you prefer. To add all of the songs in ~/Music and its sub directories, for example, you would type:
Use – to decrease the volume and = to turn it up. Previous track is z, play is x, pause is c, stop is v, and next track is b. Use the up and down arrows to move through the tracks in your library and enter to play the currently selected song.. For more info on cmus, type man cmus.
Sox, the Swiss Army Knife of Sound Processing Utilities
Sox is one of my favorite command line programs. It can play audio, record, convert from one file type to another, and add effects to audio. Unfortunately it is not packaged with all of its powerful abilities enabled by default. The best way to deal with this little problem is to download and install it yourself. The only thing it is lacking is the ability to write mp3 files. It can play them, but by default, in Ubuntu and I assume other distros, it can not write mp3 files. So, if you do not care about this functionality, just do the normal sudo apt-get install sox. If you want to be able to convert to mp3, you will need to download it from http://sourceforge.net/projects/sox/ and install it. Before installing though, you will need to get some other libraries. In Ubuntu type:
Help Power my blog posts, keep my caffeine buzz going strong!
sudo apt-get install libmp3lame0 libmp3lame-dev libsox-fmt-all
sudo apt-get build-dep sox
Next extract the sox files with the following command. The version may have changed after this writing, so be sure to use the current numbers in the file name:
tar xzvf sox-14.3.0.tar.gz
Change to the newly created directory with:
sudo make install
For more information on the options that can be used when compiling sox read the included INSTALL file.
Sox can do so many different things that it would take a long time to write them all down here. Here are a few things to get you started though:
sox filename.wav filename.ogg
Convert filename from a wav to an ogg file. Don’t worry, it doesn’t delete the wav file. You can convert from any type to any other type of audio.
Plays a file it can have effects added and the volume can be adjusted as well.
Creates a file and starts recording to it. for all of the incredible things sox can do, type man sox.