forked from mahesh-attarde/groot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashrc
More file actions
141 lines (123 loc) · 3.86 KB
/
Copy pathbashrc
File metadata and controls
141 lines (123 loc) · 3.86 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# For ENV
source ${GROOT}/grootrc
# For Color and PS1
source ${GROOT}/color.sh
# For Binutils and other tools
source ${GROOT}/toolrc
# Set the default editor
export EDITOR=vim
export VISUAL=gvim
export MYED=code
alias g='gvim'
# Get Tools from ./bin
export PATH=$GROOT/bin:$GROOT/bin/jira:$GROOT/bin/linux/:$PATH
setvscode() {
export PATH=${VSCODE_GIT_ASKPASS_NODE%/*}/bin/remote-cli:$PATH
}
# Editor
e() { $MYED $1; }
el() { $MYED llvm/$1; }
ef() { find . -name $1 | xargs $MYED ;}
elf() { find llvm -name $1 | xargs $MYED; }
edif(){ $MYED --diff $1 $2; }
ezrpt(){ $MYED ./zperf_rt_rpt.log; }
efzrpt() { find . -name zperf_rt_rpt.log | xargs $MYED ;}
efb() { find . -name build.log | xargs $MYED ;}
ezlf(){
find_and_edcode lf
}
find_and_edcode() {
# Save the current terminal state
saved_state=$(stty -g)
ext=$1
# Ensure terminal state is restored on exit
trap 'stty "$saved_state"' EXIT
files=($(find llvm -type f -name "*.${ext}"))
if [ ${#files[@]} -eq 0 ]; then
echo "No .${ext} files found in the llvm directory."
return
fi
echo "Select a file to open:"
select file in "${files[@]}"; do
if [ -n "$file" ]; then
read -p "You selected '$file'. Press Enter to open or type 'n' to abort: " confirm
if [ "$confirm" != "n" ]; then
$MYED "$file"
else
echo "Operation canceled."
fi
return
else
echo "Invalid selection. Please try again."
fi
done
# Restore the terminal state explicitly (in case trap didn't trigger)
stty "$saved_state"
}
# Change dir
alias home='cd ~'
alias cd1='cd ..'
alias cd2='cd ../..'
alias cd3='cd ../../..'
alias cd4='cd ../../../..'
alias cd5='cd ../../../../..'
alias cd6='cd ../../../../../..'
alias cd7='cd ../../../../../../..'
alias cd8='cd ../../../../../../../..'
alias cdws='cd /iusers/mattarde'
# listing
alias la='ls -Alh' # show hidden files
alias ls='ls -aFh --color=always' # add colors and file type extensions
alias lx='ls -lXBh' # sort by extension
alias lk='ls -lSrh' # sort by size
alias lc='ls -lcrh' # sort by change time
alias lu='ls -lurh' # sort by access time
alias lr='ls -lRh' # recursive ls
alias lt='ls -ltrh' # sort by date
alias lm='ls -alh |more' # pipe through 'more'
alias lw='ls -xAh' # wide listing format
alias ll='ls -Fls' # long listing format
alias labc='ls -lap' #alphabetical sort
alias lf="ls -l | egrep -v '^d'" # files only
alias ldir="ls -l | egrep '^d'" # directories only
alias scd='pushd $PWD'
alias ppd='popd'
function lsgrep(){ ls | grep $1 ; }
alias mrg='rg --no-heading --line-number'
#alias disasm="objdump -D --no-show-raw-insn --no-addresses"
# Search command line history
alias h="history | grep "
# Search running processes
alias p="ps aux | grep "
alias topcpu="/bin/ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10"
# Search files in the current folder
alias f="find . | grep "
# Alias's to show disk space and space used in a folder
alias csize='du -h --max-depth=1 | sort -hr'
alias diskspace="du -S | sort -n -r |more"
alias folders='du -h --max-depth=1'
alias folderssort='find . -maxdepth 1 -type d -print0 | xargs -0 du -sk | sort -rn'
alias tree='tree -CAhF --dirsfirst'
alias treed='tree -CAFd'
alias mountedinfo='df -hT'
# Get Path
alias ff='find . -name'
mkcd() { mkdir -p "$@" && cd "$@"; }
gtp() { readlink -f $1 ;}
ffgtp(){ find . -name $1 | xargs readlink -f ; }
## Source Other Scripts
alias edrc='${MYED} ${GROOT}/bashrc'
alias ldrc='source ${GROOT}/bashrc'
alias icsrc='source ${IGROOT}/izx.sh'
alias gtrc='source ${GROOT}/goto/goto.sh'
alias gitrc='source ${GROOT}/git.sh'
alias dbrc='source ${GROOT}/compiler_debug.sh'
alias xisarc='source ${IGROOT}/xisa_ws.sh'
#
llrc() {
source ${GROOT}/llvm.sh;
source ${GROOT}/goto/goto.sh;
source ${GROOT}/git.sh;
source ${GROOT}/compiler_debug.sh;
ctx llvm;
}