File: HOWTO

package info (click to toggle)
aptsh 0.0.7%2Bnmu2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 704 kB
  • ctags: 221
  • sloc: sh: 3,691; cpp: 1,876; ansic: 272; makefile: 93
file content (691 lines) | stat: -rw-r--r-- 20,246 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
Aptsh Howto
by Marcin Wrochniak
<wrochniak at gmail.com>


  1. Introduction
  ===============


	1.1. Note
	=========

Note that some technical details may differ on your system, for example your GNU
 Readline library might be configured differently or your locales might be other
 (en_US is used in examples, although author personally uses pl_PL). But the gen
eral behaviour of Aptsh shouldn't differ too much.


	1.2. Apt
	========

If you read this, then you probably know what Apt is. And I hope you like it; if
 not, you will after reading this text. :)

So you're an Apt user. Your daily work doesn't require launching apt-get or apt-
cache too often. But from time to time it does, and then in consumes much time..
. well, maybe not as much as it would take without Apt, but you know that it cou
ld be done faster. When you need to install some piece of software, you search f
or it with apt-cache, copy package's name and paste it after apt-get install. Th
at's not good - it's better to use bash-completion. But it still may be not enou
gh; if so, try Aptsh. Of course, Aptsh is not just bash-completion rewritten in 
a mixture of C and C++. Beside tab-completion it can speed up your work in many 
other ways - just read further. 


	1.3. Pseudo-shell
	=================

The center of Aptsh is its pseudo-shell. It means that usage of Aptsh in shell-m
ode is similar to a normal shell, though results differ. :) While you use Bash f
or everything, Aptsh is used only for managing software installed on your system
. In Aptsh there are available commands like install, remove or dist-upgrade - y
ou know them from Apt.


  2. Usage
  ========


	2.1. Basics
	===========

If you want to see all commands available in Aptsh, they are in man aptsh, or ju
st help if you are in Aptsh's shell (a clue: pressing Tab twice in Aptsh doesn't
 list them all, I'll explain it later - just try to press Tab after typing 'queu
e' to see why). As you see, most of them are those old Apt commands, although th
ey are typed in without 'apt-get' and 'apt-cache' before. And that's it - just t
yping Apt commands directly after prompt.
Some examples:


  vrok@ankh ~ $ sudo aptsh
  Reading commands history...
  Generating and mapping caches...
  
  aptsh> remove xterm
  Reading package lists... Done
  Building dependency tree... Done
  The following packages will be REMOVED:
    xterm
  0 upgraded, 0 newly installed, 1 to remove and 32 not upgraded.
  Need to get 0B of archives.
  After unpacking 1188kB disk space will be freed.
  Do you want to continue [Y/n]? n
  Abort.
  Generating and mapping caches...
  
  aptsh> install xterm
  Reading package lists... Done
  Building dependency tree... Done
  xterm is already the newest version.
  0 upgraded, 0 newly installed, 0 to remove and 32 not upgraded.
  Generating and mapping caches...
  
  aptsh> show package_that_doesnt_exist
  W: Unable to locate package package_that_doesnt_exist
  E: No packages found
  
  aptsh> quit
  vrok@ankh ~ $


In example above you see how to launch Aptsh (with root privileges - that's the 
sudo thing), then you see effects of four Aptsh commands: remove, install, show 
and quit.


		2.1.1. Shell-mode is not a must
		===============================

Aptsh has a few features besides pseudo-shell which might appear usable to you, 
though you not necessarily must like the pseudo-shell (or you'd like to use thes
e features in your script, etc.). Aptsh can be used as a typical console program
 - in this mode you would use it like apt-get or apt-cache. Here's an example:


  bash:~# aptsh search frozen bubble
  fb-music-high - High quality, large music files for Frozen-Bubble
  fb-music-low - Lower quality, small music files for Frozen-Bubble
  frozen-bubble - Pop out the bubbles !
  frozen-bubble-data - Data files for Frozen-Bubble
  junior-puzzle - Debian Jr. Puzzles
  
  bash:~# aptsh install frozen-bubble
  Reading package lists... Done
  Building dependency tree
  Reading state information... Done
  frozen-bubble is already the newest version.
  0 upgraded, 0 newly installed, 0 to remove and 143 not upgraded.
  
  bash:~# aptsh orphans
  libreadline5-dev
  gstreamer0.10-plugins-bad-multiverse
  gstreamer0.10-plugins-ugly-multiverse
  
  bash:~#



		2.1.2. Looking for help
		=======================

Help connected with Aptsh can be found, besides this document, in the Aptsh manp
age and in help command. Since you probably know how to use the manpage, I will 
only explain how to use the help command.

If you just run help command, then it will launch Aptsh manpage++Looking for hel
p++
Help connected with Aptsh can be found, besides this document, in the Aptsh manp
age and in help command. Since you probably know how to use the manpage, I will 
only explain how to use the help command.

If you just run help command, then it will launch Aptsh manpage. But if you laun
ch it with names of some commands, then you will see short descriptions of these
 commands. Example:


  aptsh> help orphans orphans-all install remove help
  orphans      List libraries not required by any installed package
  orphans-all  List packages not required by any other installed package
  install      Install (or upgrade) one or more packages or .deb files
  remove       Remove one or more packages (see also purge)
  help         Display short info about given commands, or Aptsh's manpage (if n
o arguments)
  
  aptsh>



	2.2. TAB completion
	===================

Without Tab completion, Aptsh would be like a car without the engine - you actua
lly can use in the Flinstone way, but it's simpler just to walk.

If you use the Unix shell, you probably know what the headline of this paragraph
 means (Yes, there are shells without Tab completion, but nowadays it's just as 
basic as a cup of coffee in the morning). Tab completion in Aptsh works in the s
ame way, except it usually lists matching packages, not files.


		2.2.1. Commands completion
		==========================

But let's get down to the business... First sort of completion is used for Aptsh
 commands. You may expect that there actually is nothing special to say, but it'
s no so simple. There are groups of commands serving to similar tasks, like help
 and help-howto. First one displays typical Unix manual page for Aptsh, second o
ne displays this document.

See this:


  aptsh>
  add              dump             policy           source
  autoclean        dump-cfg         queue*           stats
  build-dep        dumpavail        quit             unmet
  check            help             rdepends         update
  clean            install          remove           upgrade
  depends          listfiles        rls              whatis
  dist-upgrade     ls               search           whichpkg
  dotty            madison          show
  dpkg             orphans*         showpkg
  dselect-upgrade  pkgnames         showsrc
  
  aptsh>


There's nothing about help-howto, just help (plus a * character). As you already
 know, these two funtions compose a group. Grouping of commands serves to save s
pace on your terminal by displaying only the master command. That * tells you th
at it's just a master (root) of a command group. Of course, completion works for
 all commands, not only these basic; you just have to type in the whole master c
ommand. Just see this:


  aptsh> help (TAB pressed twice)
  help  help-howto
  aptsh> help


It works! :) And it doesn't show any star sign, because now only members of a on
e group are being shown. You can check other groups, like queue or orphans.


		2.2.2. Packages completion
		==========================

Second type of completion is used for packages. This one is very simple, it's in
 the old Bash style. Of course, when you want to install some packages, Aptsh wi
ll prompt you all available packages; and only installed when removing. As usual
, some examples.


  aptsh> install (TAB pressed twice)
  Display all 20571 possibilities? (y or n)
  
  aptsh> remove (TAB pressed twice)
  Display all 1038 possibilities? (y or n)
  
  aptsh> install kde (TAB pressed twice)
  Display all 164 possibilities? (y or n)
  
  aptsh> install xterm (TAB pressed twice)
  xterm         xtermcontrol  xterminal     xtermset
  
  aptsh> install xterm



		2.2.3. Dpkg special completion
		==============================

The last one type of completion in Aptsh is very unique and (currently) is avail
able only for dpkg command. It handles all Dpkg's options (long, with -- and sho
rt, with -).


	2.3. Commands history
	=====================

A list of commands that you have typed in is stored in Aptsh. You can access the
m with Up button. The list may be also kept in file, so it will be accessible ev
en after Aptsh restart. If you want to disable the history, set use_history vari
able in aptsh.conf to 0. Other variables connected with history are history_file
 - it's a file where the commands list is saved (please do not use the default o
ne - it might be dangerous because the non-root users can read the file!), and h
istory_count - it's the number of commands you want to save to a file (if it's 0
, then history is not saved).


	2.4. Searching packages
	=======================


		2.4.1. Intro
		============

When you use a system like Debian with large numer of available packages, then y
ou know, that sometimes it's really hard to find the right package. In Aptsh, ex
ecpt the search command, which launches apt-cache search; and commands completio
n (which also may be considered as a kind of searching), there are few more ways
.


		2.4.2. ls
		=========

The ls command works like the normal ls, except that it lists packages instead o
f files. So if you type in ls you will see running list of all available package
s (you can pipe them to more or less - try to type ls | less). And if you use a 
wildcard - then you will see only packages equal to the wildcard (for instance, 
ls kde* will show only packages that begin with kde). Here's an example:


  aptsh> ls wmi*
  wmitime
  wmifs
  wmibam
  wmix
  wminet
  wmifinfo
  
  aptsh> ls wmi* | grep x$
  wmix
  
  aptsh> ls gnome*games
  gnome-card-games
  gnome-games
  
  aptsh>



		2.4.3. rls
		==========

ls command uses wildcards to find the packages, and rls uses regular expressions
 for the same job. Regular expressions are more powerful than wildcards, but oft
en they are too complicated - except some situatuons. If you want to list all pa
ckages with kde in their names, it's simpler to write rls kde than ls *kde*.


  aptsh> rls ^wmi
  wmitime
  wmifs
  wmibam
  wmix
  wminet
  wmifinfo
  
  aptsh> rls ^wmi.*x$
  wmix
  
  aptsh> rls ^gnome.*games$
  gnome-card-games
  gnome-games
  
  aptsh> rls irssi
  irssi-scripts
  irssi-snapshot
  irssi-common
  irssi-text
  xirssi
  irssi-snapshot-dev
  irssi
  irssi-plugin-icq
  
  aptsh>



	2.5. Command queue
	==================


		2.5.1. Switching between modes
		==============================

The command queue mechanism is a quite important part of Aptsh. When you are in 
the queue mode, all commands are only stored in memory, they are not executed at
 the time. They will be executed later, of course if you will launch them. To sw
itch between normal and queue modes, type `. If you turned on the queue mode, th
e prompt should change into the one that's specified in ps1_s variable in aptsh.
conf. If you turned on normal mode, prompt will change into ps1 variable.

Below is an example how to switch between modes (ps1 = aptsh> and ps1_s = * apts
h>).


  aptsh> show
  E: No packages found
  
  aptsh> `
  
  * aptsh> show
  
  * aptsh> `
  
  aptsh>



		2.5.2. Manipulating the queue
		=============================

A special commands group serves for command queue manipulation and execution. He
re's a list of commands connected with manipulation:

queue - Show the queue.

queue-clear - Clean the queue.

queue-remove - Remove commands from list (queue). Give commands' numbers as argu
ments, you can give numbers of particular items or sections of them (queue-remov
e 1 2 3 is correct as well as queue-remove 1-3).

A little example of how it works:


  aptsh> `
  
  * aptsh> rls
  
  * aptsh> ls
  
  * aptsh> show kde
  
  * aptsh> show gnome
  
  * aptsh> a
  Warning: Unknown command: a
  
  * aptsh> b
  Warning: Unknown command: b
  
  * aptsh> c
  Warning: Unknown command: c
  
  * aptsh> d
  Warning: Unknown command: d
  
  * aptsh> `
  
  aptsh> queue
  1: rls
  2: ls
  3: show kde
  4: show gnome
  5: a
  6: b
  7: c
  8: d
  
  aptsh> queue-remove 1 3 6-8
  
  aptsh> queue
  1: ls
  2: show gnome
  3: a
  
  aptsh> queue-clear
  
  aptsh> queue
  
  aptsh>



		2.5.3. Executing commands from queue
		====================================

Two commands are responsible for launching the command queue. First one, simpler
, is queue-commit. It just iterates through all commands in the queue. Second on
e is queue-commit-say - it works similarily to the first one, except that it pro
vides autoresponder (a mechanism which automatically responds to the commands' y
es-or-no questions).

queue-commit in action:


  aptsh> `
  
  * aptsh> remove xterm
  
  * aptsh> install xterm
  
  * aptsh> `
  
  aptsh> queue-commit
   >>> Doing step 1 of 2...
  Reading package lists... Done
  Building dependency tree... Done
  The following packages will be REMOVED:
    kubuntu-desktop xterm
  0 upgraded, 0 newly installed, 2 to remove and 44 not upgraded.
  Need to get 0B of archives.
  After unpacking 1221kB disk space will be freed.
  Do you want to continue [Y/n]? n
  Abort.
  Generating and mapping caches...
   >>> Doing step 2 of 2...
  Reading package lists... Done
  Building dependency tree... Done
  xterm is already the newest version.
  0 upgraded, 0 newly installed, 0 to remove and 44 not upgraded.
  Generating and mapping caches...
  
  aptsh>


This is fine, but it still requires user's activity. Sometimes you may not want 
to play with Apt's questions - if so, then use queue-commit-say command, which i
s provided with autoresponer. It's really simple to use: command's arguments are
 the answer to all questions (stdin of command-queue will be repeately feed with
 the arguments). If you don't provide any arguments, then Aptsh will use breakli
ne character as the answer, so in most cases the default actions will be taken (
for instance, if Apt asks you with [Y/n] (where Yes is the default one) or [y/N]
 (where No is the default one) question, then pressing Enter key will cause the 
default action). 

In example below, we try to remove and then install xterm (it's already installe
d). The autoresponer will answer n to Apt's question.


  aptsh> `
  * aptsh> remove xterm
  
  * aptsh> install xterm
  
  * aptsh> `
  
  aptsh> queue-commit-say n
   >>> Doing step 1 of 2...
  Reading package lists... Done
  Building dependency tree... Done
  The following packages will be REMOVED:
    xterm
  0 upgraded, 0 newly installed, 1 to remove and 42 not upgraded.
  Need to get 0B of archives.
  After unpacking 1188kB disk space will be freed.
  Do you want to continue [Y/n]? Abort.
  Generating and mapping caches...
   >>> Doing step 2 of 2...
  Reading package lists... Done
  Building dependency tree... Done
  xterm is already the newest version.
  0 upgraded, 0 newly installed, 0 to remove and 42 not upgraded.
  Generating and mapping caches...
  
  aptsh>


As you have just seen, it had neither removed nor installed xterm, because it an
swered n to the question. But the default answer was Y, so if we don't provide a
ny arguments to queue-commit-say, then Apt will decide for us and xterm will be 
removed.


  aptsh> queue
  1: remove xterm
  2: install xterm
  
  aptsh> queue-commit-say
   >>> Doing step 1 of 2...
  Reading package lists... Done
  Building dependency tree... Done
  The following packages will be REMOVED:
    xterm
  0 upgraded, 0 newly installed, 1 to remove and 42 not upgraded.
  Need to get 0B of archives.
  After unpacking 1188kB disk space will be freed.
  Do you want to continue [Y/n]? 
  (Reading database ... 76203 files and directories currently installed.)
  Removing xterm ...
  Generating and mapping caches...
   >>> Doing step 2 of 2...
  Reading package lists... Done
  Building dependency tree... Done
  Suggested packages:
    xfonts-cyrillic
  The following NEW packages will be installed:
    xterm
  0 upgraded, 1 newly installed, 0 to remove and 42 not upgraded.
  Need to get 0B/510kB of archives.
  After unpacking 1188kB of additional disk space will be used.
  Preconfiguring packages ...
  Selecting previously deselected package xterm.
  (Reading database ... 76183 files and directories currently installed.)
  Unpacking xterm (from .../xterm_6.8.2-10_i386.deb) ...
  Setting up xterm (6.8.2-10) ...
  Generating and mapping caches...
  
  aptsh>



	2.6. Orphaned packages
	======================


		2.6.1. Orphaned package?
		========================

Orphaned package is a package without any reverse dependencies (packages that re
quire the orphaned package) installed in the system.


		2.6.2. Orphans commands group
		=============================

The orphans commands group contains two commands: orphans and orphans-all. They 
both serve to locate orphaned packages on your system. They work similarily to t
he deborphans program, though they are a little bit poorer (deborphans' source c
ode couldn't have been acquired by Aptsh, because it's completely different).


		2.6.3. orphans command
		======================

The orphans command finds all orphaned packages which have libs or libdevel text
string in their Section field, so it actually should list all orphaned libraries
.

Why only libraries? Well, when you want to clean your system, you will probably 
want to remove unneeded libraries - and orphaned libraries are unneeded, unless 
you don't use them in programming or something. And you don't want to remove orp
haned programs, because you use them.

Example:


  aptsh> orphans
  libreadline5-dev
  liballegro4.1
  libsndfile1
  
  aptsh>



		2.6.4. orphans-all command
		==========================

But well, you may really want to see all orphaned packages, not only libraries. 
If so, use this command. Its output is a little bit different from the orphans' 
one - it produces two columns, first one contains the Section and second one the
 Name.

Example:


  aptsh> orphans-all
  python           python-crypto
  base             lilo
  python           python2.4-pycurl
  [...]
  libs             libsndfile1
  net              lftp
  
  aptsh>



	2.7. Other commands
	===================


		2.7.1. changelog, news
		======================

The changelog command retrieves changelogs for given packages from Debian server
s, and dumps them to standard output (you can give many names). news command is 
similar, but it dumps only the latest entry from the changelog. Both these comma
nds use external command (wget) to fetch files. Therefore, if you are behind a p
roxy server, you should configure wget to have this command working, BUT: wget c
onnects through proxy if its address is given in http_proxy shell variable, as w
ell as Apt does. Thus, if Apt works properly, these commands should work properl
y too.


		2.7.2. whatis
		=============

The whatis command lists short descriptions of given packages. You probably woul
d use it to check quickly what a package is and what it does. Here's a short exa
mple:


  aptsh> whatis aptsh
  aptsh: apt interactive shell
  
  aptsh> whatis apt dpkg kde
  apt: Advanced front-end for dpkg
  dpkg: package maintenance system for Debian
  kde: the K Desktop Environment official modules
  
  aptsh>



		2.7.3. toupgrade
		================

The toupgade dumps a list of packages installed on your system, which are availa
ble in newer versions. These are packages, which will be upgraded if you run the
 upgrade command.


		2.7.4. Other other commands
		===========================

If a command is not described here, then try to use the help command to get some
 information. It also may appear that it is just a wrapper for a feature of an e
xternal program, then probably more detailed description will be available in do
cumentation of the external program.