LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-31-2016, 12:10 AM   #1
etaloot
LQ Newbie
 
Registered: Jul 2016
Posts: 1

Rep: Reputation: Disabled
(linux terminal question) Is it possible to add a comment, note or description next to a file or directory?


Quote:
by the way.. my question is relating to linux terminal, not X/GUI file manager.
Hey there, I was just organizing some files on my system in linux terminal and was thinking.. wouldn't it be cool if I could add a brief description of what is in each folder in this directory or a desciption of each file in the directory when listing via ls? Would be very helpful because most of the time a directory or filename is so random or abbreviated that when you come back to it at a later date you have no idea what it is without opening it up and examining it.

So anyways.. thought I would ask on these forums. Please see below for an example of what I'm asking:

Code:
root@example:/testing# 
total 16
drwxr-xr-x 3 root 4096 Jul 30 21:47 ./
drwxr-xr-x 7 root 4096 Jul 30 21:43 ../
drwxr-xr-x 3 root 4096 Jul 30 21:45 my_folder/    # downloaded files
-rw-r--r-- 1 root 1234 Jul 30 21:47 my_file.txt    # list of websites
root@example:/testing#
Any ideas or help would be greatly appreciated, thanks much!! ;>

-Nick
 
Old 07-31-2016, 02:33 AM   #2
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Posts: 1,622
Blog Entries: 40

Rep: Reputation: Disabled
The sunshine is beautiful this morning, I started my day eating some of the raspberries that remained after my wife has had her conserving rage and now I read this intriguing idea. I had to look up the word “intriguing”.., but anyway.

No.

There is currently no way to do what you ask for. But what a nice programming exercise this would be!
Other such realizations often bear a major flaw: The descriptions must be provided and maintained. And you must decide beforehand about the “granularity” of the information that you seek to convey.

But many file types on a Linux system are already covered and their description is found in arbitrary places, like in the magic files or just inside the file for picture formats, PDF- and many office-formats (as long as you do not care to “clean” this information away).

An alternative ls-command may not be equally useful for everybody or not in many situations. But I kind of like the idea...
And directories are like the cream on the cake (complete with the cherry): Imagine a nice way to concatenate and condense the file-information from the list of directory-entries.

One clumsy work-around:
Code:
user@machine:~$ for f in `ls`; do if test -f "$f";then file "$f"; fi; done
Edit: No. Not even clumsy. This may actually be the base for a downright shell-script solution and a good reason to keep the magic file up to date. Here is one contribution from me:
Code:
0     string  MV\x00\xFF\x0c\x00\x0e\x00
>8   string  \x19                      TextMaker 2016
>8   string  \x17                      TextMaker 2012
>8   string  \x13                      TextMaker 2006
>8   string  \x08                      TextMaker 2002
>>9 string  \x00\x03\x00-YA1   SoftMaker Office Document (before ~2015)

Last edited by Michael Uplawski; 07-31-2016 at 03:07 AM.
 
Old 08-03-2016, 06:29 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
This is where you realise why its important to use meaningful dir & file names and also to use a logical structure/layout for a dir tree..
Another std trick is to add a README file to a dir if necessary.

Also
Quote:
Linux has a maximum filename length of 255 characters for most filesystems (including EXT4), and a maximum path of 4096 characters.
https://unix.stackexchange.com/quest...-with-ecryptfs, so no excuse for not using meaningful names.
 
1 members found this post helpful.
Old 08-04-2016, 01:25 PM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
just one addition to all those valid answers:
if you need extra info for img123456.jpg, you can do this:
Code:
echo "extra info" > img123456
sometimes i also add a simple bookmark:
Code:
touch img123456
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
create a text file using terminal and to add contents into it gayatri_justin Linux - Software 2 03-11-2013 01:36 AM
Some great terminal commands you might want to know. (Along with a description.) darkstarbyte Linux - Software 7 11-08-2010 10:37 PM
Linux file/directory permission question cpthk General 11 09-04-2009 01:32 AM
How do I add a comment to a user? ricelover Linux - Newbie 5 05-17-2007 03:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration