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.

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:



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