Preserve history between sessions of terminal usage (Mac osx) -


i followed different guide: https://apple.stackexchange.com/questions/50649/how-to-make-bash-terminal-app-remember-history-of-previous-sessions

and called 3 commands:

sudo -iu root cd ~(myusername) chown (myusername) .bash_history 

but upon every start of terminal following output:

last login: thu apr 21 15:39:19 on ttys000 -bash: username: no such file or directory 

and still unable retrieve recent commands in history using up-arrow key. know shouldn't have executed commands didn't know meaning of. can point me in right direction put terminal place , preserve history upon closing terminal?

what exact commands typed? mean, presumably did substitute name (myusername) didn't you? , command

cd ~(myusername) 

makes no sense me. on own,

cd ~  

will take home directory.

okay. basic troubleshooting (put answers here). load terminal , type (note there's no need use sudo of this):

cd ~ # changes home directory ls -la .bash_history # checks permissions , ownership of bash_history 

your bash history should have following permissions (or similar):

-rw-------@ 1 headbanger  staff  10619 20 apr 17:08 .bash_history 

so, me fix account, i'd type:

chown headbanger:staff .bash_history # if aren't owner, necessary use sudo here. chmod "u+rw,go-rwx" .bash_history # greybeards use octal 600 

i've avoided using octal chmod make more readable. letters in chmod mean following:

u user g group o other (u,g & o)  - remove permission + add permission = set permission  r read w write x execute 

let know how on!


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -