Просмотрите терминальную историю без номера строки

Как я могу получить историю терминала Ubuntu без номера строки?

history

history управляйте возвращает предыдущие команды с номером строки. Я ищу что-то как:

 cd tizen-sdk\tools          
 ls

вместо

924  cd tizen-sdk\tools      
925  ls
1
задан 20 October 2016 в 16:33

3 ответа

Можно использовать эти fc команда вместо этого. От help fc:

fc: fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command]
    Display or execute commands from the history list.

    fc is used to list or edit and re-execute commands from the history list.
    FIRST and LAST can be numbers specifying the range, or FIRST can be a
    string, which means the most recent command beginning with that
    string.

    Options:
      -e ENAME  select which editor to use.  Default is FCEDIT, then EDITOR,
            then vi
      -l    list lines instead of editing
      -n    omit line numbers when listing
      -r    reverse the order of the lines (newest listed first)

Поэтому:

fc -ln

можно также посмотреть на файл истории непосредственно, но он не мог бы быть обновлен:

cat "$HISTFILE"
6
ответ дан 3 December 2019 в 06:19

Используйте эту команду:

history | cut -c 8-
3
ответ дан 3 December 2019 в 06:19

Используя awk.

history | awk '{$1=""; print}'
1
ответ дан 3 December 2019 в 06:19

Другие вопросы по тегам:

Похожие вопросы: