Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop

In this Discussion

New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How-to: Add notes to your Linux files

farsighterfarsighter Member
edited September 2019 in Tutorials

You'll need to install attr (extended file attributes) through your package manager.

Attr will let you (among other things) set your own file attributes in the 'user' namespace and add any text to them.

Examples:
This will assign user.memo attribute the value you set in -v option:

$ setfattr -n user.memo -v "write here some note" filename

Another one:

$ setfattr -n user.author.name -v "write here your name" filename

(n=name, v=value)

To dump all user attributes of a file and their values:

$ getfattr -d filename

To show a single attribute of a file and its value:

$ getfattr -n user.xxx filename

To show only values (will skip attribute names) of all attributes of a file:

$ getfattr --only-values filename

To dump all attributes and their values of all files in a directory (recursively):

$ getfattr -R -d /home/john

To have getfattr output text in different languages charsets just add the following option to above getfattr examples:

-e "text"

To delete an attribute:

$ setfattr -x user.xxx filename

To copy a file and preserve its attributes (will work on supported filesystems) use the -p (preserve) flag:

$ cp -p filename dir 

If you're moving your files to another filesystem (e.g. for backup) where attributes aren't supported, you can easily backup your attributes for later restoration (or just for reference).

To backup all attributes and values from current dir onwards into a file:

$ getfattr -d -R . > data

To restore everything from above backup file (must run from same dir where backup was taken) :

$ setfattr --restore=data

Thanked by 1borales

Comments

  • ZecronkingZecronking Member
    edited July 2024

    It's been a while since your post, but I'd like to add some information. Adding notes to your Linux files can be a game-changer for staying organized. One nifty way to do this is by using an online notepad service like https://notesonline.com/notepad . It's pretty straightforward—just open up your file in any text editor you fancy, pop your notes at the top or bottom, and hit save. This way, you can easily keep track of important details or jot down reminders without cluttering up your main text. It's also super handy if you're collaborating with others, as they can quickly see your notes and stay in the loop. Give it a shot and see how it meshes with your workflow!

Sign In or Register to comment.