itdontgo
Posts: 6
Joined: Mon Mar 12, 2018 12:42 pm

Turn off command line storage

Thu Jul 19, 2018 11:24 am

Hi,

I have an application where a micro-controller enters data into the Raspberry Pi via the commend line (using the UART). It types something like:

echo "10.1" > file.txt

It does this over and over every second.

I store the 'file.txt' on the RAM drive as I don't want repeated writes to the SD card - this has to last a long time.

When you press the up arrow you get the previous commands entered. This must be stored somewhere on the flash drive. I either want to store this in RAM or disable it so I don't keep writing to the SD card every second. Is this possible?

timg236
Posts: 5
Joined: Thu Jun 21, 2018 4:30 pm

Re: Turn off command line storage

Thu Jul 19, 2018 11:38 am

You can disable the bash history with this command

Code: Select all

set +o history
See https://linuxconfig.org/how-to-disable- ... y-on-linux

DirkS
Posts: 9037
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Turn off command line storage

Thu Jul 19, 2018 11:43 am

By default commands that start with a space are not put in the history.
See e.g. https://stackoverflow.com/questions/647 ... sh-history

BTW: if a command is a duplicate of the previous one it should not be added to the history either.

itdontgo
Posts: 6
Joined: Mon Mar 12, 2018 12:42 pm

Re: Turn off command line storage

Thu Jul 19, 2018 12:28 pm

That's great thanks!

User avatar
PeterO
Posts: 4241
Joined: Sun Jul 22, 2012 4:14 pm

Re: Turn off command line storage

Thu Jul 19, 2018 2:08 pm

DirkS wrote:
Thu Jul 19, 2018 11:43 am
By default commands that start with a space are not put in the history.
See e.g. https://stackoverflow.com/questions/647 ... sh-history

BTW: if a command is a duplicate of the previous one it should not be added to the history either.
+1 Useful tip !
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Return to “Advanced users”

Who is online

Users browsing this forum: No registered users and 10 guests