Linux Bash Shell Cannot/Can't View File That Starts With - Dash ?

I was getting really annoyed with this, I used full quotes around the filename and vi, cat, less all thought I was trying to pass the dash in the filename as an argument.

I didn't realize that all you have to do is just put a dash dash "--" in front.

Here's an example: cat -- "-etc-glusterfs-glusterfsd.vol.log"

Without the -- you get: cat: invalid option -- c
Try `cat --help' for more information.

I hope this saves someone else some trouble.  I never thought that a dash of anything could fix such an annoying problem :)

I still think it's not preferable to have a filename which starts with a - but gusterfs thinks it is a smart thing for now.

Latest Articles

  • Openvz Quick Install for CentOS 5 Tutorial
  • Subnet Mask Lengths / Quick Reference
  • Linux How To Add/Delete A Default Route/Gateway
  • DRBD WFConnection Problem/Solution
  • How not to change an IP address in CPanel during a migration
  • CPanel Cannot Login Internal Server Error Could not fetch uid or gid for : root https://192.168.1.42:2083
  • sed script to automatically update IPs in named/BIND and httpd/Apache
  • mdadm Linux Software RAID QuickStart Guide
  • HeartBeat Error/High Load heartbeat: [7120]: WARN: Gmain_timeout_dispatch: Dispatch function for retransmit request took too long to execute: 20 ms (> 10 ms) (GSource: 0x926b390)
  • VirtualBox Error Failed to start the virtual machine Centos 5.5 Mirror. Medium '/home/testuser/.VirtualBox/HardDisks/Centos 5.5 Mirror.vdi' is not accessible. UUID {a1a9fad7-0402-4867-b8f3-39fb49454bc5} of the medium '/home/testuser/.VirtualBox/HardD
  • Installing Virtualbox on Centos 5.5
  • Openvz Live Migration Error - Error: undump failed: Invalid argument Restoring failed: Error: iptables-restore exited with 2 Error: Most probably some iptables modules are not loaded Error: rst_restore_net: -22
  • OpenOffice Writer Default Paragraph Annoyance
  • DirectAdmin Install Webalizer Stats
  • Ubuntu Linux HTML Rendering left bracket < problem appears as 003C box
  • Solution - error while loading shared libraries: libgd.so.2: cannot open shared object file: No such file or directory
  • Linux Kernel Boot Black Screen of Death Freeze/Halt Solution
  • Linux Kernel Freeze/Hang during boot on io scheduler cfq registered (default)
  • VirtualBox/VBOX Centos 5.5 Installation Kernel Freeze Problem "NET: Registered protocol family 2" And Solution
  • VirtualBox OSE/VBOX Can't Access Shared Folder Solution