“So,” I think to myself, “I’ll use this time while the other POSSE participants are working on an exercise to practice my CLI skillz because they’re very rusty (and/or non-existent).”
On my work laptop (Fedora 23), I open a terminal window, run ls, see a couple of files that can bear removing. One is called ‘cascading_menu_HR’
I type
rm cascading_menu_HR
and get
rm: cannot remove ‘cascading_menu_HR’: No such file or directory
I ls again (in case it vanished when I wasn’t looking).
Nope. Still there.
OK, I think to myself, I can figure this out. I google.
Perhaps I need to remove it more forcefully. So I try:
rm -rf cascading_menu_HR
and get
rm: cannot remove ‘cascading_menu_HR’: No such file or directory
grrr. Angrypants. Maybe I am not powerful enough (probably not the case, but I’m exhausting my options). Besides ,’sudo” fixes everything, right?
sudo rm -rf cascading_menu_HR
and get
rm: cannot remove ‘cascading_menu_HR’: No such file or directory
Not unexpected but still frustrating. More googling: “cannot rm -rf file but shows when ls”. Find the following article: “No such file or directory” when trying to remove a file, but the file exists?
The article suggests that I run ‘ls -lb‘, explaining that ls -lb will list long form file names with octal escapes for nongraphic characters.[1]
And as it turns out, that file I was trying to remove was named ‘cascading_menu_HR/’ — what?! Why wouldn’t the listing just show me that?
More confusing yet, / isn’t a /, it’s an indicator that a space is being quoted, so I really need to use an extra space in my command:
sudo rm -rf cascading_menu_HR\ <- there's a space at the end that you can't see
The sudo business and the remove with great force were both probably unnecessary, but at this point I’m a little angry at this file, and I just want the blasted file gone.[2]
And the file is finally gone! Hooray!
Then I remember something that I *just* learned last week: Linux commands have a long form and a short form.[3] Turns out that -s is the same thing as –size and -a is the same thing as –all. Huh. That makes a *lot* more sense to me (and eventually I’m sure I’d use the shortcuts, but it’s a lot easier to remember –size than -s).[4]
Last night I was talking to Adrian about how this new long form command business is a big helper for me, and he tells me another thing that I didn’t know: the short forms of commands can be smushed together behind a single dash.
So, I’m thinking that I should be able to “un-abbreviate” the -lb into two component parts. Google and find that -l means long form of the listing, so I think that
ls --long --escape
will work
Nope. I get:
ls: unrecognized option '--long' Try 'ls --help' for more information.
???? -l means long but isn’t the short form of –long?? Whhhhhhyyyyyy?
Ok. Whatever. Moving on. I try some other stuff:
ls -a -s
works. And
ls -s -a
works but is much slower (is it because it has to do things backwards?)
Argh. Yet again, I find myself stymied by the stupidest things. I want to understand it …and when it doesn’t make sense it frustrates me. Greatly.
And so I end up feeling like “if something this ‘easy’ [5] has stymied me, then (a) I must be very stupid and (b) this is probably something I shouldn’t mess with anymore.
[1] No, I have no idea what that means, but if it makes it quit erroring.
[2] Annoying realization at this point: I don’t really care about removing this file — it’s been there for who knows how long and doesn’t seem to be hurting anything — but my little “CLI practice session” has turned into the very definition of stubbornness for me.
[3] Well, some of them do, but not all. ls doesn’t seem to have a longer form. (?? – why wouldn’t it be list?) and -l means “long” and -b is the shortcut for –escape (???). (And if you’re thinking to yourself that they must’ve used -b because -e was being used by something else? Nope. Not that I can tell.)
[4] BTW, why in heaven’s name does the long form require — when the short form requires –? Why couldn’t they both use -?
[5] Reminder: deleting a file via the command line is all I wanted to do.