What is a dashed filename?

What is a dashed filename?

Working with dashed filename in Linux requires some attention. Dash (-) character at the end of the commands is a popular convention to refer stdin or stdout. Dash is not a special character for filesystem or kernel.

How do I open multiple files in Unix?

The answer to my question was you can’t, but you can open two files in one bash window using VIM’s :split command:

  1. Open a file with $ vim file1 , open a second file within VIM using :split file2 command.
  2. Or, use $ vim -o file1 file2 from bash.
  3. Switch between files–toggle active file–in VIM with ctrl – w ctrl – w .

What is dashed file in Linux?

In Unix or Linux operating systems, working with dashed filename requires some attention. In some cases, you may need to handle files with a dash (-) as the first character. Because dash (-) is generally used by commands to specify options and arguments.

How do you handle spaces in filename?

Use quotation marks when specifying long filenames or paths with spaces. For example, typing the copy c:\my file name d:\my new file name command at the command prompt results in the following error message: The system cannot find the file specified. The quotation marks must be used.

How do I open two Vim files side by side?

The exact steps look something like this:

  1. Open the first file in vim.
  2. Type :vsplit to get two panes side by side (tip: maximise the window on your widescreen monitor before you run this command)
  3. Jump to the second pane ( Ctrl+w followed by arrow key) and then open the other file :e filename.

What to do when a file starts with a dash?

Any commands can use the tips when handling a filename starting with a dash ( – or — ). The syntax is as follows: We use “ — ” to make Linux and Unix command stop parsing shell command line options. Now, let us see some examples.

How to find dashed file name in Linux?

You can also use regex to find a file ( – ). Here we have used .*/ in the beginning because find matches the whole path. You can use the similar commands also in scripts to handle dashed filename or directory name in Linux and Unix.

How to remove single dash file in Linux?

You can remove the single dash ( -) file using simple rm command # rm -vf -file rm: invalid option — ‘l’ Try ‘rm ./-file’ to remove the file ‘-file’. Try ‘rm –help’ for more information. As rm will consider -file as an input argument instead of operand.

Is there a way to hide the dash in a command?

You can “hide” the dash from the command by starting the filename with ./ (dot slash). For example, try to remove a file named “ -filename.txt ” using rm command: The — is technically known as delimiting the options list.