From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27858 invoked from network); 14 Apr 2023 14:52:17 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Apr 2023 14:52:17 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1681483937; b=iXaYKTKPPvNuwgEJss00IZxVsDW7VyrAGm1OSzS/Il2lrZKxMF0mVkkKdJRTJMYvqX4T6UZZ8j fYIhOReFVBDbC7yVnx1uHBQ9ZKeWYCCzr9vccTdFoLALyXxlI9AXpglT9EwiipR7EESgyr+TKD sUyKIndvurxfM/ouFTYegY79xJG5tDPd4l8quyJOohJckO2/eW1pWFoWXgdubYEVSRzPUmrwZQ K2AbcBbnYI0gapZ/1Qbis5qoJ7aGMs70gsWGAOWuyh4rthluGRXODHoQQfwWgXlZU9rZZabCG0 eRvG3C/7PoWAIb+Ed2KJWMRI+2ihdmJ0SNRpsAyUBBJ7bg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yw1-f176.google.com) smtp.remote-ip=209.85.128.176; dkim=pass header.d=gmail.com header.s=20221208 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1681483937; bh=E4RY1sIF65CsXCPXkV84kGkzsm/7Tpm3DCA6VzucO3U=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=kMr/tLsQFaOw58563m2BZm98vqaGYinwkchwoTC2f+yh6UeC6PmulRwzQbmRwu3iT/3VEI1i3V rRgUJq/3FDN2sD7CycIPrxdE87LrEzdB97ZDJwC09rKTg7VvpBp24CVzChJKt938kvHkE/pdt/ FkdQVJNZD+14n696jMb0g60dFrijuDSCbnOkYDAHQFloeGEot8qvbM3fvEmrsQeRRRBowTU40E ANyb1YnmA9gVmZHFusbQ6fhordcG6bdt5E9SUBnw1DnIBcXf7ofLXnxVQFqEME+TnXcIQY8xVa qyN1PD/RNacXbb0iRCj/mlV2/UuRa+QH+a2QLEYca3RoYg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Fpaa1riZ8SKHVEnNa76NsIZ683mYuxl8WdwB9mSlY8c=; b=PLTip/QjtfdDVVy2ySorC0z5Hi R67ml+qFBwfCrsGhOCNrlFQUhd4bOltQIFZyK6DgHObvVEUP0URGDOHy/rU1kZnMn0EHI2f0aF5MI ffPLXW8ksGM2A7vnB1kiRyCFhBKc12erQVF+hSVhEGh4a4B5WqOw6YlR+82lqtr3chxO+v67NmlZo 2ZjWw8wpyS7z4+TckkxfGv6seIrkkQGnBASJK1OMwWu0fhfxmgfmhLqa9/jqNNAhS+udyQ12e+Aka 52mJ0fM3eVHatVztQL4T+tEN+VfqRcnEyRZr7owg1Hos9C+ocJb9TpkFMy3yWHMgDreVkwwqYi8Tl vRyxpw2g==; Received: by zero.zsh.org with local id 1pnKmf-000IT3-2T; Fri, 14 Apr 2023 14:52:17 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yw1-f176.google.com) smtp.remote-ip=209.85.128.176; dkim=pass header.d=gmail.com header.s=20221208 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-yw1-f176.google.com ([209.85.128.176]:35403) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pnKlr-000HjK-FZ; Fri, 14 Apr 2023 14:51:30 +0000 Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-54fb615ac3dso135801387b3.2 for ; Fri, 14 Apr 2023 07:51:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681483886; x=1684075886; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Fpaa1riZ8SKHVEnNa76NsIZ683mYuxl8WdwB9mSlY8c=; b=VcZucgYLX56ml1fq1Y4yBMq/di7t0uGt70J92rDG2zjG5RlZoem0jQVVGDaGl8BnWx GFkORIgB0T2ciq7AAaIt3fOtP410CYr7VKekJVLnnmSj03tnRLRXtvown5GdLL7E8TDh Ab7A/rIavJ/G397/L7ojzm2cEFIs/6GP7ba86zQvxCNi84U2NdMwdeg/9NE6NXw84cjr dvVQBqJPYxMt8UCHR2fMaJYt3XEo4OBegvwPqt6bKrYcTnW4s2XVBsNT5OjbKHeeLV8v povEhoikdd3YNl33/Aryx6dNrpEArWiQ58QjeSxXgSjVVcl7ZMSGx2/DRfDinoL+tVyA ffew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681483886; x=1684075886; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fpaa1riZ8SKHVEnNa76NsIZ683mYuxl8WdwB9mSlY8c=; b=WJCxl+N1dCPZB4OS7Zw/Z9kmJ1bWMuMyN1Xd1tv2pa7IM7YJE2eTrObwRlf2H9ov7k lzDQFt3eIt67lJQfKbZ5UObvz8QafSRShnsVFZNEkQFm7yqw6eIZyRUEv0w+ff5okh+b tW2t5C4KxKDC6hdXn/4p6mK4StQrjhKLhcEb1NwgQqotkFb7JqQ7yAeiAeXTxGwWuvLS BKZ01s7q5vHIP1joXAvyMmgdo8+XNaA8yvlEHvx/4QN1KS//Wldj4ulOFwm5yNJaGMEP DpBP7GmW3N8Jx3nE1abjYrUwwz4tbP7Cc0HDCOVYPp3HLGm8UcGZKwJ9nu91Ec7Se1pK tk2g== X-Gm-Message-State: AAQBX9fdCnMexmrOOO/Zwi3VIQp7iywAcgjp7RYMyc1oJ0V4Uuq74Wxa 9D0TY5dQM+nDSYTbSAckEOGrPmnsP7aorNcNMnIByTDpWjQ= X-Google-Smtp-Source: AKy350bk5wtYXeDFDwu7VrL/B9Kv7iyyhCYdUIYqpo6nCJhNe6bKrCmR7t+bKyEUvItc1kSpg/Odj3hQQU+48XqFkYs= X-Received: by 2002:a81:a787:0:b0:549:2cc8:6e3e with SMTP id e129-20020a81a787000000b005492cc86e3emr3853386ywh.9.1681483886377; Fri, 14 Apr 2023 07:51:26 -0700 (PDT) MIME-Version: 1.0 References: <81609CF4-42DA-4E0F-A6E5-C5D58578B4F7@easesoftware.com> In-Reply-To: <81609CF4-42DA-4E0F-A6E5-C5D58578B4F7@easesoftware.com> From: Felipe Contreras Date: Fri, 14 Apr 2023 09:51:15 -0500 Message-ID: Subject: Re: .zsh_history To: Perry Smith Cc: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 29019 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Sat, Apr 8, 2023 at 11:17=E2=80=AFAM Perry Smith = wrote: > > I don=E2=80=99t have anything special set up other than setting HISTFILE,= HISTSIZE=3D2097152, and SAVEHIST=3D1048576. I also have histignoredups an= d histignorealldups on. > > The reason for the huge numbers is partially due to some confusion I had = (see below) but basically I want to save unique commands that I did for ver= y long periods of time so I don=E2=80=99t need to figure them out again. I do the same, but hopefully you are not relying on zsh to do that, because you have to grep the history file yourself. > I=E2=80=99m on macOS and they have this thing for =E2=80=9Csessions=E2=80= =9D which I=E2=80=99ve turned off now (a few weeks ago). The reason is tha= t the session history files are limited to two weeks and so commands I did = long ago are getting deleted and my .zsh_history file was only growing to b= e about 1000 lines. > > My question is, if I start multiple terminals and run various commands an= d eventually they each log out or exit, I=E2=80=99m wondering what happens = to the .zsh_history file. Does the last shell to exit rewrite the file usi= ng its own history which (I=E2=80=99m guessing) is the contents of .zsh_his= tory when the shell started up plus the commands that were executed in that= shell? This would overwrite all the commands done in the other shells tha= t have just exited. It writes all the current history of the shell (`fc -l 0`), but by default APPEND_HISTORY is on, so it would append the current history to the file. So in practice the history is not overridden. But is this realistic? Do you actually have more than 1048576 lines in your history? What is $HISTCMD? > Alternatively, the shell could re-read .zsh_history at the time it is exi= ting and append the commands that were executed within that shell and write= the result out =E2=80=94 thus preserving the commands done by other shells= . That's exactly what it does (unless you set NO_APPEND_HISTORY). Cheers. --=20 Felipe Contreras