bash_profile
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| bash_profile [2026/07/27 19:14] – steve | bash_profile [2026/08/10 19:37] (current) – steve | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| <code bash .bash_profile> | <code bash .bash_profile> | ||
| # | # | ||
| + | echo ' | ||
| PersonalServer=usmifmomlnxv001 | PersonalServer=usmifmomlnxv001 | ||
| - | Host=$(hostname -s) | + | Tmp="$(hostname -s)" |
| + | Host=" | ||
| # | # | ||
| # | # | ||
| # Set our time-zone; | # Set our time-zone; | ||
| export TZ=" | export TZ=" | ||
| - | + | ||
| - | # Set defaults for the history file big and per machine. | + | # Below doesn' |
| - | HISTTIMEFORMAT=" | + | |
| - | # Above doesn' | + | |
| # file, only what it looks like with the history command. | # file, only what it looks like with the history command. | ||
| + | HISTTIMEFORMAT=" | ||
| + | # Set defaults for the history file big and per machine. | ||
| HISTSIZE=11000 | HISTSIZE=11000 | ||
| HISTDIR=${HOME}/ | HISTDIR=${HOME}/ | ||
| Line 18: | Line 20: | ||
| # Should exist, but just to be certain. | # Should exist, but just to be certain. | ||
| HISTFILE=${HISTDIR}/ | HISTFILE=${HISTDIR}/ | ||
| - | + | ||
| - | # And a thing to make and save logs, use like; | + | |
| - | # <some program> | LOG | + | |
| - | # Output goes to screen and log. | + | |
| - | LOGFILE=${HISTDIR}/ | + | |
| - | LOG () { | + | |
| - | tee -a ${LOGFILE} | + | |
| - | } | + | |
| - | + | ||
| function | function | ||
| + | # This lets you get the history for a machine you aren't on at the | ||
| + | # moment, along with the date and time you ran the command. | ||
| if [ $# -eq 0 ]; then | if [ $# -eq 0 ]; then | ||
| - | | + | |
| else | else | ||
| - | | + | |
| fi | fi | ||
| if [ -e ~/ | if [ -e ~/ | ||
| - | | + | |
| - | do if [[ " | + | do if [[ " |
| - | then date -d " | + | then date -d " |
| - | else echo " | + | else echo " |
| - | fi | + | fi |
| - | done < ~/ | + | done < ~/ |
| else echo "No history for ${Q}". | else echo "No history for ${Q}". | ||
| - | | + | |
| } | } | ||
| + | |||
| + | # And a thing to make and save logs, use like; | ||
| + | # <some program> | LOG | ||
| + | # Output goes to screen and log. | ||
| + | LOGFILE=${HISTDIR}/ | ||
| + | LOG () { | ||
| + | tee -a ${LOGFILE} | ||
| + | } | ||
| + | |||
| function KeyBackup() { | function KeyBackup() { | ||
| sudo tar -czvf / | sudo tar -czvf / | ||
| Line 48: | Line 53: | ||
| sudo rm / | sudo rm / | ||
| } | } | ||
| - | + | ||
| alias less=' | alias less=' | ||
| # Above shows ansi colors in log files. | # Above shows ansi colors in log files. | ||
| - | + | ||
| # If we're on the home machine, syncronize with OneDrive. | # If we're on the home machine, syncronize with OneDrive. | ||
| if [ " | if [ " | ||
| - | onedrive --sync | + | |
| + | if [[ $(find / | ||
| + | onedrive --sync | ||
| + | touch / | ||
| + | echo ' | ||
| + | fi | ||
| fi | fi | ||
| - | + | ||
| + | # And, while we're here, how are the backups doing? | ||
| + | if [ " | ||
| + | Files=( / | ||
| + | if [[ -e " | ||
| + | egrep --color=never ' | ||
| + | echo ' | ||
| + | fi | ||
| + | fi | ||
| alias ls='ls --time-style=" | alias ls='ls --time-style=" | ||
| alias ll='ls -l' | alias ll='ls -l' | ||
| alias l='ls -altr' | alias l='ls -altr' | ||
| alias Rel=' | alias Rel=' | ||
| - | alias Diary=' | + | alias Diary=' |
| alias Disks=' | alias Disks=' | ||
| alias IP='ip a | grep -E "inet\ |inet6\ "' | alias IP='ip a | grep -E "inet\ |inet6\ "' | ||
| alias Free=' | alias Free=' | ||
| alias Last=' | alias Last=' | ||
| + | [ -e / | ||
| alias P=' | alias P=' | ||
| alias Users=' | alias Users=' | ||
| - | alias Root=' | + | alias Root=' |
| + | alias RW=' | ||
| alias Count=' | alias Count=' | ||
| alias Who=' | alias Who=' | ||
| alias Wttr=' | alias Wttr=' | ||
| - | + | ||
| - | cat /etc/*ease | grep PRETTY | cut -d " | + | Rel=$(cat /etc/os-release |
| - | + | ||
| + | # This line does a good job of identifying what we're running on | ||
| + | Platform=$(cat / | ||
| + | if [ -z " | ||
| + | Platform=$(dmesg | grep -Ei ' | ||
| + | fi | ||
| + | |||
| + | if [ -z " | ||
| + | Platform=$(hostnamectl | grep -i ' | ||
| + | fi | ||
| if [ -d ~/bin ] | if [ -d ~/bin ] | ||
| then | then | ||
| PATH=" | PATH=" | ||
| fi | fi | ||
| - | + | ||
| if [ -d ~/ | if [ -d ~/ | ||
| then | then | ||
| PATH=" | PATH=" | ||
| fi | fi | ||
| - | + | ||
| - | echo ' | + | echo ${Rel} on ${Platform} |
| - | + | echo ' | |
| + | |||
| + | echo -n " | ||
| + | ip route get 1.1.1.1 | awk ' | ||
| + | echo ' | ||
| + | |||
| + | echo ' | ||
| + | echo ' | ||
| # And, finally, if we're on the home machine, run ~/.sshrc | # And, finally, if we're on the home machine, run ~/.sshrc | ||
| if [ " | if [ " | ||
| Line 95: | Line 134: | ||
| fi | fi | ||
| fi | fi | ||
| - | + | ||
| # If dealing with systemctl unit files, export vim as editor if it exists; | # If dealing with systemctl unit files, export vim as editor if it exists; | ||
| if [ -e / | if [ -e / | ||
| Line 101: | Line 140: | ||
| export SYSTEMD_EDITOR=/ | export SYSTEMD_EDITOR=/ | ||
| fi | fi | ||
| - | + | ||
| # For a multi-line prompt that can easily be copied and pasted; | # For a multi-line prompt that can easily be copied and pasted; | ||
| export PS1=" | export PS1=" | ||
| - | + | ||
| - | # vim: | + | # vim: |
| + | </ | ||
bash_profile.1785179665.txt.gz · Last modified: by steve
