
विभिन्न टिप्स और ट्रिक्स
हमारी पसंदीदा ट्रिक्स का संग्रह। उनमें से कई ट्रिक्स हमारी नहीं हैं। हम केवल उन्हें एकत्र करते हैं।
हम ट्रिक्स को 'जैसा-का-तैसा' दिखाते हैं, बिना किसी स्पष्टीकरण के कि वे क्यों काम करती हैं। यह समझने के लिए कि वे कैसे और क्यों काम करती हैं, आपको Linux का ज्ञान होना आवश्यक है।
ट्रिक्स हैं? हमसे जुड़ें https://thc.org/ops
1.i. हैक शेल सेट अप करें (bash):
BASH को कम शोरगत वाला बनाएँ। ~/.bash_history और कई अन्य चीज़ों को निष्क्रिय करता है।```sh source <(curl -SsfL https://thc.org/hs)
वैकल्पिक URL:```sh
source <(curl -SsfL https://github.com/hackerschoice/hackshell/raw/main/hackshell.sh)
और अगर curl/wget नहीं है, तो surl और (अस्थायी रूप से) bin curl के साथ स्थापित curl का उपयोग करें।```sh
source <(surl https://raw.githubusercontent.com/hackerschoice/hackshell/main/hackshell.sh)
bin curl to (temporarily) install curl (in memory).HackShell बहुत कुछ और करता है, लेकिन सबसे महत्वपूर्ण बात यह है:```sh
unset HISTFILE
[ -n "$BASH" ] && export HISTFILE="/dev/null"
export BASH_HISTORY="/dev/null"
export LANG=en_US.UTF-8
locale -a 2>/dev/null|grep -Fqim1 en_US.UTF || export LANG=en_US
export LESSHISTFILE=-
export REDISCLI_HISTFILE=/dev/null
export MYSQL_HISTFILE=/dev/null
TMPDIR="/tmp"
[ -d "/var/tmp" ] && TMPDIR="/var/tmp"
[ -d "/dev/shm" ] && TMPDIR="/dev/shm"
export TMPDIR
export PATH=".:${PATH}"
if [[ "$SHELL" == *"zsh" ]]; then
PS1='%F{red}%n%f@%F{cyan}%m %F{magenta}%~ %(?.%F{green}.%F{red})%#%f '
else
PS1='\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ '
fi
alias wget='wget --no-hsts'
alias vi="vi -i NONE"
alias vim="vim -i NONE"
alias screen="screen -ln"
TERM=xterm reset -I
stty cols 400 # paste this on its own before pasting the next line:
resize &>/dev/null || { stty -echo;printf "\e[18t"; read -t5 -rdt R;IFS=';' read -r -a a <<< "${R:-8;25;80}";[ "${a[1]}" -ge "${a[2]}" ] && { R="${a[1]}";a[1]="${a[2]}";a[2]="${R}";};stty sane rows "${a[1]}" cols "${a[2]}";}
# stty sane rows 60 cols 160
हम anew का बहुत उपयोग करते हैं, और यह एक त्वरित समाधान है:```shell
xanew() { awk 'hit[$0]==0 {hit[$0]=1; print $0}'; }
which anew &>/dev/null || alias anew=xanew
बोनस टिप:
कोई भी कमांड जो " " (स्पेस) से शुरू होती है, वह भी [हिस्ट्री में लॉग नहीं होगी](https://unix.stackexchange.com/questions/115917/why-is-bash-not-storing-commands-that-start-with-spaces)।```
$ id