How to open a "-" dashed filename using terminal?

LinuxTerminal

Linux Problem Overview


Linux Solutions


Solution 1 - Linux

This type of approach has a lot of misunderstanding because using - as an argument refers to STDIN/STDOUT i.e dev/stdin or dev/stdout .So if you want to open this type of file you have to specify the full location of the file such as ./- .For eg. , if you want to see what is in that file use cat ./-

Solution 2 - Linux

Both cat < - and ./- command will give you the output

Solution 3 - Linux

you can use redirection

cat < -file_name

Solution 4 - Linux

It looks like the rev command doesn't treat - as a special character.

From the man page

The rev utility copies the specified files to standard output, reversing the order of characters in every line.

so rev - | rev

should show what's in the file in the correct order.

Solution 5 - Linux

I tried with pico or vi command.pico readme which allowed me open in editor and read the contents.

Solution 6 - Linux

if you want to open this type of file you have to specify the full location of the file such as ./- .For eg. , if you want to see what is in that file use cat ./-

Solution 7 - Linux

cat ./- is the syntax that reveals the correct password for bandit the "rev -" reveals something else

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlfranView Question on Stackoverflow
Solution 1 - LinuxPrithvi RajView Answer on Stackoverflow
Solution 2 - LinuxmapmalithView Answer on Stackoverflow
Solution 3 - LinuxwyxView Answer on Stackoverflow
Solution 4 - LinuxmichfuerView Answer on Stackoverflow
Solution 5 - LinuxPraney PareekView Answer on Stackoverflow
Solution 6 - LinuxBUSH JOSEView Answer on Stackoverflow
Solution 7 - LinuxPeter VenablesView Answer on Stackoverflow