Sometimes you may need to make a file unreadable in Linux to protect it from accidental access. You can easily do this by modifying its file permissions. These changes are permanent and persist even after your session ends. In this article, we will learn how to make file unreadable in Linux.
How to Make File Unreadable in Linux
Let us say you want to make a file data.txt unreadable in Linux. Here is a simple command to do it.
$ chmod 600 data.txt
In the above command, we assign permission 600 to our target file to make it readable & writable only by owner of the file.
Similarly, you can also use the following command to remove read(r), write(w), execute(x) permission from group and others.
$ chmod go-rwx data.txt
You can use these commands to make even folders unreadable. In this article, we have learnt how to make file unreadable in Linux.
Also read:
How to Measure Elapsed Time in Python
How to Create ISO Image from CD in Linux
How to Export Pandas Dataframe to Multiple Excel Sheets
How to Export Pandas Dataframe to Excel
How to Export Pandas Dataframe to PDF
Related posts:
How to Run Shell Script on Another Server
How to Create a Large File in Linux
How To Install Pip in Ubuntu Linux
How to Reload Bashrc settings Without Logging Out and Back In
How to List All Cron Jobs for All Users
How to Copy Files from One Directory to Another
How to Encrypt Folder in Linux
What are the Different Shells Available in Linux

Sreeram has more than 10 years of experience in web development, Python, Linux, SQL and database programming.