I have a file named :~/ .

I can't open this cat ':~/' file. I tried different methods, but there is no result.

How to open it?

By the way, only sh works, bash is limited.

The folder contains the following files:

 ~ $ ls #~o :'( :~# :~E =) XD $diary.txt :( :~& :~J =8) X~( (*v*) :) :~( :~P =DX~p (.V.) :* :~) :~Q =O ^_^ (~: :*) :~)(~: :~o =P |~O (~}{~) :> :~)* :~| =^.^= ~,~ )~: :P :~* :~∕ =~O ~:0 *<:o) :S :~> ;) >:) *~* :_( :~@ ;~) B~) -$ :o :~B <:3)~ Oo 8~) :o3 :~D =( O:~) 
  • Try cat ??? - eri
  • cat ': ~ /', cat ": ~ /" cat {: ~ /} cat (: ~ /) did not help, everything didn’t work - Muxamedov Rahimjon
  • one
    The symbol / not allowed in the file name in all modern OS, so that you are deceiving us - andreymal
  • 2
    @RahimjonMuhamedov highlight the cat ':~∕' command cat ':~∕' in this is my comment, press the right mouse button, select "Copy", go to the terminal, press the right mouse button, select "Paste" and press Enter - andreymal
  • 3
    @RahimjonMuhamedov I repeat, / and are DIFFERENT characters. You tried to enter / , but you had to enter . From my commentary you copied the correct character, that's why it helped - andreymal

3 answers 3

The symbol / forbidden in the name in most modern OS, therefore the file :~/ cannot exist in principle.

Instead, you have a file :~∕ - it uses another slash.

Yes, these are two DIFFERENT slashes, despite the fact that in the terminal they look the same:

Accordingly, if instead of a slash the tick mark is used, the cat ':~∕' command works fine.

    a copy of my answer (with the replacement of “directory” → “file”) with an essentially similar question:

    1. Run (having previously installed, if not installed, and there is such an opportunity) some file manager: mc , lfm , vifm , ranger , etc.
    2. if vim installed (not vi !) and you need to edit a file, you can use it as a file manager: vim . - the program will run in netrw mode (by default, this script seems to be installed in ubuntu ), where you can “go” to any file / directory.

      pressing enter will be interpreted for the directory as cd , for a file opening it for editing.

    3. if emacs installed, you can use its dired - directory editor package.

    4. for the most extreme (but absolutely universal) case, you can use the cat -- "$(...)" construct cat -- "$(...)" , where instead ... should be a command that returns the name of the desired file (quotes are needed for cases where there are spaces in the file name , and -- - in case the file name begins with a hyphen).

      this may be, for example, the command ls | sed -n 2p ls | sed -n 2p , where 2 is the number of the desired file in the output of ls .

      you can see the numbered issue of ls , for example, like this:

       $ ls | nl 1 acpi 2 adduser.conf 3 adjtime 4 alternatives 5 anacrontab ... 

      i.e., to view the adduser.conf file adduser.conf do the following:

       $ cat -- "$(ls | sed -n 2p)" 
    • one
      By the way, it is worth adding -- after cd / ls / cat , otherwise it will be difficult to access the file / directory starting with a hyphen - andreymal

    Someone had fun :). Try using shielding. Write characters through. For example (\ ~} {\ ~) instead of (~} {~), etc. The only thing is the '/' character - it should not be, it is a reserved character, or a similar special character is used (there is one), or is it a directory that is written in the same way as / usr /