0

I used ls ~ on RHEL 7 but I got <F6>q as output! What does it mean?

[user@server2 ~]$ ls /home/user/
<F6>q

[user@server2 ~]$ ll
total 4
-rw-r--r--. 1 root root 340 Sep 18 17:16 <F6>q
[user@server2 ~]$ cat <F6>q
-bash: F6: No such file or directory
[user@server2 ~]$ touch test
[user@server2 ~]$ ls
<F6>q  test
[user@server2 ~]$ vim <F6>q
-bash: F6: No such file or directory
[user@server2 ~]$ 
  • undisplayable character. – Ipor Sircer Nov 22 '18 at 9:01
3

It means that your file is named <F6>q.

These are not undisplayable characters, as comment-answers and other actual answers suggest. You can see them displayed, right in front of you. ☺

In any case, <F6> is not any of the forms that ls emits for undisplayable characters.

[user@server2 ~]$ cat <F6>q
-bash: F6: No such file or directory
[user@server2 ~]$ vim <F6>q
-bash: F6: No such file or directory
[user@server2 ~]$

You need to learn about shell syntax.

You are running the cat and vim commands with their standard inputs redirected from the file F6 and their standard outputs redirected to the file q, with no actual command arguments. The former redirection fails, because there is no file named F6, your file rather being named <F6>q, and the latter redirection is consequently not attempted at all.

Here is the same command, with whitespace showing how the shell is parsing it:

[user@server2 ~]$ cat < F6 > q
-bash: F6: No such file or directory
[user@server2 ~]$ vim < F6 > q
-bash: F6: No such file or directory
[user@server2 ~]$

To pass a file name containing shell metacharacters to a command as-is, without the shell responding to the metacharacters, they must be quoted:

vim '<F6>q'
or escaped:

vim \<F6\>q

Given what happens in VIM when you press a function key in ex command input mode, it is fairly easy to accidentally generate files with names like these using VIM.

0

When you're using plain ls (or its alias ll) and the output is going to a terminal, RHEL 7 ls will convert control characters and other non-printable characters into a visible form. That's most likely what you're seeing. If the output is going to anything other than a terminal, this default replacement won't happen.

You can use ls -q to replace non-printable characters with question marks. Question mark is an appropriate shell wildcard for a single characters, so if you run ls -q /home/user/ and see ?q as a response, it means your mystery file probably has an unprintable character with ASCII value of 0xF6 as its first character.

You can also use ls -b to get non-printable characters represented as C-style escape codes, which may not be directly usable in a shell, but allows exact identification of each unprintable character.

You'll probably want to rename the file into something easier to handle:

cd /home/user
mv ?q possible-typo

It might have been created as a result of mistyping the vi command :wq as :w<extra character>q. The latter form of the command is interpreted as "save the current file using name <extra character>q" instead of "save using the existing name and then quit".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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