I know it's off topic, but it would be good if the author could change that example. In general, one should never use sudo with package managers.
Zsh Tricks to Blow Your Mind
171–180 of 218 posts
Re: Zsh Tricks to Blow Your Mind
#172If you opt-in to the iCloud personal folder mirroring feature it will move your Desktop folder into the cloud. This gets kinda troublesome if you are the kind of person who uses your desktop as a scratch space for random crap.
I now have a ~/scratch folder for this. I also added a ~/screenshots folder and used the app Onyx to change where macOS saves screenshots.
Now I get the best of both worlds.
Re: Zsh Tricks to Blow Your Mind
#173Re: Zsh Tricks to Blow Your Mind
#174> Ctrl-q "parks" the command What is the zsh functionality behind this? I couldn't test it because my terminal eats Ctrl-q and a search for "zsh ctrl-q" didn't turn up anything useful.
Re: Zsh Tricks to Blow Your Mind
#175Earlier quoted context omitted.
Thank you! How strange. `history -fD` does work, but only for commands in the current zsh session. It seems durations are being stored in memory but written out as 0's. I'll try the mailing list soon :)
Looks like you probably also have SHARE_HISTORY set? [1] [1] https://unix.stackexchange.com/questions/396809/zsh-share-hi...
It makes sense. It's preferring to add to history immediately so that it's available to other shells without having to wait for the command to finish.
From the manpage:
> INC_APPEND_HISTORY_TIME This option is a variant of INC_APPEND_HISTORY in which, where possible, the history entry is written out to the file after the command is finished, so that the time taken by the command is recorded correctly in the history file in EXTENDED_HISTORY for‐ mat. This means that the history entry will not be available immediately from other instances of the shell that are using the same history file. This option is only useful if INC_APPEND_HISTORY and SHARE_HISTORY are turned off. The three options should be considered mutually exclusive.
Re: Zsh Tricks to Blow Your Mind
#176Earlier quoted context omitted.
Not sure why you are getting all zeros in your duration column. Should be setopt ExtendedHistory (Zsh setopts, like Nim identifiers, are "style insensitive"). From the Zsh man page: EXTENDED_HISTORY Save each command's beginning timestamp (in seconds since the epoch) and the duration (in seconds) to the history file. The format of this prefixed data is: `: : ; '. (EDIT: My best guess explanation is some competing/con…
Thank you! How strange. `history -fD` does work, but only for commands in the current zsh session. It seems durations are being stored in memory but written out as 0's. I'll try the mailing list soon :)
It looks like either share_history or inc_append_history break recording duration in a fundamental way. The TL;DR is that the history line is written out before the command in question completes. I guess the thinking is that inc/shared history with some very long running command is not as useful if you wait until it ends and you have elapsed time data to append that line. I feel like that might be a personal issue - like if you almost only ever run commands 1-90 seconds then you are fine with the delay.
Anyway, this also explains why it is available from the `history -fD` command but not in the file.
Re: Zsh Tricks to Blow Your Mind
#177Re: Zsh Tricks to Blow Your Mind
#178Please, no. Bash (or better, sh) are just fine. They are good enough, and they are standard. I can log in anywhere and do things.
Re: Zsh Tricks to Blow Your Mind
#179Earlier quoted context omitted.
Looks like you probably also have SHARE_HISTORY set? [1] [1] https://unix.stackexchange.com/questions/396809/zsh-share-hi...
In my case, I have INC_APPEND_HISTORY enabled. It appears I get 0 in the duration column because it's writing to the history file before executing the command. I see there's the alternative option INC_APPEND_HISTORY_TIME to append to history after the command finishes in order to include the duration. It makes sense. It's preferring to add to history immediately so that it's available to other shells without having t…