-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.bash_aliases.Darwin
108 lines (95 loc) · 6.53 KB
/
.bash_aliases.Darwin
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
# vim: ft=bash noet:
! declare 2>&1 | grep -wq ^colors= && [ $BASH_VERSINFO -ge 4 ] && source $initDir/.colors
test "$debug" -gt 0 && echo "=> Running $bold${colors[blue]}$(basename ${BASH_SOURCE[0]})$normal ..."
wiFiInterface="$(networksetup -listallhardwareports | awk '/Hardware Port: Wi-Fi/{getline; print $2}')"
#alias mac@="\networksetup -getmacaddress \$wiFiInterface | awk '{print\$3}'"
#alias lpr="\lpr -P ppti-14-503-imp -o PageSize=A4 -o PageRegion=A4 -o Resolution=default -o InputSlot=Tray2 -o Duplex=DuplexNoTumble -o PreFilter=No"
#alias lpr="\lpr -o PageSize=A4 -o PageRegion=A4 -o Resolution=default -o InputSlot=Tray2 -o Duplex=DuplexNoTumble -o PreFilter=No"
alias airport="\/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport"
alias firefoxDefrag='pgrep firefox || find ~/"Library/Application Support/Firefox" -name "*sqlite" -ls -exec sqlite3 {} vacuum \;'
alias firefox="/Applications/Firefox.app/Contents/MacOS/firefox"
alias palemoon="/Applications/Palemoon.app/Contents/MacOS/palemoon"
type -P pgrep >/dev/null 2>&1 || alias pgrep="\ps -fC"
ggrep -V 2>/dev/null | \grep -wq GNU && alias grep="\ggrep --color" && alias Pgrep="grep -P"
alias egrep="grep -E"
alias rgrep=$'rg -uu -g !.git/'
alias rgrepFollowSymLinks='time grep -IR --exclude-dir=.git'
alias zegrep="zgrep -E"
alias addgroup="\dseditgroup -o create"
alias groupadd=addgroup
alias adduser="\dseditgroup -o edit -t user -a"
alias useradd=adduser
alias catFiles="\tail -n +1"
alias cpuInfo="\sysctl machdep.cpu | egrep 'brand_string|count|size|VMX|SVM'"
alias diskInfo="\diskutil list"
alias df="\df -Ph"
#alias df="\gdf -PTh"
alias dnsInfo="\scutil --dns"
alias findDeadLinks='$find . -xtype l -exec ls -G -l {} +'
type -P gcp >/dev/null 2>&1 && alias cp='\gcp -pv' || alias cp='\cp -pv'
alias graphicsinfo="\system_profiler SPDisplaysDataType"
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
alias hwinfo="\system_profiler SPHardwareDataType"
alias serialNumber="\system_profiler SPHardwareDataType -json | jq -r '.SPHardwareDataType[0].serial_number'"
alias macmodel="\system_profiler SPHardwareDataType -json | jq -r '.SPHardwareDataType[0].machine_model'"
#alias lshw="\system_profiler SPHardwareDataType SPSoftwareDataType SPParallelATADataType SPAudioDataType SPBluetoothDataType SPCameraDataType SPDiscBurningDataType SPEthernetDataType SPFibreChannelDataType SPFireWireDataType SPDisplaysDataType SPHardwareRAIDDataType SPNetworkLocationDataType SPManagedClientDataType SPMemoryDataType SPNVMeDataType SPNetworkDataType SPPCIDataType SPParallelSCSIDataType SPPowerDataType SPPrintersDataType SPSASDataType SPSerialATADataType SPSPIDataType SPStorageDataType SPThunderboltDataType SPUSBDataType SPWWANDataType SPAirPortDataType SPiBridgeDataType"
alias lastme='last -t console | \grep $USER'
alias lastmeToday='lastme | \grep "$(LC_TIME=C date +%b\ %_d)"'
alias lshw='\system_profiler -detailLevel mini | sed "/^Printer Software:/,/^ *Library Extensions/d"'
alias lsvga="\system_profiler SPDisplaysDataType"
alias l="\ls -G"
alias ldd="\otool -L"
alias ll="ls -blF -T"
alias ls="ls -GF"
alias lsusb="\system_profiler SPUSBDataType"
alias more="\more -r"
alias osinfo="\system_profiler SPSoftwareDataType;\system_profiler SPInstallHistoryDataType | \grep Install.macOS"
alias pip2Install="curl -s https://bootstrap.pypa.io/get-pip.py | python2"
alias pip2Update="pip2 install -U pip"
alias pip3Install="curl -s https://bootstrap.pypa.io/get-pip.py | python3"
alias pip3Update="pip3 install -U pip"
alias pkgInstaller="\installer -pkg"
alias powershell="\pwsh"
alias rename="\rename -v"
alias rsync="time \rsync -uth -P --exclude '*.swp'"
alias scp="time \rsync -h --progress -u -t --exclude '*.swp'"
#alias sed="\sed -E"
alias showHiddenFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias showWiFiPassword='\security find-generic-password -D "AirPort network password" -gw -a'
alias stat="\stat -x"
#alias svgView="command open -a safari"
alias svgView="command open -a firefox"
alias tcpPorts="command netstat -nap tcp"
alias topf10=$'$find . $findPrunePathsExpression -xdev -type f -size +10M -exec ls -lT {} \; 2>/dev/null | sort -nrk5 | head -10 | awk \'{total+=$5;print}END{print"=> total = "total" MiB"}\''
alias topf50=$'$find . $findPrunePathsExpression -xdev -type f -size +10M -exec ls -lT {} \; 2>/dev/null | sort -nrk5 | head -50 | awk \'{total+=$5;print}END{print"=> total = "total" MiB"}\''
alias topf5=$'$find . $findPrunePathsExpression -xdev -type f -size +10M -exec ls -lT {} \; 2>/dev/null | sort -nrk5 | head -5 | awk \'{total+=$5;print}END{print"=> total = "total" MiB"}\''
alias topf=$'$find . $findPrunePathsExpression -xdev -type f -size +10M -exec ls -lT {} \; 2>/dev/null | sort -nrk5 | head -n | awk \'{total+=$5;print}END{print"=> total = "total" MiB"}\''
alias umount="\diskutil unmount"
alias wifiList="airport -s"
alias wifiRestart='\networksetup -setairportpower $wiFiInterface off;\networksetup -setairportpower $wiFiInterface on'
alias wifiSpeed="airport -I | awk '/lastTxRate/{print\$0\" MBit/s\"}'"
#alias wifimac="\ifconfig $wiFiInterface | awk '/HWaddr/{print\$1\"\\t\"\$NF}'"
alias xlock="\/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
alias ytdlInstall="brew install youtube-dl"
alias ytdlUpdate="brew upgrade youtube-dl"
alias ytdlpInstall="brew install yt-dlp"
alias ytdlpUpdate="brew upgrade yt-dlp"
if groups 2>/dev/null | \egrep -wq "sudo|admin"
then
macOSServiceDIR=/System/Library/LaunchDaemons
cupsServiceName=org.cups.cupsd
alias cupsStatus="sudo launchctl list | \grep $cupsServiceName"
alias cupsStart="sudo launchctl load -w $macOSServiceDIR/$cupsServiceName.plist;cupsStatus"
alias cupsStop="sudo launchctl unload -w $macOSServiceDIR/$cupsServiceName.plist;cupsStatus"
alias cupsRestart="cupsStop;cupsStart"
sshServiceName=com.openssh.sshd
alias sshStatus="sudo launchctl list | \grep $sshServiceName"
alias sshStart="sudo launchctl load $macOSServiceDIR/ssh.plist;sshStatus"
alias sshStop="sudo launchctl unload $macOSServiceDIR/ssh.plist;sshStatus"
alias sshRestart="sshStop;sshStart"
alias updatedb="time sudo gupdatedb"
else
alias updatedb='time gupdatedb -l 0 -o ~/.local/lib/mlocate/mlocate.db --prunefs "rpc_pipefs afs binfmt_misc proc smbfs iso9660 ncpfs coda devpts ftpfs devfs mfs shfs sysfs cifs lustre tmpfs usbfs udf fuse.glusterfs fuse.sshfs curlftpfs"'
fi
set +x
test "$debug" -gt 0 && echo "=> END of $bold${colors[blue]}$(basename ${BASH_SOURCE[0]})$normal"