Terminal coding

I have used the Terminal app and would like to know where typed in commands are saved?

If you mean commands saved by bash, they are in ~/.bash_history

1 Like

You might like this: Tutorial: Shortcut to List all Unique Commands from your Recent Terminal History

Or you can just use the command history in the terminal to see the last 1000.

1 Like

How are the Terminal commands connected to the behaviour of the phone when turning on after a power off. Are they executed again or are they redundant and can be wiped? If yes, is there a command to clean the Terminal?
I am trying to understand the workings.
Thank you.

If you’re talking about history, it’s just that - history. Like in a web browser, it’s a list of things that have been typed.

If you want to clear it, the command is history -c.

Thank you very much Dan,
It was a thought because it looks like starting the phone takes longer.

That could be any number of things, but I can almost guarantee the terminal history is not one of them.

1 Like

After the latest update I noticed the same. Maybe a second or two. This may not be permanent, just a side effect of updates, which may be remedied later, so don’t do anything drastic yet.

1 Like

I won’t do anything drastic, just clean out the Terminal.

Try sudo dmesg it will show you the systemd the messages when the system stsrted and sudo systemd-analyze blame will show you the time every service took to start.

1 Like

history “space”-c “.”??

Without the dot but that is to see the commands that you typed before.

*.bash_history shows all commands inserted. Not deleted!

Its “history -c” . The -c is for “clear”.

1 Like

history -c && history -w

Ok, fill me in please?

After related bash history cleared, the -w is for “write”.

history --help command will help there and in many other similar situations, please use --help option from time to time. I do forget that help option is available but it is an important option and almost always present. Next level option (more complex) would be: man history.

Thank you.

1 Like

Keep in mind that if you wipe terminal history, you then won’t be able to use the up and down arrows to cycle through your previous commands to view, edit if needed, and run them again. So you’ll have to retype everything…which is especially annoying with extra-long strings of text and symbols.

The terminal, by default, only retains the last 1000 commands anyway, dropping the oldest ones as needed. You can change the default 1000 to a different number, if you don’t want to retain so many. But they’re taking up practically no space at all. Here’s how to change the default: https://unix.stackexchange.com/questions/128396/how-to-set-the-number-of-commands-history-recalls

For your info, the bash history file on my laptop is only 15kb in size.