How can I get the Ubuntu terminal history without the line number?


history command returns the previous commands with line number. I am looking for something like:

 cd tizen-sdk\tools          

instead of

924  cd tizen-sdk\tools      
925  ls

3 Answers 3


You can use the fc command instead. From 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

      -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

You can also look at the history file directly, but it might not be updated:

  • + OP's question, is there a way to tell to do not record line number in history file? Oct 20, 2016 at 14:22
  • 1
    @KasiyA the history file does not record line numbers (it only records commands, and if HISTTIMEFORMAT is set, timestamps).
    – muru
    Oct 20, 2016 at 14:23
  • Will it display all history?
    – Anwar
    Oct 20, 2016 at 16:32

Use this command:

history | cut -c 8-

Using awk.

history | awk '{$1=""; print}'
  • 1
    You can use awk '{$1=""}1'
    – muru
    Oct 24, 2016 at 4:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.