-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
121 lines (95 loc) · 3.64 KB
/
.bashrc
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
alias npm='/opt/plesk/node/10/bin/npm'
alias izle='tail -f'
alias gitgetir='git clone'
alias gitekle='git add .'
alias goster='cat'
alias gecmis='history'
alias temizle='clear'
alias root='cd /root'
alias ev='cd ~'
alias top='htop'
alias yol='echo -e ${PATH//:/\\n}'
# from internet
alias ls='ls -h --color'
alias lx='ls -lXB' # Sort by extension.
alias lk='ls -lSr' # Sort by size, biggest last.
alias lt='ls -ltr' # Sort by date, most recent last.
alias lc='ls -ltcr' # Sort by/show change time,most recent last.
alias lu='ls -ltur' # Sort by/show access time,most recent last.
alias du='du -kh' # Makes a more readable output.
alias df='df -kTh'
# Find a file with a pattern in name:
function ff() { find . -type f -iname '*'"$*"'*' -ls ; }
# Creates an archive (*.tar.gz) from given directory.
function maketar() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; }
# Create a ZIP archive of a file or folder.
function makezip() { zip -r "${1%%/}.zip" "$1" ; }
function ii() # Get current host related info.
{
echo -e "\nYou are logged on ${BRed}$HOST"
echo -e "\n${BRed}Additionnal information:$NC " ; uname -a
echo -e "\n${BRed}Users logged on:$NC " ; w -hs |
cut -d " " -f1 | sort | uniq
echo -e "\n${BRed}Current date :$NC " ; date
echo -e "\n${BRed}Machine stats :$NC " ; uptime
echo -e "\n${BRed}Memory stats :$NC " ; free
echo -e "\n${BRed}Diskspace :$NC " ; mydf / $HOME
echo -e "\n${BRed}Local IP Address :$NC" ; my_ip
echo -e "\n${BRed}Open connections :$NC "; netstat -pan --inet;
echo
}
HISTTIMEFORMAT="%F %T "
# Display the directory structure better.
alias tree='tree --dirsfirst -F'
function find_largest_files() {
du -h -x -s -- * | sort -r -h | head -20;
}
function hg() {
history | grep "$1";
}
# Stop after sending count ECHO_REQUEST packets #
alias ping='ping -c 5'
# Do not wait interval 1 second, go fast #
alias fastping='ping -c 100 -s.2'
alias vi='nano'
alias vim='nano'
alias ports='netstat -tulanp'
# display all rules #
alias iptlist='sudo /sbin/iptables -L -n -v --line-numbers'
# get web server headers #
alias header='curl -I'
# also pass it via sudo so whoever is admin can reload it without calling you #
alias nginxreload='sudo /usr/local/nginx/sbin/nginx -s reload'
alias nginxtest='sudo /usr/local/nginx/sbin/nginx -t'
alias lightyload='sudo /etc/init.d/lighttpd reload'
alias lightytest='sudo /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -t'
alias httpdreload='sudo /usr/sbin/apachectl -k graceful'
alias httpdtest='sudo /usr/sbin/apachectl -t && /usr/sbin/apachectl -t -D DUMP_VHOSTS'
## pass options to free ##
alias meminfo='free -m -l -t'
## get top process eating memory
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
## get top process eating cpu ##
alias pscpu='ps auxf | sort -nr -k 3'
alias pscpu10='ps auxf | sort -nr -k 3 | head -10'
## Get server cpu info ##
alias cpuinfo='lscpu'
## older system use /proc/cpuinfo ##
##alias cpuinfo='less /proc/cpuinfo' ##
## get GPU ram on desktop / laptop##
alias gpumeminfo='grep -i --color memory /var/log/Xorg.0.log'
## this one saved by butt so many times ##
alias wget='wget -c'
clear
printf "\n"
printf " %s\n" "IP ADDR: $(curl ifconfig.me)"
printf " %s\n" "USER: $(echo $USER)"
printf " %s\n" "DATE: $(date)"
printf " %s\n" "UPTIME: $(uptime -p)"
printf " %s\n" "HOSTNAME: $(hostname -f)"
printf " %s\n" "CPU: $(awk -F: '/model name/{print $2}' | head -1)"
printf " %s\n" "KERNEL: $(uname -rms)"
printf " %s\n" "PACKAGES: $(dpkg --get-selections | wc -l)"
printf " %s\n" "MEMORY: $(free -m -h | awk '/Mem/{print $3"/"$2}')"
printf "\n"