/
bashrc
executable file
·17135 lines (13862 loc) · 549 KB
/
bashrc
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
######################################################################################################################################################
################################### MY BASHRC FILE ################################### MY BASHRC FILE ################################### MY BASHRC FILE
######################################################################################################################################################
##################################################
# 'About' section for 'The Ultimate Bashrc File' #
##################################################
function about() {
cat <<EOF
##################################################
# #
# The Ultimate Bashrc File #
# .bashrc #
# Creator: Inameiname #
# Version: 4.2 #
# Last modified: 13 February 2014 #
# License: GPLv3+ #
# #
# Layout of this file: #
# MY BASHRC FILE #
# ├── <This Intro/About Section> #
# ├── ORIGINAL CONTENT #
# ├── CUSTOM STARTS HERE #
# │ ├── MISCELLANEOUS #
# │ ├── COMMAND PROMPT & CLI #
# │ ├── BASH SETTINGS #
# │ ├── COMPLETIONS #
# │ ├── FUNCTIONS #
# │ ├── ALIASES #
# │ └── MY CUSTOM STARTS HERE (put own here) #
# └── BASHRC ENDS HERE #
# #
# Latest Changes: #
# 4.2 - 13/02/14 - Added Liquid Prompt option; #
# Updates; added several aliases/functions; #
# now including several of my custom aliases and #
# functions, contingent on having my custom #
# nautilus-/nemo- scripts #
# 4.0+ - 27/11/13 - Tweaks for Ubuntu Saucy / #
# Linux Mint Petra #
# 4.0+ - 01/10/13 - Tweaks for Ubuntu Raring / #
# Linux Mint Olivia #
# 4.0+ - 12/09/12 - video_record, webcam_record #
# updated tv-monitor-switch-end and #
# tv-monitor-switch-start; ntm; remastersys-gtk #
# #
# Descripton: #
# For those who love using the terminal, here is #
# a '.bashrc' file I created, mainly for those #
# who've had issues with their own. Hopefully #
# it'll benefit those of whom love aliases, #
# functions, and such. Probably more than you #
# need, so modify all you want. I've organized it#
# best I can to make it easier for using and #
# modification. This is also for those many #
# who've had a difficult time finding a good #
# source for their own on the net, like it was #
# for me. #
# Oh, and any modifications that others wish to #
# share are always welcome. #
# #
# Installation Instructions: #
# Just extract the tar file and put in your #
# home directory. You may have to overwrite the #
# current one, so be sure to backup whatever #
# beforehand. FYI, the default text in the #
# '.bashrc' is included in this version so if #
# you haven't modified it at all, you should #
# have nothing to worry about. #
# To refresh it, just type in the terminal: #
# source ~/.bashrc #
# ...or just close and open your terminal window.#
# #
# License: #
# This program is free software; you can #
# redistribute it and/or modify it under the #
# terms of the GNU General Public License as #
# published by the Free Software Foundation; #
# either version 3 of the License, or (at your #
# option) any later version. #
# #
# This program is distributed in the hope that it#
# will be useful, but WITHOUT ANY WARRANTY; #
# without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR #
# PURPOSE. See the GNU General Public License #
# for more details. #
# #
# Credits: #
# Found through various sources (including #
# several things by me). I credit when I can. #
# Commented-out stuff is what I personally do not#
# need, so use at your own risk. #
# Feel free to copy, share, tweak, eat, or #
# whatever. Just remember to give credit, as I #
# have put a lot of work into this. Enjoy. #
# #
##################################################
EOF
}
##################################################
##################################################
##################################################
######################################################################################################################################################
#----- ORIGINAL CONTENT ------ ORIGINAL CONTENT ------ ORIGINAL CONTENT ------ ORIGINAL CONTENT ------ ORIGINAL CONTENT ------ ORIGINAL CONTENT ------
######################################################################################################################################################
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
######################################################################################################################################################
#----- CUSTOM STARTS HERE ------ CUSTOM STARTS HERE ------ CUSTOM STARTS HERE ------ CUSTOM STARTS HERE ------ CUSTOM STARTS HERE ------ CUSTOM STARTS HERE
######################################################################################################################################################
######################################################################################################################################################
###### MISCELLANEOUS ###### MISCELLANEOUS ###### MISCELLANEOUS ###### MISCELLANEOUS ###### MISCELLANEOUS ###### MISCELLANEOUS ###### MISCELLANEOUS ######
######################################################################################################################################################
if [ "$PS1" ]; then # if running interactively, then run till 'fi' at EOF:
# source ~/.bashlocalrc # settings that vary per workstation
OS=$(uname) # for resolving pesky os differing switches
######################################################################################################################################################
###### COMMAND PROMPT & CLI ###### COMMAND PROMPT & CLI ###### COMMAND PROMPT & CLI ###### COMMAND PROMPT & CLI ###### COMMAND PROMPT & CLI ######
######################################################################################################################################################
##################################################
# Prompt escapes #
##################################################
# Bash allows these prompt strings to be customized by inserting a
# number of backslash-escaped special characters that are
# decoded as follows:
# \a an ASCII bell character (07)
# \d the date in "Weekday Month Date" format (e.g., "Tue May 26")
# \D{format} the format is passed to strftime(3) and the result
# is inserted into the prompt string an empty format
# results in a locale-specific time representation.
# The braces are required
# \e an ASCII escape character (033)
# \h the hostname up to the first `.'
# \H the hostname
# \j the number of jobs currently managed by the shell
# \l the basename of the shell's terminal device name
# \n newline
# \r carriage return
# \s the name of the shell, the basename of $0 (the portion following
# the final slash)
# \t the current time in 24-hour HH:MM:SS format
# \T the current time in 12-hour HH:MM:SS format
# \@ the current time in 12-hour am/pm format
# \A the current time in 24-hour HH:MM format
# \u the username of the current user
# \v the version of bash (e.g., 2.00)
# \V the release of bash, version + patch level (e.g., 2.00.0)
# \w the current working directory, with $HOME abbreviated with a tilde
# \W the basename of the current working directory, with $HOME
# abbreviated with a tilde
# \! the history number of this command
# \# the command number of this command
# \$ if the effective UID is 0, a #, otherwise a $
# \nnn the character corresponding to the octal number nnn
# \\ a backslash
# \[ begin a sequence of non-printing characters, which could be used
# to embed a terminal control sequence into the prompt
# \] end a sequence of non-printing characters
#
# The command number and the history number are usually different:
# the history number of a command is its position in the history
# list, which may include commands restored from the history file
# (see HISTORY below), while the command number is the position in
# the sequence of commands executed during the current shell session.
# After the string is decoded, it is expanded via parameter
# expansion, command substitution, arithmetic expansion, and quote
# removal, subject to the value of the promptvars shell option (see
# the description of the shopt command under SHELL BUILTIN COMMANDS
# below).
##################################################
# Color chart #
##################################################
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
bldred='\e[1;31m' # Red
bldgrn='\e[1;32m' # Green
bldylw='\e[1;33m' # Yellow
bldblu='\e[1;34m' # Blue
bldpur='\e[1;35m' # Purple
bldcyn='\e[1;36m' # Cyan
bldwht='\e[1;37m' # White
unkblk='\e[4;30m' # Black - Underline
undred='\e[4;31m' # Red
undgrn='\e[4;32m' # Green
undylw='\e[4;33m' # Yellow
undblu='\e[4;34m' # Blue
undpur='\e[4;35m' # Purple
undcyn='\e[4;36m' # Cyan
undwht='\e[4;37m' # White
bakblk='\e[40m' # Black - Background
bakred='\e[41m' # Red
badgrn='\e[42m' # Green
bakylw='\e[43m' # Yellow
bakblu='\e[44m' # Blue
bakpur='\e[45m' # Purple
bakcyn='\e[46m' # Cyan
bakwht='\e[47m' # White
txtrst='\e[0m' # Text Reset
##################################################
# This bashrc's current prompt #
##################################################
PS1='\[\033]0;\w\007\]\[\e[35;1m\]\u\[\e[0m\]\[\e[32m\]@\h\[\e[34m\]\w \[\e[33m\]\$ \[\e[0m\]' # purple, green, blue prompt w/default black & dir title
##################################################
# More command prompt choices (CHOOSE ONE, either#
# one of single lines below, or one of the #
# fancier ones farther below - just uncomment #
# one want and comment mine above) #
##################################################
# PS1='\[\033[01;31m\]\u\[\033[01;36m\]@\[\033[01;32m\]\h\[\033[01;33m\]:\[\033[01;33m\]\w\n\[\033[01;31m\]\$ \[\033[00;32m\]' # red, cyan, green, yellow with green output
# PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] " # green and blue prompt with pc name & default black output
# PS1="\[\033[0;31m\][\u] [ \w ] \[\033[0m\] \n # " # red with default black output (2-tier)
# PS1="\[\033[0;33m\][\!]\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u.\h: \`if [[ `pwd|wc -c|tr -d " "` > 18 ]]; then echo "\\W"; else echo "\\w"; fi\`]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007" # yellow and green with default black output
# PS1="\[\033[0;33m\][\!]\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u.\h: \`if [[ `pwd|wc -c|tr -d " "` > 18 ]]; then echo "\\W"; else echo "\\w"; fi\`]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007" # yellow, green, w/black output w/color change upon bad command
# PS1="\[\033[0;34m\][\u] \[\033[0;0m\]\w \[\033[0m\]$ " # blue username and default black output
# PS1="\[\033[0;34m\][\u] \[\033[0;31m\][ \w ] \[\033[0m\] \n >> " # blue and red with default black output (2-tier)
# PS1="\[\033[0;34m\][\u] \[\033[0;33m\][ \t ] \[\033[0;31m\][ \w ] \[\033[0m\] \n >> " # blue, yellow, red with default black output (2-tier)
# PS1='\[\033[1;30m\][\[\033[0;37m\]${PIPESTATUS}\[\033[1;30m\]:\[\033[0;37m\]${SHLVL}\[\033[1;30m\]:\[\033[0;37m\]\j\[\033[1;30m\]][\[\033[1;34m\]\u\[\033[0;34m\]@\[\033[1;34m\]\h\[\033[1;30m\]:\[\033[0;37m\]`tty | sed s/\\\\\/dev\\\\\/\//g`\[\033[1;30m\]]\[\033[0;37m\][\[\033[1;37m\]\W\[\033[0;37m\]]\[\033[1;30m\] \$\[\033[00m\] ' # grey and blue with default black output
# PS1="[\[\033[1;34m\]\u\[\033[0m\]@\h \W]\\$ " # blue username with default colors (black)
# PS1="[\!] \033[1;36m[ \u@\h ]\033[1;32m\] [ \t ] [ \d ]\n\033[1;33m\[[ \w ] \033[00m\\n\[\e[30;1m\](\[\e[32;1m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, \$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[30;1m\]) \[\e[0m\] $: " # black, cyan, green, yellow, default black output (2-tier)
# PS1="[\[\033[32m\]\w]\[\033[0m\]\n\[\033[1;36m\]\u\[\033[1;33m\]-> \[\033[0m\]" # black, green, cyan, yellow, w/black output w/full path (2-tier)
# PS1="\[\033[34m\] \u@\h `tty | sed 's/\/dev\///'` \t \d \[\033[35m\]\w/ \n\[\033[34m\] $\[\033[0m\] " # cyan with green output
# PS1="\[\033[35m\]\t\[\033[m\]-\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ " # purple, cyan, black, green, yellow, default black
# PS1="\[\033[35m\]\t\[\033[m\]-\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ " # purple, cyan, black, green, yellow, w/black output
# PS1="\[\033[36m\] \u@\h `tty | sed 's/\/dev\///'` \t \d \[\033[32m\]\w/ \n\[\033[36m\] $\[\033[0m\] " # blue with purple output
# PS1=">\[\033[s\]\[\033[1;\$((COLUMNS-4))f\]\$(date +%H:%M)\[\033[u\]" # trimmed up prompt with clock using default colors (black)
# PS1='C:${PWD//\//\\\}>' # change prompt to MS-DOS one (joke)
# PS1='${debian_chroot:+($debian_chroot)}\[[ \033[01;31m\]\w\[\033[00m\]] ' # basic red with default black output
# PS1='\[\e[0;31m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[0;31m\]\$ \[\e[m\]\[\e[0;32m\]' # red and blue prompt with green output
# PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] \[\e[1;37m\]' # green and blue prompt with light grey output
# PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\]' # green and blue prompt with default black output
# PS1='\e[1;31;47m\u \e[1;32;47mon \h \e[1;35;47m\d \@\e[0;0m\n\e[1;31m[dir.= \w] \# > \e[0;0m' # red, green, purple, red with default black output
# PS1='\[\e[1;31m\][\[\e[0;37m\]\u\[\e[1;31m\]@\[\e[0;37m\]\h \W\[\e[1;31m\]]\$\[\e[0m\] ' # red and grey with default black output
# PS1='\[\e[1;31m\][\u@\h \W]\$\[\e[0m\] ' # red color with default black output
# PS1='\[\e[1;32m\]\u@\H:\[\e[m\] \[\e[1;37m\]\w\[\e[m\]\n\[\e[1;33m\]hist:\! \[\e[0;33m\] \[\e[1;31m\]jobs:\j \$\[\e[m\] ' # green, yellow, red, grey and default black output (2-tier)
# PS1='\[\e[1;32m\]\u@\H:\[\e[m\] \[\e[1;37m\]\w\[\e[m\]\n\[\e[1;33m\]hist:\! \[\e[0;33m\] \[\e[1;31m\]jobs:\j \$\[\e[m\] ' # green, yellow, red, w/black output (2-tier) w/background job count
# PS1='\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] ' # green color with default black output
# PS1='\e[1;33;47m\u \e[1;32;47mon \h \e[1;35;47m\d \@\e[0;0m\n\e[1;34m[dir.= \w] \# > \e[0;0m' # yellow, green, purple, cyan with default black output
# PS1="\[\e[1;33m\] > \[\033[0m\]" # basic yellow with default black output & nothing else
# PS1='\[\e[1m\]\h:\w\$\[\e[0m\] ' # black-bold with default colors (black)
# PS1="\[\e]2;\u@\H \w\a\e[30;1m\]>\[\e[0m\] " # trimmed up prompt w/black arrow & title is current dir.
# PS1="\[\e[30;1m\]\w> \[\e[0m\]" # trimmed up prompt with just black arrow and default colors
# PS1="\[\e[36;1m\]\u@\[\e[32;1m\]\H> \[\e[0m\]" # cyan and green prompt with default black output
# PS1="\[\e[37;1m\]-{\[\e[34;1m\]\u@\h\[\e[37;1m\]}-\n\[\e[37;1m\](\[\e[34;1m\]\w: \$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, \$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[37;1m\])\n--> \[\e[0m\]" # grey and cyan w/black output (2-tier) w/dir size
# PS1='\[\e[41m\]\[\e[1;37m\] \u \[\e[47m\]\[\e[1;30m\] \W \[\e[0m\]\[\e[1;37m\]\[\e[42m\] # \[\033[0m\] ' # red, grey, green boxed with default black
# PS1='\[\e[45m\]\[\e[1;37m\] \u@\h \[\e[47m\]\[\e[1;30m\] \W \[\e[0m\]\[\e[1;37m\]\[\e[42m\] > \[\033[0m\] ' # purple, grey, green boxed with default black
# PS1='\[\e[m\n\e[0;33m\][$$:$PPID \j:\!\[\e[0;33m\]]\[\e[0;36m\] \T \d \[\e[1;34m\][\[\e[1;34m\]\u@\H\[\e[1;31m\]:\[\e[0;37m\]${SSH_TTY} \[\e[0;32m\]+${SHLVL}\[\e[1;30m\]] \[\e[1;31m\]\w\[\e[0;30m\] \n($SHLVL:\!)\$ ' # yellow, cyan, red, blue, white, green, black, red w/ default black output
# PS1="\`if [ \$? = 0 ]; then echo \[\e[33m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi\`[\u@\h:\w]\\$ " # all black with happy face (yellow/red) upon successful completion
# PS1="\`if [ \$? = 0 ]; then echo \[\e[33m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi\`[\u@\h:\w]\\$ " # basic prompt but with yellow smiley
# PS1="\n\[\033[32;1m\]It's \t\[\033[33;1m\] Currently browsing \[\033[1;36m\]\w \[\033[33;1m\]directory\n\[\033[34;1m\]\`if [ \$? = 0 ]; then echo \[\e[37m\]Last Command Was Successfully Executed \[\e[32m\]^_^\[\e[0m\]; else echo \[\e[37m\]Smeggin Hell !!! Last Command Was Unknown \[\e[32m\]O_O\[\e[0m\]; fi\` \n\[\033[31m\]What is thy bidding, my master? \n\n\[\033[34;1m\]" # green, yellow, grey, green, red, w/cyan output (3-tier) Star Wars version
# PS1="\n\[\033[35m\]\$(/bin/date)\n\[\033[32m\]\w\n\[\033[1;31m\]\u@\h: \[\033[1;34m\]\$(/usr/bin/tty | /bin/sed -e 's:/dev/::'): \[\033[1;36m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files \[\033[1;33m\]\$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\033[0m\] -> \[\033[0m\]" - purple, green, blue, cyan, yellow, with default black output (3-tier)
# PS1="\n\[\033[35m\]\$(/bin/date)\n\[\033[32m\]\w\n\[\033[1;31m\]\u@\h: \[\033[1;34m\]\$(/usr/bin/tty | /bin/sed -e 's:/dev/::'): \[\033[1;36m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files \[\033[1;33m\]\$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\033[0m\] -> \[\033[0m\]" # purple, red, blue, cyan, yellow, w/white output (3-tier)
# PS1="\n\[$bldgrn\][\[$txtrst\]\w\[$bldgrn\]]\[$bldwht\]\n\[$bldwht\][\[$txtrst\]\t\[$bldwht\]]\[$bldylw\]$ \[$txtrst\]" # green, black, grey, yellow with default black output (3-tier)
# PS1="\n#--[\[\e[1;36m\]\u@\h\[\e[m\]]-[\[\e[1;34m\]\w\[\e[m\]]-[\$(date +%k:%M)]-->\n" # black, cyan, blue, black, w/black output (2-tier)
# PS1="\n\[\e[30;1m\]\[\016\]l\[\017\](\[\e[34;1m\]\u@\h\[\e[30;1m\])-(\[\e[34;1m\]\j\[\e[30;1m\])-(\[\e[34;1m\]\@ \d\[\e[30;1m\])->\[\e[30;1m\]\n\[\016\]m\[\017\]-(\[\[\e[32;1m\]\w\[\e[30;1m\])-(\[\e[32;1m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, \$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[30;1m\])--> \[\e[0m\]" # grey, cyan, green, w/black output (2-tier) w/ dir. info
# PS1="\n\[\e[30;1m\]?(\[\e[34;1m\]\u@\h\[\e[30;1m\])-(\[\e[34;1m\]\j\[\e[30;1m\])-(\[\e[34;1m\]\@ \d\[\e[30;1m\])->\[\e[30;1m\]\n??(\[\e[32;1m\]\w\[\e[30;1m\])-(\[\e[32;1m\]$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, $(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[30;1m\])--> \[\e[0m\]" # black, cyan, green w/black output (2-tier)
# PS1="\n\[\e[32;1m\](\[\e[37;1m\]\u\[\e[32;1m\])-(\[\e[37;1m\]jobs:\j\[\e[32;1m\])-(\[\e[37;1m\]\w\[\e[32;1m\])\n(\[\[\e[37;1m\]! \!\[\e[32;1m\])-> \[\e[0m\]" # grey and green with default black output (3-tier)
# PS1="\n\[\e[m\][\[\033[01;32m\]\w\[\e[m\]] [\t] \n\[\033[01;33m\]$ \[\033[00m\]" # green, black, yellow, with default black output (3-tier)
# PS1="\t \u@\h\$ " # simple prompt with time (black)
# PS1="\t \u@\h `tty | sed 's/\/dev\///'` \w \$ " # longer prompt with time (black)
# PS1="\u@\h\$ " # simple default prompt (black)
# PS1="\u@\h `tty | sed 's/\/dev\///'` \w \$ " # longer prompt with brief info (black)
# PS1='[\u@\h \W]\$ ' # default colors (black)
# PS1="\u@\h [\w] \$ " # simple prompt with directory (black)
# PS1="\u `tty | sed 's/\/dev\///'` [\W] \$ " # prompt with brief info (black)
##################################################
# Jsnx's prompt of power (disabled by a single #
# "#") #
##################################################
## I used to have the prompt set up as a bunch of functions; but that
## didn't work very well with sh. Now, I have mastered the various
## levels of evaluation and quoting of the shell and can confidently
## write hideous macros!
# DARK="\[\e[01;34m\]"
# NORM="\[\e[01;32m\]"
# FADE="\[\e[01;30m\]"
# REST="\[\e[00;00m\]"
# HIGH="\[\e[01;33m\]"
# dir="pwd -P | awk '{ printf \"%-65.65s\", \$1 }'"
# sub="sed -r 's/^/$NORM/ ; s|/|$FADE&$NORM|g ; s/:/$DARK&$NORM/g'"
# t="date +%H:%M"
# hist="history 1 | xargs echo '' | awk '{ printf \"%03.3d\", \$1 + 1 }'"
# warn="[ $USER = root ] && echo -n '$HIGH' || echo -n '$FADE'"
# bang="echo -ne '\x21'" ## this gives me a single '!' in bash and sh
# prompt=" $DARK: \`$dir | $sub\` \`$warn;$bang;\`$NORM\`$hist\` \`$t | $sub\`
# $DARK:\`$warn\`; $REST"
# prepend=''
# if [ "${TERM}" = "xterm" ]
# then
# my_tty=`tty | awk -F/ '{ print $3 $4}'`
# xterm_title="\[\e]0;${my_tty} \u@\H\007\]"
# prepend="${xterm_title}"
# fi
## export PROMPT_COMMAND="export PS1=\"${prepend}${prompt}\""
# export PS1="${prepend}${prompt}"
# export PS2=' '
##################################################
# Nate Mitchell's (Kasyx's) Bash Prompt (red with#
# green dashes and black output) (disabled by a #
# single "#") #
##################################################
# function prompt() {
# Black="\e[30m"
# Red="\e[31m"
# Green="\e[32m"
# LightGreen="\e[32;1m"
# Blue="\e[34m"
# LightBlue="\e[34;1m"
# NC="\e[0m" # No Color
# PS1="\[$LightGreen\033(0\154\033(B\][\[\033(0\161\161\033(B$Green\][\[$Red\]\u@\h\[$Green\]]\[\033(0\161\033(B\][\[$Red\]\w\[$Green\]]\[\033(0\161\033(B\][\[$Red\]\!\[$Green\]]\[\033(0\161\161\033(B\]]\n\[$LightGreen\033(0\155\161\033(B$Green\][\[$Red\]\#\[$Green\]]\[\033(0\161\033(B\][\[$Red\]\$\[$Green\]]\[\033(0\161\161\033(B\][\[$NC\]"
# PS2="> "
# }
# prompt
##################################################
# Wolfman's prompt (disabled by a single "#") #
##################################################
## Fancy PWD display function
## The home directory (HOME) is replaced with a ~
## The last pwdmaxlen characters of the PWD are displayed
## Leading partial directory names are striped off
## /home/me/stuff -> ~/stuff if USER=me
## /usr/share/big_dir_name -> ../share/big_dir_name if pwdmaxlen=20
# function bash_prompt_command() {
# # How many characters of the $PWD should be kept
# local pwdmaxlen=25
# # Indicate that there has been dir truncation
# local trunc_symbol=".."
# local dir=${PWD##*/}
# pwdmaxlen=$(( ( pwdmaxlen < ${#dir} ) ? ${#dir} : pwdmaxlen ))
# NEW_PWD=${PWD/#$HOME/\~}
# local pwdoffset=$(( ${#NEW_PWD} - pwdmaxlen ))
# if [ ${pwdoffset} -gt "0" ]
# then
# NEW_PWD=${NEW_PWD:$pwdoffset:$pwdmaxlen}
# NEW_PWD=${trunc_symbol}/${NEW_PWD#*/}
# fi
# }
# function bash_prompt() {
# case $TERM in
# xterm*|rxvt*)
# local TITLEBAR='\[\033]0;\u:${NEW_PWD}\007\]'
# ;;
# *)
# local TITLEBAR=""
# ;;
# esac
# local NONE="\[\033[0m\]" # unsets color to term's fg color
# # regular colors
# local K="\[\033[0;30m\]" # black
# local R="\[\033[0;31m\]" # red
# local G="\[\033[0;32m\]" # green
# local Y="\[\033[0;33m\]" # yellow
# local B="\[\033[0;34m\]" # blue
# local M="\[\033[0;35m\]" # magenta
# local C="\[\033[0;36m\]" # cyan
# local W="\[\033[0;37m\]" # white
# # emphasized (bolded) colors
# local EMK="\[\033[1;30m\]"
# local EMR="\[\033[1;31m\]"
# local EMG="\[\033[1;32m\]"
# local EMY="\[\033[1;33m\]"
# local EMB="\[\033[1;34m\]"
# local EMM="\[\033[1;35m\]"
# local EMC="\[\033[1;36m\]"
# local EMW="\[\033[1;37m\]"
# # background colors
# local BGK="\[\033[40m\]"
# local BGR="\[\033[41m\]"
# local BGG="\[\033[42m\]"
# local BGY="\[\033[43m\]"
# local BGB="\[\033[44m\]"
# local BGM="\[\033[45m\]"
# local BGC="\[\033[46m\]"
# local BGW="\[\033[47m\]"
# local UC=$W # user's color
# [ $UID -eq "0" ] && UC=$R # root's color
## PS1="$TITLEBAR ${EMK}[${UC}\u${EMK}@${UC}\h ${EMB}\${NEW_PWD}${EMK}]${UC}\\$ ${NONE}"
# # without colors: PS1="[\u@\h \${NEW_PWD}]\\$ "
# # extra backslash in front of \$ to make bash colorize the prompt
# }
# PROMPT_COMMAND=bash_prompt_command
# bash_prompt
# unset bash_prompt
##################################################
# Emmanuel Rouat's shell prompt (fancy all #
# black with info) #
##################################################
# if [[ "${DISPLAY%%:0*}" != "" ]]; then
# HILIT=${red} # remote machine: prompt will be partly red
# else
# HILIT=${cyan} # local machine: prompt will be partly cyan
# fi
## --> Replace instances of \W with \w in prompt functions below
## + --> to get display of full path name.
# function fastprompt()
# {
# unset PROMPT_COMMAND
# case $TERM in
# *term | rxvt )
# PS1="${HILIT}[\h]$NC \W > \[\033]0;\${TERM} [\u@\h] \w\007\]" ;;
# linux )
# PS1="${HILIT}[\h]$NC \W > " ;;
# *)
# PS1="[\h] \W > " ;;
# esac
# }
# function _powerprompt()
# {
# LOAD=$(uptime|sed -e "s/.*: \([^,]*\).*/\1/" -e "s/ //g")
# }
#
# function powerprompt()
# {
# PROMPT_COMMAND=_powerprompt
# case $TERM in
# *term | rxvt )
# PS1="${HILIT}[\A - \$LOAD]$NC\n[\u@\h \#] \W > \
# \[\033]0;\${TERM} [\u@\h] \w\007\]" ;;
# linux )
# PS1="${HILIT}[\A - \$LOAD]$NC\n[\u@\h \#] \W > " ;;
# * )
# PS1="[\A - \$LOAD]\n[\u@\h \#] \W > " ;;
# esac
# }
# powerprompt # This is the default prompt -- might be slow.
# # If too slow, use fastprompt instead. ...
##################################################
# Xterm windowdressing (cyan and black with #
# grey output info prompt( (disabled by a #
# single '#') #
##################################################
# function elite()
# {
# local GRAY="\[\033[1;30m\]"
# local LIGHT_GRAY="\[\033[0;37m\]"
# local CYAN="\[\033[0;36m\]"
# local LIGHT_CYAN="\[\033[1;36m\]"
# case $TERM in
# xterm*)
# local TITLEBAR='\[\033]0;\u@\h:\w\007\]'
# ;;
# *)
# local TITLEBAR=""
# ;;
# esac
# local GRAD1=$(tty|cut -d/ -f3)
# PS1="$TITLEBAR\
# $GRAY-$CYAN-$LIGHT_CYAN(\
# $CYAN\u$GRAY@$CYAN\h\
# $LIGHT_CYAN)$CYAN-$LIGHT_CYAN(\
# $CYAN\#$GRAY/$CYAN$GRAD1\
# $LIGHT_CYAN)$CYAN-$LIGHT_CYAN(\
# $CYAN\$(date +%H%M)$GRAY/$CYAN\$(date +%d-%b-%y)\
# $LIGHT_CYAN)$CYAN-$GRAY-\
# $LIGHT_GRAY\n\
# $GRAY-$CYAN-$LIGHT_CYAN(\
# $CYAN\$$GRAY:$CYAN\w\
# $LIGHT_CYAN)$CYAN-$GRAY-$LIGHT_GRAY "
# PS2="$LIGHT_CYAN-$CYAN-$GRAY-$LIGHT_GRAY "
# }
# PROMPT_COMMAND=elite
##################################################
# Another prompt = #
# (PS1="\[\e]2;\u@\H \w\a\e[30;1m\]>\[\e[0m\] #
# " but fixed for various systems - simple #
# prompt that shows currently directory in #
# title) #
##################################################
# if [ "$TERM" = "linux" ]
# then
# # we're on the system console or maybe telnetting in
# export PS1="\[\e[32;1m\]\u@\H > \[\e[0m\]"
# else
# # we're not on the console, assume an xterm
# export PS1="\[\e]2;\u@\H \w\a\e[32;1m\]>\[\e[0m\] "
# fi
##################################################
# Yet another prompt (simple black prompt with #
# the word 'bash$' only) #
##################################################
## Check if running in an xterm and give a more suitable prompt
## (two alternative blocks given below)
## mesg y allows talk(1) requests, here only if not an xterm
## Gives informative prompt, puts user,host,path in xterm title
## Comment or uncomment all of the following lines ('case' to 'esac')
# case $TERM in
# xterm*)
# PS1="\[\033]0;\u@\h: \w\007\]bash\$ "
# ;;
# *)
# PS1="\t \u@\h `tty | sed 's/\/dev\///'`\$ "
# mesg y
# ;;
# esac
##################################################
# Still another prompt (cyan and red with #
# green output info prompt) (disabled by a #
# single '#') #
##################################################
### Colourful prompts
### Comment or uncomment all of the following lines ('case' to 'esac')
## case $TERM in
## xterm*)
## TERM=xterm-color; export TERM
## PS1="\[\033[36m\] \u@my_computer `tty | sed 's/\/dev\///'` \t \d \[\033[35m\]\w/ \n\[\033[36m\] $\[\033[0m\] "
## ;;
## *)
# PS1="`setterm -bold on` \[\033[36m\] \u@my_computer `tty | sed 's/\/dev\///'` \t \d \[\033[1;31m\]\w/ \n\[\033[36m\]! \[\033[1;32m\] `setterm -#bold off`"
# # this adds a bg color; comment out the above
## PS1="\[\033[35m\] \u@my_computer `tty | sed 's/\/dev\///'` \t \d \[\033[32m\]\w/ \n\[\033[36m\] $\[\033[44;1;36m\] `setterm -bold on` "
## mesg y
## ;;
## esac
##################################################
# Liquid Prompt Command #
##################################################
# requires the code for 'liquid prompt', which can
# be gotten using the following commands:
# note: 'acpi' is for temperature
# sudo apt-get install git acpi
# git clone https://github.com/nojhan/liquidprompt.git ~/.liquidprompt
# cp ~/.liquidprompt/liquidpromptrc-dist ~/.config/liquidpromptrc
# . ~/.liquidprompt/liquidprompt
##################################################
# More PROMPT_COMMANDS #
##################################################
###### Annoying PROMPT_COMMAND animation
# PROMPT_COMMAND='seq $COLUMNS | xargs -IX printf "%Xs\r" @'
###### Saves terminal commands in history file in real time (for use with 'shopt -s histappend')
if [ ! -f $HOME/.bash_history ];then touch $HOME/.bash_history;fi # ensure bash history file always there
PROMPT_COMMAND="history -a;$PROMPT_COMMAND" # use with 'shopt -s histappend';save terminal commands in history file in real time
###### Share history between using multiple commands (press enter before get history from other bash shells)
# PROMPT_COMMAND='history -a && history -n'
###### Shows date
# PROMPT_COMMAND='date +%k:%m:%S'
###### Shows memory, load average, and history
# PROMPT_COMMAND='history -a;echo -en "\033[m\033[38;5;2m"$(( `sed -nu "s/MemFree:[\t ]\+\([0-9]\+\) kB/\1/p" /proc/meminfo`/1024))"\033[38;5;22m/"$((`sed -nu "s/MemTotal:[\t ]\+\([0-9]\+\) kB/\1/Ip" /proc/meminfo`/1024 ))MB"\t\033[m\033[38;5;55m$(< /proc/loadavg)\033[m"'
###### Shows the return value of the last executed command (using smileys as to whether it was successful or not)
# PROMPT_COMMAND='RET=$?; if [[ $RET -eq 0 ]]; then echo -ne "\033[0;32m$RET\033[0m ;)"; else echo -ne "\033[0;31m$RET\033[0m ;("; fi; echo -n " "'
##################################################
##################################################
##################################################
######################################################################################################################################################
###### BASH SETTINGS ###### BASH SETTINGS ###### BASH SETTINGS ###### BASH SETTINGS ###### BASH SETTINGS ###### BASH SETTINGS ###### BASH SETTINGS ######
######################################################################################################################################################
# autoload -U compinit # use to enable famous zsh tab-completion system
# compinit # use to enable famous zsh tab-completion system
export BLOCKSIZE=K # set blocksize size
export BROWSER='google-chrome' # set default browser
# export BROWSER='opera' # set default browser
# export BROWSER=$(find_alternatives chromium-browser google-chrome opera firefox firefox-bin iceweasel konqueror w3m lynx) # uses function 'find_alternatives'
export CDDIR="$HOME" # for use with the function 'cd' and the alias 'cdd'
# export CDPATH=.:~:~/src:/etc
# export CDPATH=.:~:~/Dropbox # if you use dropbox from the command line often
# export DISPLAY=:79
# export EDITOR='gedit' # use default text editor
# export EDITOR="gedit -w --resume" Typing 'fc' # open last command for editing in gedit, then execute on save
export EDITOR='vim' # use default text editor
# export ftp_proxy=${MY_PROXY}
# export GPG_TTY='tty' # gpg-agent says it needs this
# export GREP_OPTIONS='-D skip --binary-files=without-match --ignore-case' # most commonly used grep options
export HISTCONTROL=ignoreboth:erasedups # for 'ignoreboth': ignore duplicates and /^\s/
# export HISTCONTROL=ignoreboth # ignore spaced commands and prevents storing of duplicate commands (ie, ignoredups & ignorespace)
# export HISTCONTROL=ignoredups # don't put duplicate lines in the history. See bash(1) for more options
# export HISTCONTROL=ignorespace # will make sure that bash don’t store any command beginning with the space character
# export HISTFILE=/dev/null # disable history for current shell session
# export HISTFILE='$HOME/.history' # set history file location
# export HISTFILESIZE=10000 # increase or decrease the size of the history to '10,000'
# export HISTFILESIZE=${HISTSIZE} # bash will remember 'N' commands
export HISTIGNORE='&:bg:fg:ll:h'
# export HISTIGNORE=' cd "`*: PROMPT_COMMAND=?*?' # define shell variable HISTIGNORE so comments appear in shell history
# export HISTIGNORE='${HISTIGNORE:+$HISTIGNORE:}la:ll:lah:lat:;a:-:fg:bg:j:sync:esu:rma:rmp:fol:pfol'
# export HISTIGNORE="&:ls:[bf]g:exit" # duplicate entries in bash history, as well as ls, bg, fg & exit, making for cleaner bash history
# export HISTIGNORE="&:ls:ll:la:l.:pwd:exit:clear"
# export HISTIGNORE='pwd:cd:ls:ls -l:' # ignore commands given
export HISTSIZE=10000 # increase or decrease the size of the history to '10,000'
# export HISTTIMEFORMAT='| %d/%m/%y %T | ' # make 'History' Show The Date For Each Command
# export HISTTIMEFORMAT='%F %T ' # adds date and time to history
export HISTTIMEFORMAT='%H:%M > '
# export HISTTIMEFORMAT='%s' # the beloved Second of Our Linux
# export HISTTIMEFORMAT='%Y-%b-%d::%Hh:%Mm:%Ss '
export HISTTIMEFORMAT='%Y-%m-%d_%H:%M:%S_%a ' # makes history display in YYYY-MM-DD_HH:MM:SS_3CharWeekdaySpaceSpace format
export HOSTFILE=$HOME/.hosts # put list of remote hosts in ~/.hosts ...
# export http_proxy=${MY_PROXY} # proxy setting
# export https_proxy=${MY_PROXY} # proxy setting
# export IGNOREEOF=1 # prevent CTRL-D from immediately logging out
# export INPUTRC=/etc/inputrc # it's possible that this will make bash find my delete key (and everything else)((but i don't think it did))
# export INPUTRC=$HOME/.inputrc # type in ‘whatever’ and press ‘Page Up’ key and bash automatically fetches last command that starts with whatever and completes the command for you (requires '$HOME/.inputrc' with these lines: #Page up/page down && "\e[5~": history-search-backward && "\e[6~": history-search-forward)
# export LC_COLLATE="en_CA.utf8" # change sorting methods [a-Z] instead of [A-Z]
export LESSCHARSET='latin1'
export LESS='-i -N -w -z-4 -g -e -M -X -F -R -P%t?f%f \'
# export LESSOPEN="|lesspipe.sh %s"; export LESSOPEN
export LESSOPEN='|/usr/bin/lesspipe.sh %s 2>&-' # use this if lesspipe.sh exists
# export LESS="-QR" # tell less not to beep and also display colours
# export LESS='-R'
# export LESS_TERMCAP_mb=$'\E[01;31m' # less colors for Man pages # begin blinking
# export LESS_TERMCAP_md=$'\E[01;38;5;74m' # less colors for Man pages # begin bold
# export LESS_TERMCAP_me=$'\E[0m' # less colors for Man pages # end mode
# export LESS_TERMCAP_se=$'\E[0m' # less colors for Man pages # end standout-mode
# export LESS_TERMCAP_so=$'\E[38;5;246m' # less colors for Man pages # begin standout-mode - info box
# export LESS_TERMCAP_ue=$'\E[0m' # less colors for Man pages # end underline
# export LESS_TERMCAP_us=$'\E[04;38;5;146m' # less colors for Man pages # begin underline
# export LIBGL_DRIVERS_PATH=/usr/lib/xorg/modules/dri # gallium
# export MY_PROXY='http://YOUR_USERNAME:YOUR_PASSWORD@PROXY_IP:PROXY_PORT/'
# export OOO_FORCE_DESKTOP=gnome # openoffice preferences
# export OPERA_KEEP_BLOCKED_PLUGIN=1 # this is the special sauce to enhance flash (on opera's) performance
# export OPERAPLUGINWRAPPER_PRIORITY=0 # this is the special sauce to enhance flash (on opera's) performance
export PAGER='less -e'
# export PATH=$PATH:$HOME/scripts
# export PILOTRATE=57600 # make pilot-xfer go faster than 9600
export TERM='xterm'
export TIMEFORMAT=$'\nreal %3R\tuser %3U\tsys %3S\tpcpu %P\n'
export TMOUT=600 # auto logout after n seconds of inactivity
# export USER_CLIENT=deluge
# export USER_DPRT=22218
# export USER_OPRT=47426
# export USER_VPRT=79
# export USER_WPRT=30818
export VIDEO_FORMAT=NTSC # for use with creating compatible DVDs ('dvdauthor -x dvdauthor.xml' will fail if this not here)
# export VIDEO_FORMAT=PAL # for use with creating compatible DVDs ('dvdauthor -x dvdauthor.xml' will fail if this not here)
export VISUAL='vi'
# export wpsetters=feh
# ${file%\.[^.]*} # to remove filename extensions in bash
# fortune -a # fortunes at each new shell
# mesg n #
set -b # causes output from background processes to be output right away, not on wait for next primary prompt
# set bell-style visible # I hate noise
# set completion-ignore-case on # complete things that have been typed in the wrong case
# set -o ignoreeof # can't c-d out of shell
# set -o noclobber # disallow > to work on files that already exist (prevents catting over file)
set -o notify # notify when jobs running in background terminate
# set -o nounset # attempt to use undefined variable outputs error message and forces exit (messes up completion if enabled)
# set +o nounset # otherwise some completions will fail
# setopt autopushd pushdminus pushdsilent pushdtohome
# setopt correct
# setopt extendedglob
# setopt hist_ignore_space # prepend ' ' to not be saved
# setopt hist_verify # verify when using !
# setopt nocheckjobs # don't complain about background jobs on e
# setopt no_clobber # don't overwrite files when redirect
# setopt nohup # don't kill bg jobs when tty quits
# setopt printexitvalue # print exit value from jobs
# setopt share_history
# set -o xtrace # useful for debuging
# setterm -blength 0 # set the bell duration in milliseconds (silence the beeps)
# set visible-stats on # when listing possible file completions, put / after directory names and * after programs
shopt -s cdable_vars # set the bash option so that no '$' is required (disallow write access to terminal)
shopt -s cdspell # this will correct minor spelling errors in a cd command
shopt -s checkhash
shopt -s checkwinsize # update windows size on command
shopt -s cmdhist # save multi-line commands in history as single line
# shopt -s dotglob # files beginning with . to be returned in the results of path-name expansion
# shopt -s expand aliases # expand aliases
shopt -s extglob # necessary for bash completion (programmable completion)
# shopt -s globstar # enables the ** globbing operator
# shopt -s histappend # bash history is only saved when close terminal, not after each command and this fixes it
shopt -s histappend histreedit histverify
# shopt -s histreedit
# shopt -s histverify
# shopt -s hostcomplete # attempt hostname expansion when @ is at the beginning of a word
# shopt -s huponexit
shopt -s mailwarn # keep an eye on the mail file (access time)
# shopt -s nocaseglob cdspell histappend
shopt -s nocaseglob # pathname expansion will be treated as case-insensitive (auto-corrects the case)
shopt -s no_empty_cmd_completion # no empty completion (bash>=2.04 only)
# shopt -s nullglob dotglob
shopt -s sourcepath
# shopt -u cmdhist # do not treat multiple line commands as a single entry
# shopt -u force_fignore # expand to complete an ignored word, if no other words match.
# shopt -u mailwarn
# shopt -u sourcepath
# stty -ixon # disable XON/XOFF flow control (^s/^q)
stty start undef
stty stop undef
# stty stop '' # use C-s to search forward through history (do not block output)
# ulimit -c unlimited # let me have core dumps
ulimit -S -c 0 # (core file size) don't want any coredumps
# ulimit -S -f 1024 # open files
# ulimit -S -s 8192 # stack size
# ulimit -S -u 256 # max user processes
# umask 007 # all files created 660, dirs 770
# umask 022 # makes new files have permissions: rwxr-xr-x
# umask 077 # after everything is installed, uncomment this and the mkdir alias below ((base 8) 777 & ~077 = 700 = u=rwx,g=,o=)
# unset HISTFILESIZE # infinite History
# unset HISTSIZE # infinite History
unset MAILCHECK # don't want my shell to warn me of incoming mail
# unsetopt bgnice # don't nice bg command
if [ -d $HOME/Maildir/ ]; then
export MAIL=$HOME/Maildir/
export MAILPATH=$HOME/Maildir/
export MAILDIR=$HOME/Maildir/
elif [ -f /var/mail/$USER ]; then
export MAIL="/var/mail/$USER"
fi
if [ "$TERM" = "screen" ]; then
export TERM=$TERMINAL
fi
# if [ "$OS" = "Linux" ]; then
# source ~/.lscolorsrc
# elif [ "$OS" = "Darwin" ]; then
# export LSCOLORS='gxfxcxdxbxegedabagacad'
# fi
function get_xserver()
{
case $TERM in
xterm )
XSERVER=$(who am i | awk '{print $NF}' | tr -d ')''(' )
# Ane-Pieter Wieringa suggests the following alternative:
# I_AM=$(who am i)
# SERVER=${I_AM#*(}
# SERVER=${SERVER%*)}
XSERVER=${XSERVER%%:*}
;;
aterm | rxvt)
# Find some code that works here. ...
;;
esac
}
if [ -z ${DISPLAY:=""} ]; then
get_xserver
if [[ -z ${XSERVER} || ${XSERVER} == $(hostname) || \
${XSERVER} == "unix" ]]; then
DISPLAY=":0.0" # Display on local host.
else
DISPLAY=${XSERVER}:0.0 # Display on remote host.
fi
fi
export DISPLAY
# if [ -f ~/.bash_exports ]; then . ~/.bash_exports ; fi
# if [ -f ~/.bash_functions ]; then . ~/.bash_functions ; fi
# if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases ; fi