mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
Merge pull request #384 from underwoo/no-notify-send-check
- lib/bourne-shell: Add check for notify-send command prior to setting alert alias - aliases/misc: Do not assume the absolute path of executables - aliases/misc: Check the existence of executables for aliases - aliases/misc: Add source information
This commit is contained in:
@ -1,6 +1,12 @@
|
||||
#! bash oh-my-bash.module
|
||||
# ---------------------------------------------------------------------------
|
||||
#------------------------------------------------------------------------------
|
||||
# Note on copyright (2022-08-23): The aliases defined in this file seems to
|
||||
# originally come from a blog post [1]. See also the comments in lib/base.sh.
|
||||
#
|
||||
# [1] Nathaniel Landau, "My Mac OSX Bash Profile",
|
||||
# https://natelandau.com/my-mac-osx-bash_profile/, 2013-07-02.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# Description: This file holds many useful BASH aliases and save our lives!
|
||||
#
|
||||
# Sections:
|
||||
@ -15,7 +21,7 @@
|
||||
#
|
||||
# X. Reminders & Notes
|
||||
#
|
||||
# ---------------------------------------------------------------------------
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# -------------------------------
|
||||
# 1. FILE AND FOLDER MANAGEMENT
|
||||
@ -63,21 +69,23 @@ alias qfind="find . -name " # qfind: Quickly search for file
|
||||
# 4. NETWORKING
|
||||
# ---------------------------
|
||||
|
||||
alias netCons='lsof -i' # netCons: Show all open TCP/IP sockets
|
||||
alias lsock='sudo /usr/sbin/lsof -i -P' # lsock: Display open sockets
|
||||
alias lsockU='sudo /usr/sbin/lsof -nP | grep UDP' # lsockU: Display only open UDP sockets
|
||||
alias lsockT='sudo /usr/sbin/lsof -nP | grep TCP' # lsockT: Display only open TCP sockets
|
||||
alias ipInfo0='ifconfig getpacket en0' # ipInfo0: Get info on connections for en0
|
||||
alias ipInfo1='ifconfig getpacket en1' # ipInfo1: Get info on connections for en1
|
||||
alias openPorts='sudo lsof -i | grep LISTEN' # openPorts: All listening connections
|
||||
alias showBlocked='sudo ipfw list' # showBlocked: All ipfw rules inc/ blocked IPs
|
||||
alias netCons='lsof -i' # netCons: Show all open TCP/IP sockets
|
||||
alias lsock='sudo lsof -i -P' # lsock: Display open sockets
|
||||
alias lsockU='sudo lsof -nP | grep UDP' # lsockU: Display only open UDP sockets
|
||||
alias lsockT='sudo lsof -nP | grep TCP' # lsockT: Display only open TCP sockets
|
||||
alias openPorts='sudo lsof -i | grep LISTEN' # openPorts: All listening connections
|
||||
alias showBlocked='sudo ipfw list' # showBlocked: All ipfw rules inc/ blocked IPs
|
||||
if _omb_util_binary_exists ifconfig; then
|
||||
alias ipInfo0='ifconfig getpacket en0' # ipInfo0: Get info on connections for en0
|
||||
alias ipInfo1='ifconfig getpacket en1' # ipInfo1: Get info on connections for en1
|
||||
fi
|
||||
|
||||
|
||||
# ---------------------------------------
|
||||
# 5. SYSTEMS OPERATIONS & INFORMATION
|
||||
# ---------------------------------------
|
||||
|
||||
alias mountReadWrite='/sbin/mount -uw /' # mountReadWrite: For use when booted into single-user
|
||||
alias mountReadWrite='mount -uw /' # mountReadWrite: For use when booted into single-user
|
||||
|
||||
|
||||
# ---------------------------------------
|
||||
@ -101,11 +109,14 @@ alias weeknum='date +%V'
|
||||
# 8. WEB DEVELOPMENT
|
||||
# ---------------------------------------
|
||||
|
||||
alias apacheEdit='sudo edit /etc/httpd/httpd.conf' # apacheEdit: Edit httpd.conf
|
||||
alias apacheRestart='sudo apachectl graceful' # apacheRestart: Restart Apache
|
||||
alias editHosts='sudo edit /etc/hosts' # editHosts: Edit /etc/hosts file
|
||||
alias herr='tail /var/log/httpd/error_log' # herr: Tails HTTP error logs
|
||||
alias apacheLogs="less +F /var/log/apache2/error_log" # Apachelogs: Shows apache error logs
|
||||
|
||||
if _omb_util_binary_exists apachectl; then
|
||||
alias apacheEdit='sudo edit /etc/httpd/httpd.conf' # apacheEdit: Edit httpd.conf
|
||||
alias apacheRestart='sudo apachectl graceful' # apacheRestart: Restart Apache
|
||||
alias herr='tail /var/log/httpd/error_log' # herr: Tails HTTP error logs
|
||||
alias apacheLogs="less +F /var/log/apache2/error_log" # Apachelogs: Shows apache error logs
|
||||
fi
|
||||
|
||||
# ---------------------------------------
|
||||
# 9. OTHER ALIASES
|
||||
|
@ -74,7 +74,9 @@ fi
|
||||
|
||||
# Add an "alert" alias for long running commands. Use like so:
|
||||
# sleep 10; alert
|
||||
_omb_util_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$//'\'')"'
|
||||
if _omb_util_binary_exists notify-send; then
|
||||
_omb_util_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$//'\'')"'
|
||||
fi
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
|
Reference in New Issue
Block a user