9e6dc87327ff428f3eeeddd09fe6da33bbe1154b
[dotfiles] / .bash_aliases
1 #!/bin/sh
2
3 alias beroot="sudo -i"
4 alias my_init_system="ps -p 1 -o command"
5 alias my_share_tty='gotty tmux new -A -s go_tty bash'
6 alias my_fqdn='hostname --fqdn'
7 alias rustc='rustc --color auto '
8 alias E='SUDO_EDITOR="emacsclient" sudo -e'
9 alias my_lngst_line_in_file="wc -L"
10
11 alias rmf="rm -rf"
12 alias vnv="pyvenv"
13 alias venv="pyvenv"
14
15 # manually installed packages
16 alias my_installed_packages="apt search -F %p '~i!~M'"
17
18 # apt search ~i lists the installed packages
19 # grep -v "^i A" removes the lines starting with "i A" (automatically pulled in dependencies)
20 # cut -d " " -f 4 > clean.txt filters out the package names
21 alias my_installed_packages2="apt search ~i | grep -v '^i A' | cut -d ' ' -f 4"
22
23 # only to be done by root
24 # alias my_installed_pkg="zgrep -hE '^(Start-Date:|Commandline:)' $(ls -tr /var/log/apt/history.log*.gz ) | egrep -v 'aptdaemon|upgrade' | egrep -B1 '^Commandline: apt-get install'"
25
26 # alias my_installed_pkg2="( zcat $( ls -tr /var/log/apt/history.log*.gz ) ; cat /var/log/apt/history.log ) | egrep '^(Start-Date:|Commandline:)' | grep -v aptdaemon | egrep '^Commandline: apt-get install'"
27
28 # the grep I use the most
29 alias my_grep="grep -Hrnisl"
30
31 # my weird aliases
32 alias djo_runserver="python manage.py runserver"
33 alias djo_shell="python manage.py shell"
34 alias djo_shellp="python manage.py shell_plus"
35 alias djo_make="python manage.py makemigrations"
36 alias djo_mig="python manage.py migrate"
37 alias djo_csu="python manage.py createsuperuser"
38 alias djo_smtpd="python -m smtpd -n -c DebuggingServer localhost:1025"
39
40 alias nimcr="nim c -r"
41
42 alias my_current_shell="echo $0"
43 alias my_shells="cat /etc/shells"
44
45 alias mount="sudo mount"
46 alias umount="sudo umount"
47
48 alias my_public_ip="curl ifconfig.me"
49 alias my_dl_website="wget --random-wait -r -p -e robots=off -U mozilla "
50 alias my_dl_website2="wget robots=off -U mozilla \
51 --recursive \
52 --no-clobber \
53 --page-requisites \
54 --html-extension \
55 --convert-links \
56 --restrict-file-names=windows \
57 --domains website.org \
58 --no-parent "
59 alias my_poor_man_bandwith_monitor="watch -n1 'sudo ifconfig eth0 | grep RX' "
60
61 # curl retrieve header only when doing a post
62 # -D- dump header to stdout
63 # -s no progress bar
64 # -o/dev/null output body to /dev/null
65 alias curlh="curl -s -D- -o/dev/null "
66
67 # test disk read/write speed
68 alias my_disk_write_speed="dd if=/dev/zero of=/tmp/output.img bs=8k count=256k conv=fdatasync; rm -rf /tmp/output.img"
69 alias my_disk_read_speed="hdparm -Tt /dev/sda"
70
71 # generate random password, 16 char long
72 alias my_gen_pwd="LANG=c < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;"
73 alias my_gen_pwd2="openssl rand -base64 16"
74
75 # go to root dir
76 alias git-root='cd $(git rev-parse --show-cdup)'
77
78 alias my_installed_packages="dpkg --get-selections"
79 alias my_manually_installed_packages="apt search '~i !~M'"
80
81 alias my_tcp_sockets='ss -s'
82 alias my_tcp_sockets2='netstat -s'
83 alias my_open_ports2='ss -l'
84 alias my_open_ports='netstat -tupln'
85 alias my_open_tcp_port='netstat -plnt'
86
87
88 # emacsclient is too long to write
89 alias emax="emacsclient -cnw"
90
91 alias my_laptop_serial_number='sudo dmidecode -t 1 | grep -i serial'
92
93 alias my_show_user_process='ps wu -U'
94
95 alias fuck="sudo !!"
96
97
98 alias my_send_email="emacsclient -cnw --eval '(mail)'"
99 alias my_emails="emacsclient -cnw --eval '(gnus)'"
100
101 alias my_architecture='dpkg --print-architecture'
102 alias my_number_of_cores='cat /proc/cpuinfo |grep processor'
103
104 alias ip='sudo ip'
105 alias dhclient='sudo dhclient'
106
107 alias my_debian_version='sudo cat /etc/debian_version'
108 alias my_ubuntu_version='sudo cat /etc/issue'
109 alias my_kernel_info='uname -a'
110 alias my_kernel_release='uname -r'
111
112 alias emacs="emacs -nw"
113 alias grep="grep --color=auto"
114 alias fgrep="fgrep --color=auto"
115 alias egrep="egrep --color=auto"
116
117 alias mkdir='mkdir -p'
118
119 alias my_processes='ps aux | grep'
120
121 # some more ls aliases
122 alias ls='ls --hide="*~" --color'
123 alias dir='dir --color=auto'
124 alias vdir='vdir --color=auto'
125 alias ll='ls -lh'
126 alias la='ls -lah'
127 alias lt='ls -t'
128
129 # some more mor aliases
130 alias apt="sudo apt"
131 alias aptitude="sudo aptitude"
132 alias service="sudo service"
133 alias halt='sudo halt'
134 alias wvdial='sudo wvdial'
135 alias apt-get='sudo apt-get'
136 alias dpkg='sudo dpkg'
137
138 alias h="history"
139 alias j="jobs -l"
140
141 alias ..="cd .."
142 alias ....="cd ../.."
143 alias ......="cd ../../.."
144
145 #git
146 alias gstatus='git status'
147 alias gcheckout='git checkout'
148 alias gcommit='git commit'
149 alias grebase='git rebase'
150 alias gbranch='git branch'
151 alias gpull='git pull'
152 alias gpush='git push'
153 alias gadd='git add'
154 alias gmergetool='git mergetool'
155 alias gdiff='git diff --color'
156 alias glog='git log --date-order --all --graph --format="%C(green)%h%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'
157 alias glog2='git log --date-order --all --graph --name-status --format="%C(green)%h%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'
158
159 alias du="du -kh" # Makes a more readable output.
160 alias df="df -kTh"
161
162 alias ifconfig='/sbin/ifconfig'
163 alias sshx='ssh dev_server'
164 alias my_gatewayaddress="netstat -nr"
165
166 alias reload_tmuxconf="tmux source-file ~/.tmux.conf"
167 alias reload_bash="source ~/.bashrc"
168 alias reload_alsa="service alsa-utils restart"
169 alias reload_bluetooth='service bluetooth restart'
170
171 # virtualenv
172 alias my_wifi_list="sudo iw wlan0 scan | less"
173
174 alias my_top10_running_proc="ps aux | sort -nk +4 | tail"
175
176 # gpg
177 alias gpg_gen="gpg --gen-key "
178 alias gpg_ls="gpg --list-keys "
179 alias gpg_bckp_pubk="gpg -ao mypub.key --export "
180 alias gpg_bckp_privk="gpg -ao mypriv.key --export-secret-keys "
181 alias gpg_share_pubk="gpg --send-keys --keyserver "
182 alias gpg_search="gpg --search-keys --keyserver "
183 alias gpg_enc="gpg --encrypt --recipient "
184 alias gpg_dec="gpg --decrypt "
185
186 alias my_bios='sudo dmidecode -t 1 | grep "Manufacturer\|Product Name\|Serial Number" | tr -d "\t" | sed "s/Manufacturer//" && echo -ne "\nBIOS" && sudo dmidecode -t 0 | grep "Vendor\|Version\|Release" | tr -d "\t" | sed "s/Vendor//"'
187
188 alias ll5='ll -tl | head -4'