-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.aliases
70 lines (52 loc) · 2.08 KB
/
.aliases
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
# To override the alias instruction use a '\' before it
# eg. \rm will call the real /bin/rm not an alias.
# Interactive operation...
alias rm='\rm -i'
alias mv='\mv -iv'
alias cp='\cp -v'
alias df='\df -h'
alias du='\du -hD'
alias grep='\grep --color=auto'
alias ffs='eval sudo !!' #alt: 'sudo $(fc -ln -1)'
alias free='\free -m'
function edit() {
local -a cmd
local title=${1:-$EDITOR}
: ${title:=$FUNCNAME}
if [ -n "$WT_SESSION" ]; then
cmd=( wt --window 0 new-tab '--title' "${title##*/}" '--startingDirectory' ./ '--' )
# make sure $EDITOR is on Windows PATH or use 'cygpath -m ${EDITOR}'
local editor=`convert_path -m "$EDITOR"`
#TODO PowerShell
elif [[ ${TERM:-X} =~ ^screen ]]; then
cmd=( screen '-t' "${title##*/}" )
fi
${DEBUG:+ runv} "${cmd[@]}" "${editor:-$EDITOR}" "$@"
}
# caution: only Unix(tm)
alias ps &>/dev/null || alias ps='\ps ${PS_ARGS:- -o uid,pid,ppid,stime,etime,cmd}'
# Some shortcuts for different directory listings
alias ls='\ls -hAF --color=tty'
alias ll='ls -lh'
alias ld='ls -d'
alias lt='ls -t'
alias lS='ls -S'
alias cdu='cd ..'
alias cdl='cd ${1:-.}; shift; ls $@'
alias curl='${DEBUG:+ runv} \curl --connect-timeout 7 --fail --silent ${VERBOSE:+ --verbose --progress-bar}'
alias newtab='wt --window 0 new-tab --'
alias sftp='\sftp -R 256 -B 262144'
alias ntpdate='sudo /usr/sbin/ntpd -gq'
# --filter=':- .gitignore' mind the space
alias rsync="\rsync --cvs-exclude --exclude='.git*'"
alias check-url='\curl -L -s -o /dev/null -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} ReturnCode: %{http_code} Download Size: %{size_download} Speed: %{speed_download} \n"'
# increasing order of preference
is_exec -q curl && \
alias myip_http='curl -s4k "http://ifconfig.me/ip" || { curl -s4k "https://api.myip.com/" | jq -r .ip; }'
#alt: http://ipv4.icanhazip.com/ https://checkip.amazonaws.com/
is_exec -q nslookup && \
alias myip='nslookup myip.opendns.com resolver1.opendns.com.'
is_exec -q dig && \
alias myip='dig +short myip.opendns.com @resolver1.opendns.com.'
return 0
# vim: expandtab:ts=4:sw=4