How to display a list of recent commands in Ubuntu Linux Kaip matyti iš naujausių komandos Ubuntu Linux sąrašą
Linux has a rich command line experience that can sometimes be a little daunting for people switching over from Windows. Linux daug komandų eilutę patirtis rodo, kad kartais gali būti šiek tiek bauginanti žmonėms persijungti iš "Windows". Displaying the list of recent commands is pretty simple, though: Parodyta pastarųjų komandų sąrašas yra gana paprasta, jei:
> history > Istorija
1 ps -ef 1 ps-ef
2 kill 24188 2 žudyti 24.188
3 ps -ef 3 ps-ef
4 tail logfile.log 4 uodega 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. Jeigu norite surasti komandą, kurią naudojote anksčiau, bet turite daug istorijos sąrašą, galite greitai rasti, perduoti ją per grep. Let's say we remember typing the ftp command, but can't remember the domain name of the server: Tarkime, mes prisimename, spausdinimo FTP, bet negaliu prisiminti domeno vardas serveryje:
> history | grep ftp > Istorija | grep ftp
321 ftp 321 FTP ftp.cdrom18.com ftp.cdrom18.com
Pretty simple stuff! Gana paprasta 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: Ką daryti, jei norime parodyti sąrašą dalykų, kad mes naudojame dažniausiai? Mes galime panaudoti daug sudėtingų komandą panašus į šį:
> history|awk '{print $2}'|awk 'BEGIN {FS=”|”} {print $1}'|sort|uniq -c|sort -r > Istorija | awk '(print $ 2)' | awk 'BEGIN (FS ="|"} (print $ 1)' | sort | uniq-c | sort-r
114 ls 114 Lt
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 Paskutinis komanda buvo dėka Lifehacker Lifehacker , which is a great site you should definitely subscribe to. , Kuri yra puiki svetainė jums būtinai užsisakyti.
The techniques used in the last command are useful in other contexts. Technologijas, naudojamas paskutinis komanda yra naudingas kitais atvejais. I'll be posting more similar commands going forwards. I'll be parašėte daugiau panašių komandų vyksta į priekį.

Daily Email Updates Dienos paštas Atnaujinimai
You can get our how-to articles in your inbox each day for free. Galite gauti mūsų kaip prie straipsnių į Jūsų pašto dėžutę kasdien nemokamai. Just enter your name and email below: Tiesiog įveskite vardą ir elektroninio pašto adresą žemiau:



This is a bash builtin . Tai bash BUILTIN. man bash and the builtin manual pops up showing history in there. man bash ir BUILTIN rankinis pasirodo rodo istorija ten.
-N -N