How to display a list of recent commands in Ubuntu Linux Як переглянути список останніх команд в Ubuntu Linux
Linux has a rich command line experience that can sometimes be a little daunting for people switching over from Windows. Linux має багатий досвід командного рядка, яка іноді може бути трохи складна для людей, перемикання з Windows. Displaying the list of recent commands is pretty simple, though: Відображення списку останніх команд досить простий, хоча:
> history > Історія
1 ps -ef 1 PS-EF
2 kill 24188 2 убити 24188
3 ps -ef PS 3-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 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 Остання команда була подяка 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. Я буду вивішувати більше аналогічних команд збираюся вперед.

Daily Email Updates Email Щоденні оновлення
You can get our how-to articles in your inbox each day for free. Ви можете отримати наші довідкові статті у Вашу поштову скриньку щодня безкоштовно. Just enter your name and email below: Просто введіть ваші ім'я та адресу електронної пошти нижче:



This is a bash builtin . Це вбудована Баш. man bash and the builtin manual pops up showing history in there. Баш Людина та вбудованої керівництва показуючи спливаюче історію там.
-N -N