Using inode number to delete files with unusual names

The problem:

So a couple of days ago this happened:

% ls -lh |grep 033
-rw-r--r-- 1 jsvd users 71K May 25 15:05 `\033

Yeah.. “What the hell is that?” was my first thought. The second was “How do I delete this?”

I tried the usual tricks to delete files with weird characters, to no avail:

% rm ./`\033
% rm "\`\\033"
rm: cannot remove ‘`\\033’: No such file or directory
% rm "\`\033"
rm: cannot remove ‘`\\033’: No such file or directory
% rm "*033"
rm: cannot remove ‘*033’: No such file or directory

The solution:

The only way I was able to delete the file was through the inode:

% ls -lhi |grep 033
 50105 -rw-r--r-- 1 jsvd users  71K May 25 15:05 `\033

OK so now that I have the inode of the misbehaved file, let’s confirm we can find it by the inode:

% find -inum 50105

Ermm..yep that’s it. Just pipe it to rm and be done with it:

% find -inum 50105 | xargs rm

Is it gone?

% find -inum 50105


Master and Slave Morality

To begin this series of philosophical concepts useful to me (read the intro here), a duality came to mind, one I find very much alive in today’s society: Friedrich Nietzsche‘s Master/Slave morality.

To me, Nietzsche was a very passionate philosopher. His prose is a very raw and intimate transposition of his thoughts to paper and you often get the feeling that he is confiding in you and you alone. He was also known as the “attack philosopher”: Socrates, Plato, his teacher Arthur Schopenhauer, Democracy, Religion (specially the Judeo-Christian traditions) were some of the targets of his blunt and sometimes vicious criticism. Nietzsche also often exaggerated his arguments, leading to misinterpretations in the past:

One of his recurring concerns was the concept of Good and Evil, and the moral frameworks necessary for such notions to arise and develop. In the book “On the Genealogy of Morals” – not surprisingly subtitled “A polemic” – Nietzsche describes his effort in tracing back the origins of good and evil while playing off his perspectivism against the notion of morals: if ideas are all construed from a perspective, there is not a single moral construct, but several. And so he distinguishes the concepts of Master and Slave morality:

Master Morality:

The Masters can easily be found in the great ancient civilizations such as the Greeks, that Nietzsche deeply admired and loved though he focused on the Pre-Socratics and the great warriors of Homer’s epics (“Iliad” and “Odyssey”). They were, for the most part, a small group of aristocrats and other privileged elements of the society, supported by a very large number of merchants, peasants and, most of all, slaves.

Aristotle, a master.

At the top of this very large pyramid base, the Masters pursued excellency, compared themselves to no one (one must be careful here and note that they keyword is pride, not vanity), created their own values, created themselves. They considered what they did as good, noble and the actions of “lesser” people as bad, weak, pathetic. Nietzsche clearly distinguishes “good and evil” (something Masters were beyond of) from “good and bad” (strong and weak). They were also very focused on this world, which is something that plays an important role in Slave Morality.

Slave Morality:

Slave morality is, on the other hand, a response to Master Morality. Its creators were, for the most part, actual slaves, who deeply resented their masters.

Theirs was a moral of reaction, of subversion, of self-denial, where the values of their masters were turned upside down, viewed as evil. Note here how “evil” in the slaves’ perspective is about something strong while “bad” in the masters’ view is about weakness. You can see how quickly excellency, pride, creativity, being strong willed and even egoistic can be turned into mediocrity, humbleness, resentfulness, altruism and self-deception. Seeking knowledge and perfection was no longer admirable and ignorance almost became..bliss.
The Judeo-Christian religions heavily contributed and stood by the side of Slave Morality, offering an alternative to this world, valuing humility, self-restriction and self-denial:

Another interesting property to be noted is that, while masters created values for themselves, slave morality tries to put everyone under the same beliefs (again a very religious, single point-of-view moral perspective).


Society has come to widely accept Slave Morality as desirable and this is something Nietzsche was very concerned about as he wrote the book. Defining yourself through the opposite of what you resent is clearly harmful, though we shouldn’t be too quick to dismiss Slave morality entirely (or Master morality) for it might have something to teach us about how we behave ourselves and how we respond to our environment.

So to finish this long post, here’s a homework for today: try to spot a behavior that you clearly identify as “Slave Morality” and another that follows the Master mentality!

Philosophy, our life and the World.

How often we hear someone say “yeah, my philosophy of life is..” and then throw out a James Dean quote or a misunderstood and abused aphorism without having given a single moment’s thought on his or her life, principles and motives and most of all his or her passions?

We tend to aggressively avoid Philosophy mostly due to its subjective, mind bending and often convoluted topics and our own inability to grasp its purpose in “real life” (the same can be said about Math, actually). Robert C. Solomon, however, explained – better than I’ll ever be able to – what it means to be a philosopher and how should it help one’s life:

The Philosopher: Robert Solomon.

During my readings (and listenings) several philosophical ideas stood out for me in a very particular way. In sense, they’ve captured in words concepts what I had only thought of, but in another (and more interesting) way they’ve enabled me to get a more complete understanding of human dynamics, both social and individual.

I’m going to take advantage of this blog space to bring forward some of these concepts out to the public and also help me structure my thoughts in a way I’d otherwise not bother to.

Since this introduction is already at a decent size, the first concept will show up on a new post (hopefully) in a couple of days.

Transfer files using SSH + tar

This is a nice little way of transferring files over ssh and tar, so that you avoid scp’ing every single file in a dir tree and also don’t end up using auxiliary tar.gz files:

tar cvzf - my_dir | ssh server 'tar xzf -'

Doing a simple benchmark (LAN environment):

$ du -sh my_dir

$ find my_dir | wc -l

$ time scp -C -r my_dir server:
3.73s user 0.68s system 34% cpu 12.699 total

$ time tar cvzf - my_dir | ssh server 'tar xzf -'
tar cvzf - my_dir   2.15s user 0.30s system 67% cpu 3.635 total
ssh pulso1 tar xzf - 0.53s user 0.13s system 18% cpu 3.645 total

Curiously this shows how the gain is actually twofold: not only you are piping through ssh+tar, but you get two processes in parallel, one local, the other remote doing your bidding.
This makes the actual runtime of the task less than the sum of two those times. The local process starts, some time after the remote starts, time passes, the local ends, then the remote also ends. Wall clock time yielded somewhere around 4.5 seconds.


Aggressive Acceptance (of the World)

To deny the otherworldly. To reject something other than your reality.

The concept, strongly advocated by the philosopher Nietzsche, is portrayed in his “Thus spoke Zarathustra” through the Persian messiah that preaches this world instead of another, “other” world. What he calls an aggressive acceptance of the world and others is just that:

  • don’t embrace idea of other existences after this one (this obviously relates to religion);
  • don’t disregard aspects of your reality to form a distorted depiction of it;
  • “THIS” is what you have, accept it.

A misconception that often forms when reading the above is that such a view is nihilistic and an excuse for inaction.

Now, allow me in this paragraph to take a tangent: while existentialism is associated with nihilism in the popular culture, I’d like to, if possible, contribute to the awareness that existentialism does not imply nihilism, and vice-versa. Take Nietzsche, for example, while having a connotation of being a nihilist thinker, when he writes about the topic, what he does is show his concern about an impending collapse of society due to the fact that the greatest values such as religion, morality and even truth can be themselves nihilistic, and therefore self-undermining.

Nietzsche takes his reality as a undeniable part of himself and fiercely accepts it, like many other philosophers that dwell in existential thinking. Also, this reality serves a standpoint from where he can grow, flourish, overcome himself and become a Superman. Archimedes once said “Give me a place to stand on, and I will move the Earth.” and this, I think, is a fantastic example what it means to find oneself in the world, recognize one’s environment for that it is, and then overtake it. For one to move the Earth, one’s foundations must be solid and not based on fickle realities.

The practical implication of these rationalizations is that you’ll often realize the existence of bits of your life that you shun for some reason or other. And this fragmentation of yourself is ultimately hurtful and damps your ability to become so much more. Also, with the same implications, you may find yourself too devoted to realities that are not.

Quickly serve a file over HTTP w/ Sinatra

Sometimes you need to send someone a medium/big file and you might find yourself in this situation:

  • You’re in a LAN or not firewalled
  • The file has sensitive information
  • No existing shares to use, or other file repos

If you have ruby and the sinatra gem installed, place the file on the current dir, fire up your editor and write the following:

require 'sinatra'
get '/' do
 send_file(FILENAME, :disposition => 'attachment', :filename => File.basename(FILENAME))

Now run:

ruby serve.rb

On the receiver side (assuming the web server will listen on 4567, such as Webrick):

wget http://your_ip:4567


Comes e Bebes #1

Numa óptica menos estruturada, vou criar estes posts para anotar experiências boas e más que vou tendo de restaurantes, produtos que compro, etc.

    Começo, contudo, com nota negativa para um restaurante que visitei recentemente, o “Amo-te Chiado“, e vou directo ao assunto: não volto lá, e deixo aqui vários pontos que desagradaram:

    1. Pessoal do restaurante não prima pela eficácia, mas é um mal menor e perdôo quando a comida é boa;
    2. Couvert..mau: pão seria bom não estivesse já a ficar duro, umas 5 azeitonas, e pouco mais;
    3. “Coca-cola? Não temos..só Pepsi..Light“;
    4. O prato escolhido foi francesinha, mas a “mítica” forma de coração dos “Amo-te” não era discernível. O molho estava longe de ser agradável, e enquanto comia só conseguia pensar, com saudade, nas francesinhas do Dom Tacho ou mesmo da Cascata.

    Não conheço outros restaurantes da cadeia, mas apenas posso dizer que, pela amostra, os colocarei no fim das minhas opções, não vá a experiência repetir-se. Valeu apenas a companhia (como sempre) e o ambiente relativamente sossegado.