2

Why would a file show up surrounded by double quotes with a character surrounded by single quotes within it?

"insight_automation.log'.'2024-03-13"

I am using Ubuntu Server 22.04.3 LTS. A service desk management program (Atlassian Jira Data Center 9.12.4 if that is relevant) installed on the server writes to various log files. Some of the files are rotated, and after an update some of the log files display as shown above when I execute

~$ ls /var/[application-directory-path]/log

Other log files display without any quotes. Some examples:

atlassian-jira.log
atlassian-jira.log.1
insight_audit.log
insight_audit.log.2024-03-05
insight_automation.log

There are many posts about single and double quotes in Unix systems, especially with the GNU developers adding single quotes around files with spaces. I am somewhat familiar with the nuance surrounding these characters and Unix, but this is new to me, and I can't find an explanation anywhere online (likely because it is difficult to phrase the problem).

I looked at the logging configuration files and nothing appears different between the delinquent insight_automation.log rotate settings and the other log files. My only guess is that the dot in the name is a different Unicode character that is escaped similar to the way spaces in file names are. Maybe One Dot Leader, Interpunct, or Bullet?

I am sure I can fix the issue simply, but knowing why it is displayed like this would help a lot.

1 Answers1

5

(I'll just answer this here so you don't need to read all the whining about that feature in the linked answer.)

Recent versions of GNU ls by default wrap filenames with special characters in quotes, when printing to a terminal, for the purpose of making the output unambiguous, and e.g. making any trailing spaces visible. In most cases, they use single quotes, but if the name itself contains single quotes, they might use double-quotes to wrap the whole name.

Assuming you're using one of those versions of ls (which is likely if your system isn't old), then your filename is insight_automation.log'.'2024-03-13, and ls prints it quoted as "insight_automation.log'.'2024-03-13".

The output should be suitable as input to the shell (well, to Bash anyway), so you can check with e.g.

ls "insight_automation.log'.'2024-03-13"

which, if it works, should find your file.

Or, if you want ls to print the filename without any extras, run

ls -N

instead. Or ls -N *\'* or such to match just filenames that have single quotes in them.

As to why you'd have a filename with quotes, we can't know without seeing the rest of your system.

ilkkachu
  • 138,973
  • Haha. Technology is always changing (and mostly improving) but even the "techiest" of us are quick to whine when it happens. I worked at a helpdesk for a while and even the smallest software or system changes caused riots. – Logan Kitchen Mar 14 '24 at 17:20