Important! This is an automatic machine translated page. If you can read english, you should Click Here to read the original English version of the article.

How to display a list of recent commands in Ubuntu Linux כיצד להציג רשימה של פקודות האחרונים אובונטו לינוקס

Linux has a rich command line experience that can sometimes be a little daunting for people switching over from Windows. לינוקס יש ניסיון עשיר שורת פקודה יכולה לפעמים להיות מעט מרתיעה עבור אנשים מעל המעבר מ-Windows. Displaying the list of recent commands is pretty simple, though: ראו את רשימת הפקודות האחרונות הוא די פשוט, אם כי:

> history > היסטוריה

1 ps -ef 1 PS-EF
2 kill 24188 2 להרוג 24,188
3 ps -ef 3 PS-EF
4 tail logfile.log 4 logfile.log זנב

If you want to find a command that you used before but you have a huge history list, you can quickly find it by passing it through grep. אם אתה רוצה למצוא הפקודה שבה השתמשת קודם אבל יש לך רשימה ענקית ההיסטוריה, תוכל למצוא במהירות את זה על ידי זה עובר דרך grep. Let's say we remember typing the ftp command, but can't remember the domain name of the server: בוא נגיד אנחנו זוכרים הקלדת הפקודה FTP, אבל לא זוכרת את שם התחום של השרת:

> history | grep ftp > היסטוריה | grep ftp

321 ftp 321 FTP ftp.cdrom18.com ftp.cdrom18.com

Pretty simple stuff! החומר די פשוט! What if we want to display the list of items that we use the most often?  We can use a much more complicated command like this: מה אם אנחנו רוצים להציג את רשימת הפריטים שאנו משתמשים בתדירות הגבוהה ביותר? אנחנו יכולים להשתמש בפקודה הרבה יותר מסובך כמו זה:

> history|awk '{print $2}'|awk 'BEGIN {FS=”|”} {print $1}'|sort|uniq -c|sort -r > היסטוריה | awk '(print $ 2)' | awk 'BEGIN (FS ="|"} (print $ 1)' | מעין | uniq-c | מין-R

114 ls LS 114
105 ./runreports.sh 105. / Runreports.sh
97 cd 97 CD
24 uptime 24 Uptime
15 mysql 15 MySQL
13 vi 13 VI

The last command was thanks to את הפקודה האחרונה היתה הודות Lifehacker Lifehacker , which is a great site you should definitely subscribe to. , אשר הוא אתר גדול אתה בהחלט צריך להירשם.

The techniques used in the last command are useful in other contexts. הטכניקות בשימוש הפקודה האחרונה שימושיים בהקשרים אחרים. I'll be posting more similar commands going forwards. אני אהיה יותר שולח אליה פקודות דומה הולך קדימה.

This article was originally written on 10/4/06 Tagged with: מאמר זה נכתב במקור על 10/4/06 שתייגת: SysAdmin SysAdmin , , Ubuntu Ubuntu

Daily Email Updates שערי עדכונים בדוא"ל

You can get our how-to articles in your inbox each day for free. אתה יכול לקבל כמה שלנו למאמרים לתיבת הדואר שלך בכל יום בחינם. Just enter your name and email below: פשוט להזין את שם ואת הדוא"ל שלך להלן:


Name: שם:
Email: דואר אלקטרוני:

Comments (1) תגובות (1)

  1. Narayan נאראיאן

    This is a bash builtin . זהו BUILTIN bash. man bash and the builtin manual pops up showing history in there. bash האיש ואת BUILTIN ידני צץ מראה ההיסטוריה שם.
    -N -N


Our Friends חברים שלנו
Getting Started התחלת העבודה


About How-To Geek אודות How-To Geek
What Is That Process? מה זה תהליך?
svchost.exe svchost.exe
jusched.exe jusched.exe
dwm.exe dwm.exe
ctfmon.exe Ctfmon.exe
wmpnetwk.exe wmpnetwk.exe
wmpnscfg.exe wmpnscfg.exe
rundll32.exe rundll32.exe
wfcrun32.exe wfcrun32.exe
Ipoint.exe Ipoint.exe
Itype.exe Itype.exe
Wfica32.exe Wfica32.exe
Mobsync.exe Mobsync.exe
conhost.exe conhost.exe
Dpupdchk.exe Dpupdchk.exe Adobe_Updater.exe Adobe_Updater.exe

Copyright © 2006-2009 HowToGeek.com. זכויות יוצרים © 2006-2009 HowToGeek.com. All Rights Reserved. כל הזכויות שמורות.