Gage
Gage

Reputation: 109

Remove timestamp from each line in zsh shell

I'm trying to remove the current timestamp from my Terminal (macOS) using ZSH. I am using oh-my-zsh & I have the theme "pure" configured.

A timestamp appears on the very right of each line in brackets and I cannot figure out how to remove it.

Example: Timestamps are highlighted in red on the right.

Update: Terminal output example, I want to remove [17:29:47] etc from each line.

❯ cd ~                                                                         [17:29:47]

~
❯ ls                                                                           [17:29:49]
Applications Documents    Library      Music        Projects
Desktop      Downloads    Movies       Pictures     Public

~
❯ ls -l                                                                        [17:29:51]
total 0
drwx------@  4 gage  staff   128 Mar  4 22:27 Applications
drwx------@  4 gage  staff   128 Mar  7 15:39 Desktop

Any help would be greatly appreciated, thank you!

Upvotes: 4

Views: 8775

Answers (4)

Sanjiv Pradhan
Sanjiv Pradhan

Reputation: 241

I was able to remove the whole right section in the theme which showed ✔  123  10:46:22

Open zshrc

open ~/.zshrc

Paste the following line at the end of the file. This hides the right section POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()

Thanks!

Upvotes: 14

Prashul Singh
Prashul Singh

Reputation: 61

go to /Users/your_username/.p10k.zsh file and search for RIGHT_PROMT_ELEMENTS and comment the time and status under it.

typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
    # status                  # exit code of the last command ( commented)
    command_execution_time  # duration of the last command
    background_jobs         # presence of background jobs
    direnv                  # direnv status (https://direnv.net/)
    asdf                    # asdf version manager (https://github.com/asdf-vm/asdf)
    virtualenv              # python virtual environment (https://docs.python.org/3/library/venv.html)
    anaconda 
  # time                    # current time
    # ip                    # ip address and ba

Upvotes: 6

Gage
Gage

Reputation: 109

Fixed by unsetting RPROMPT by adding unset RPROMPT to the end of my .zshrc file.

Upvotes: 4

hikerjobs
hikerjobs

Reputation: 386

Try these commands. They should get rid of the timestamps hopefully.

setopt noextendedhistory
setopt nosharehistory

You can put them in your .zshrc file too.

Upvotes: 2

Related Questions