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 Ako zobraziť zoznam posledných príkazov v Ubuntu Linux

Linux has a rich command line experience that can sometimes be a little daunting for people switching over from Windows. Linux má bohaté skúsenosti z príkazového riadku, ktoré môže byť niekedy trochu skľučujúca ľuďom prechod z Windows. Displaying the list of recent commands is pretty simple, though: Zobrazujem zoznam posledných príkazov je veľmi jednoduchá, aj keď:

> history > História

1 ps -ef 1 ps-ef
2 kill 24188 2 kill 24188
3 ps -ef 3 ps-ef
4 tail logfile.log 4 chvost 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. Ak chcete vyhľadať príkaz, ktorý ste používali predtým, ale máte obrovskú zoznamu histórie, môžete rýchlo nájsť priechodom cez grep. Let's say we remember typing the ftp command, but can't remember the domain name of the server: Povedzme, že máme na pamäti zadaním príkazu ftp, ale nemôžem spomenúť na názov domény servera:

> history | grep ftp > História | grep ftp

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

Pretty simple stuff! Pomerne jednoduché veci! 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: Čo chceme zobraziť zoznam položiek, ktoré používame najčastejšie? Môžeme použiť oveľa zložitejší príkaz:

> history|awk '{print $2}'|awk 'BEGIN {FS=”|”} {print $1}'|sort|uniq -c|sort -r > História | 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 Posledný príkaz bol vďaka Lifehacker Lifehacker , which is a great site you should definitely subscribe to. , Čo je skvelé miesto, mali by ste rozhodne objednať.

The techniques used in the last command are useful in other contexts. Techniky používané v posledný príkaz sú užitočné v iných súvislostiach. I'll be posting more similar commands going forwards. I'll be vyslanie viac podobných príkazov ísť dopredu.

This article was originally written on 10/4/06 Tagged with: Tento článok bol pôvodne napísaný na 10/4/06 Tagged s: SysAdmin SysAdmin , , Ubuntu Ubuntu

Daily Email Updates Denný Svářeč

You can get our how-to articles in your inbox each day for free. Môžete si naše jak-na články vo vašej schránky každý deň zadarmo. Just enter your name and email below: Stačí zadať svoje meno a e-mail nižšie:


Name: Meno:
Email: E-mail:

Comments (1) Komentáre (1)

  1. Narayan Narayan

    This is a bash builtin . To je vstavaný bash. man bash and the builtin manual pops up showing history in there. Muž bash a vstavaného manuál zobrazujúce históriu tam.
    -N -N


Our Friends Naši priatelia
Getting Started Začíname


About How-To Geek O tom, ako-To Geek
What Is That Process? Čo je to za proces?
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.