HPR1113: TermDuckEn aptsh




Hacker Public Radio show

Summary: I recently discovered apt shell (aptsh), a psuedo shell which gives users of distributions which use apt for package management quick access to the functionality of apt-get. You should find aptsh in the repositories of Debian based distros. Once installed, you can launch 'aptsh' as root from the command prompt (i.e. 'sudo aptsh'). One of the drawbacks of installing software from the terminal is that sometimes you don't know the exact name of the package you want to install. From the aptsh> prompt, 'ls' plus a search string will show all the packages that have that string in their names. You can type 'install' plus a partial package name and use TAB completion to finish the instruction. The function of the 'update' and 'upgrade' commands are self explanatory, unfortunately, you can't string them together on the same line like you can in bash: sudo apt-get update && sudo apt-get -y safe-upgrade Instead, you use the backtick [ ` ] key to put aptsh into queue mode. In queue mode, you can enter commands one by one to be launched in sequence at a later time. To bring your system up to date, you could run: aptsh> ` * aptsh> update * aptsh> upgrade * aptsh> ` aptsh> queue-commit-say yes Backtick toggles queue entry, and queue-commit runs the queue. “queue-commit-say y” tells aptsh to answer in the affirmative to any queries from the commands executed in the queue in much the same way “apt-get -y safe-upgrade” confirms software updates without user interaction. Apt shell is capable of other apt related tasks, but I think I've covered the most useful ones. The trouble with running aptsh is that unless you start it in a terminal with the computer and leave it running all day (as opposed to opening it as a new shell within you terminal every time you want to update or install), despite the convienience of package name search and TAB completion, it really won't save you any keystrokes. With that in mind, I started looking for ways to have the apt shell available at a keystroke (we will leave the wisdom of leaving a shell open with a subset of root privileges for another day). I had guake installed, but rarely used it because I usually have multiple terminal tabs open since I am logged into my server remotely. [Actually, I had forgotten guake supports tabbed terminals quite well. You can open a new tab with <Shift><Ctrl>T and switch between terminal tabs by <Ctrl><PgUp> and <Ctrl><PgDn> or clicking buttons that appear at the bottom of the guake window. I had how, forgotten this until doing further research on this story. Since this revelation ruins my story, we will forget about tabbed terminal support in guake and not mention it again.] I am also going to assume everyone is familiar with guake. If not, suffice it to say guake is a terminal that pops down in the top third of the screen when you hit a hotkey, <F12> being the default. It returns to the background when you press <F12> again or click the lower part of the desktop. It is patterned after the command shell in the game Quake that let you input diagnostic and cheat codes, hence