-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaliases
executable file
·112 lines (104 loc) · 3.51 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
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
# Modern CLI replacements
# Modern replacement for ls with icons and colors
alias ls='lsd'
# List all files in long format with icons
alias ll='lsd -la'
# Show directory structure as a tree with icons
alias lt='lsd --tree'
# Alias tree to lsd tree view for consistency
alias tree='lsd --tree'
# File viewing
# Modern replacement for cat with syntax highlighting
alias cat='bat --paging=never'
# Enhanced pager with syntax highlighting
alias less='bat --style=plain --paging=always'
# Preview files with line numbers and Git changes
alias preview='bat --style=numbers,changes'
# Editor
# Use neovim as the default vim editor
alias vim='nvim'
# Map vi to neovim as well
alias vi='nvim'
# Open Visual Studio Code from terminal
alias code='open -a Visual\ Studio\ Code'
# Search and find
# Use ripgrep with smart case sensitivity
alias grep='rg --smart-case'
# Modern find replacement that respects gitignore
alias find='fd --hidden --follow --exclude .git'
# Data processing
# Pretty print JSON with colors
alias json='jq -C'
# Pretty print YAML with colors
alias yaml='yq -C'
# CSV file manipulation tool
alias csv='xsv'
# Pretty print and page through JSON files with colors
# Usage: jsonf [file] [jq filter] OR cat file.json | jsonf [jq filter]
unalias jsonf 2>/dev/null || true
jsonf() {
if [ -p /dev/stdin ]; then
# If input is being piped
cat - | jq -C "${@:-.}" | bat --style=plain --paging=always
elif [ $# -eq 0 ]; then
# If no arguments provided
echo "Usage: jsonf [file] [jq filter]" >&2
return 1
elif [ $# -eq 1 ]; then
# If only one argument, treat as file with default filter
cat "$1" | jq -C . | bat --style=plain --paging=always
else
# If file and filter provided
cat "$1" | jq -C "${@:2}" | bat --style=plain --paging=always
fi
}
# Pretty print and page through YAML files with colors
# Usage: yamlf [file] [yq filter] OR cat file.yaml | yamlf [yq filter]
unalias yamlf 2>/dev/null || true
yamlf() {
if [ -p /dev/stdin ]; then
# If input is being piped
cat - | yq -C "${@:-.}" | bat --style=plain --paging=always
elif [ $# -eq 0 ]; then
# If no arguments provided
echo "Usage: yamlf [file] [yq filter]" >&2
return 1
elif [ $# -eq 1 ]; then
# If only one argument, treat as file with default filter
cat "$1" | yq -C . | bat --style=plain --paging=always
else
# If file and filter provided
cat "$1" | yq -C "${@:2}" | bat --style=plain --paging=always
fi
}
# Display CSV files in table format
alias csvt='xsv table'
# Disk usage
# Modern disk usage utility with better UI
alias du='duf'
# Interactive disk usage analyzer
alias disk='ncdu --color dark'
# Show disk usage sorted by size
alias space='duf --sort size'
# System monitoring
# Modern system monitor with detailed stats
alias top='btop'
# Simplified man pages with practical examples
alias help='tldr'
# Network tools
# HTTPie with auto-formatting
alias http='http --style=auto'
# HTTPie with HTTPS as default scheme
alias https='http --default-scheme=https'
# Traceroute with real-time updates
# Traceroute with real-time updates
alias trace='sudo mtr --show-ips --curses'
# Monitor network traffic in real-time (all interfaces)
alias nettop='sudo bandwhich'
alias tracet='sudo mtr --show-ips --curses --tcp'
# Monitor network bandwidth usage
alias netmon='sudo bandwhich'
# Show active network connections
alias netcon='sudo bandwhich --connections'
# List all listening TCP ports
alias ports='sudo lsof -iTCP -sTCP:LISTEN -P -n'