Retaining the State

Learn how to retain the state of a process when working with CLI applications.

When you are dealing with the process of a script, and it exists, then all the data or the state is forgotten. So, what should you do if you need to retain this state? When you are in a browser, you can use something like local storage or cookies, but you do not have this with a CLI application. Instead of using local storage or cookies, you can create hidden files or dot-files to retain, or persist, your data. In Unix-like systems, files prefixed with a dot are hidden by default, which is why they are called dot-files.

Get hands-on with 1400+ tech skills courses.