Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was trying to remove some old history from my .bash_history file, but I was receiving this message:

[john ~] /home/john $ mv .bash_history .bas
mv: impossible to move `.bash_history' to `.bas': Operation not permited

I suspected the file/directory permission:

[john ~] /home/john $ ls -ld .bash_history .
drwxrwx--T+ 5 root       john 4096 Out 11 19:45 .
-rw-r--r--  1 john john 2977 Out 10 14:36 .bash_history
[john ~] /home/john $

Then I tried:

[john ~] /home/john $ lsattr .bash*
-----a------- .bash_history
------------- .bash_logout
------------- .bash_profile
------------- .bashrc
[john ~] /home/john $

Probably it is this a attribute; what does it mean?

share|improve this question
up vote 13 down vote accepted

The a attribute means that the file is append-only: you can't overwrite it or delete it, only append data to it. This is explained in the chattr man page. Only root can remove the attribute.

The practical consequence is that you can't erase your old history lines. This is presumably intended as a security measure by your system administrator. I'm not completely convinced it's secure, but off the top of my head I can't think of a way to remove some of the file's contents. (It is however easy to bypass the file and run commands without their showing in the history, which is why it's not a particularly useful security measure against competent users — an obvious way being to run the commands from something other than bash.).

share|improve this answer
Got it... thanks Gilles – jyz Oct 12 '10 at 16:18
Also, going through the history command and using the -d option may allow line deletion even with this setting in place – Xalorous Nov 5 '15 at 18:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.