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 Kā lai parādītu sarakstu ar nesen komandas Ubuntu Linux

Linux has a rich command line experience that can sometimes be a little daunting for people switching over from Windows. Linux ir bagāta komandrindas pieredze dažkārt var būt nedaudz biedējošu cilvēkiem pāreju no Windows. Displaying the list of recent commands is pretty simple, though: Displaying saraksts pēdējo komandu ir diezgan vienkārša, tomēr:

> history > Vēsture

1 ps -ef 1 ps-ef
2 kill 24188 2 nogalināt 24.188
3 ps -ef 3 ps-ef
4 tail logfile.log 4 asti 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. Ja jūs vēlaties atrast komandu, kuru izmantojāt iepriekš, bet jums ir milzīgs vēstures sarakstu, jūs varat ātri atrast, laižot to caur grep. Let's say we remember typing the ftp command, but can't remember the domain name of the server: Let's say mēs atceramies rakstīt ftp komandu, bet nevar atcerēties domēna vārdu serveris:

> history | grep ftp > Vēsture | grep ftp

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

Pretty simple stuff! Diezgan vienkāršs 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: Ko darīt, ja mēs vēlamies parādīt posteņu sarakstu, ko mēs izmantojam visbiežāk? Mēs varam izmantot daudz sarežģītāka komandu, piemēram, šādi:

> history|awk '{print $2}'|awk 'BEGIN {FS=”|”} {print $1}'|sort|uniq -c|sort -r > History | awk '(print $ 2)' | awk 'BEGIN (FS ="|"} (print $ 1)' | sort | uniq-c | sort-r

114 ls 114 ls
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 Pēdējā komanda bija pateicoties Lifehacker Lifehacker , which is a great site you should definitely subscribe to. , Kas ir lieliska vieta jums noteikti vajadzētu abonēt.

The techniques used in the last command are useful in other contexts. Metodēm, ko izmanto pēdējā komanda ir noderīgi citos kontekstos. I'll be posting more similar commands going forwards. I'll be Sludinājuma vairāk līdzinās komandas iet uz priekšu.

This article was originally written on 10/4/06 Tagged with: Šis pants tika sākotnēji rakstīts uz 10/4/06 tagged with: SysAdmin SysAdmin , , Ubuntu Ubuntu

Daily Email Updates Daily Email Updates

You can get our how-to articles in your inbox each day for free. Jūs varat saņemt mūsu how-to rakstus savā pastkastītē katru dienu par brīvu. Just enter your name and email below: Vienkārši ievadiet jūsu vārdu un e-pasta zemāk:


Name: Vārds:
Email: E-pasts:

Comments (1) Komentāri (1)

  1. Narayan Narayan

    This is a bash builtin . Tas ir bash iebūvēto. man bash and the builtin manual pops up showing history in there. vīrietis bash un builtin rokasgrāmata POP parāda, vēsturi tur.
    -N -N


Our Friends Our Friends
Getting Started Getting Started


About How-To Geek Par How-To Geek
What Is That Process? Kas ir šis 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. Copyright © 2006-2009 HowToGeek.com. All Rights Reserved. All Rights Reserved.