هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
ماذا يفعل
clear removes all text from the terminal window and puts the prompt at the top. It sends the right control codes for your terminal type (from the TERM variable).
Ctrl+L does almost the same: it clears the visible screen but usually keeps the scrollback. When the terminal shows strange characters after you printed a binary file, reset is stronger than clear.
طريقة الكتابة
clear [-x] [-T TYPE] [-V]الخيارات 3
الأكثر استخدامًا
لا يوجد شيء يطابق هذا الفلتر.
أمثلة 11
$ مستخدم عادي# بصلاحية root (أو مع sudo)
1Clear the screen
clearThe prompt moves to the top of the window.
2Clear the screen with the keyboard
# press Ctrl+LFaster than typing
clear. Works in Bash and most programs.3Keep the scrollback, clear only the screen
clear -xYou can still scroll up to see older output.
4Clear the screen before a demo or a screen share
clear && history -cClean screen and no old commands with internal names or tokens.
5Fix a terminal that prints strange signs
resetresetsets up the terminal again. Use it after youcata binary file by mistake.6Clear the screen at the start of a menu script
Each time the menu shows, the old output is gone.
7Refresh a simple status view every 5 seconds
A tiny dashboard.
watchdoes this better:watch -n5 'systemctl is-active httpd sshd'.8Clear for another terminal type
clear -T xtermRarely needed: when $TERM is wrong for the terminal you use.
9Use the tput way in a portable script
tput clearSame result;
tputcan also set colors and move the cursor.10Clear the screen and the scrollback in a jump host session
clear && printf '\e[3J'Some terminals keep the scrollback; the extra code removes it too. Good after showing secrets.
11Make an alias that clears and lists
alias cls='clear; ls -l'Personal shortcut; put it in
~/.bashrc.
لا يوجد شيء يطابق هذا الفلتر.
انتبه
cleardoes not remove anything from your shell history or from log files. It only cleans the window.- Some terminal programs keep the scrollback even after
clear.
نصائح للحفظ
- Ctrl+L = fast clear.
reset= repair a broken terminal.