14

I want to describe a situation that happened two levels earlier. I use the bash shell to navigate through directories.

Say I started at the directory /home, and then I moved to the directory /home/Downloads, and finally I moved to /home/Videos.

Now I'll describe how to navigate to earlier directories:

To go to the previous directory type cd -. And to go to the previous of previous directory type cd --

As you notice, previous of previous sounds odd.

Is there a replacement word for "previous of previous"? Or how would you paraphrase it to make it sound grammatical?

psmears
  • 16,391
kenn
  • 371
  • 1
  • 4
  • 10
  • 3
    To go to the previous directory type cd -. And to go to the directory before, type cd -- – Tushar Raj Jul 09 '15 at 17:54
  • @TusharRaj Thank you for responding. Your suggestion looks neat but I want kind of math way to emphasize its ordinality. – kenn Jul 09 '15 at 18:00
  • 2
    Parent and grandparent? – deadrat Jul 09 '15 at 18:04
  • 4
    @kenn: Ordinality? Sorry man, but we don't speak math. The closest English could get you would be 'grandprevious'. Try Math.SE or Stackoverflow – Tushar Raj Jul 09 '15 at 18:05
  • 1
    @deadrat: Jinx. – Tushar Raj Jul 09 '15 at 18:06
  • It just means that one of us is very, very clever. Maybe both. – deadrat Jul 09 '15 at 18:08
  • @TusharRaj grandprevious also sounds unfamiliar. You can be more creative :) you are getting closer. – kenn Jul 09 '15 at 18:11
  • Like @deadrat said, parent directory is pretty standard among techies, and grandparent is often used to extend the metaphor/terminology. 'Grandprevious' was just a neologism of mine. – Tushar Raj Jul 09 '15 at 18:15
  • @deadrat: Let's go with both! – Tushar Raj Jul 09 '15 at 18:16
  • possible duplicate of http://english.stackexchange.com/questions/37148/word-meaning-two-paragraphs-previous – hatchet - done with SOverflow Jul 09 '15 at 19:47
  • @hatchet I did a quick search on the net prior to asking question here. I read that topic too but it doesn't provide a satisfactory answer. – kenn Jul 09 '15 at 19:54
  • Did I just learn a bash shell tip from English SE? :-| – loneboat Jul 10 '15 at 14:25
  • @deadrat It's not actually the parent directory. Per the Bash documentation, "cd -" will take you to "The previous working directory", not the parent directory. – recognizer Jul 10 '15 at 17:03
  • What you have is a "directory history" and you are moving back one or two positions in the history. Do not try to say previous of previous it's very confusing (some folks suspect it means "grandparent" - see the comments above). – James Jul 10 '15 at 17:38
  • @recognizer Doh! – deadrat Jul 10 '15 at 18:10
  • @deadrat I assumed the same thing when I read the question. Then I realized I had best check the actual details. – recognizer Jul 10 '15 at 18:20
  • @recognizer Thank you for the tip. When I posted my question I didn't think of people would confuse it with directory path definition such as parent of current directory or parent of the directory before. As you clarified it's related to directory history in the bash shell. – kenn Jul 11 '15 at 09:35
  • @kenn hey just to ping you with this whenever you are next on, it turns out that someone pointed out in a comment to my answer that bash cannot navigate to the antipenultimate directory, which was news to me but it's 100% correct. – CR Drost Feb 27 '19 at 16:32
  • 1
    @CRDrost You are right about that. I don't know how I acquired that misconception, I used to use some bash functions to navigate between directories, I might think that cd -- take you to antepenaltimate directory, but it's wrong for bash environment. cd -- takes you to $HOME directory. – kenn Feb 27 '19 at 17:02

9 Answers9

13

antepenultimate - Two before the last. Penultimate is just before the last. Before the penultimate is antepenultimate.

Some shells will allow you to use the up arrow to recall the last command, so I call antepenultimate, up-up-up.

Sun
  • 230
10

penultimate or next-to-last or second-to-last.

Ultimate means last, penultimate means next-to-last.

That can refer to latest instead of last, but I guess that is what you are after here, since your example seems to suggest chronological access.

Last can mean many things, but next-to-last always refers to, well, the thing that is prior to the last one, however last is meant. IOW, whatever ordering is used to define last, the same ordering handles next-to-last correctly.

(If you mean only moving up the directory hierarchy, then parent and grandparent are appropriate.)

Drew
  • 15,241
  • 1
    Drew, the word I was trying to bring up was next-to-last It sounds well. But what about the third, the fourth level directories? How would you define them? – kenn Jul 09 '15 at 18:18
  • 8
    Neither of the suggestions here works in the context given. Both the paenultimate and the next-to-last directory would be one that appears just before the very last directory in a directory listing. It doesn’t work for a directory that is two steps back through your browsing history. – Janus Bahs Jacquet Jul 09 '15 at 18:26
  • @JanusBahsJacquet I'd like to see your answer too. – kenn Jul 09 '15 at 18:30
  • 1
    @kenn pointing out that an answer is incorrect does not imply that one can think of a correct answer. This is especially true if there is no correct answer, which I am inclined to think is the case here. – phoog Jul 09 '15 at 18:53
  • 2
    @JanusBahsJacquet I don't believe next-to-last carries a universal context; if the task is moving backwards through history, next-to-last accurately describes the place I was before the last place I was before now. – Evan Davis Jul 09 '15 at 20:58
  • @JanusBahsJacquet: Next-to-last is relative to last - it depends for its meaning on the meaning of last, which is what I said, explicitly. Last can refer to lots of different things, one of which is the last in a fixed, ordered set, such as a complete directory listing (that's your interpretation, though there is nothing about a directory listing in the question or the answer given here). It can refer also to the latest directory accessed; or created; or modified;... – Drew Jul 09 '15 at 21:11
  • @JanusBahsJacquet: ... It can refer to the last directory component shown in a given path (absolute directory name). That's the case for the OP, and it is the interpretation I was referring to: In /foo/bar/toto/titi/, titi is the last directory component, and toto is the next-to-last one. Their absolute directory names (paths) are /foo/bar/toto/titi and /foo/bar/toto/, respectively. – Drew Jul 09 '15 at 21:11
  • In addition to what @JanusBahsJacquet has said: "parent" and "grandparent" are definitely not what you want, because in this context they already have very specific meanings - the parent of /home/Videos is /home, and its grandparent is /. – psmears Jul 09 '15 at 21:11
  • @psmears: If the OP is only talking about moving up the directory hierarchy, then parent and grandparent are exactly the terms used. If the OP instead means chronological access (which I think might be the case) then last and next-to-last (or penultimate) are the terms used. It all depends on what notion of last is involved. – Drew Jul 09 '15 at 21:18
  • @Drew: From the question it's very clear that chronological access is intended - look at the example directories given - so parent/grandparent are definitely out! – psmears Jul 09 '15 at 21:34
  • @psmears: The OP is not so clear, IMO, but I've clarified my answer, hopefully. Parent and grandparent apply to directory hierarchy (only). And I agree that the OP seems to refer to chronological access (but I disagree that the is "very clear" from the question as posed). – Drew Jul 09 '15 at 21:40
  • @kenn: I don't know a good term for the 3rd and 4th. You could say third to last or next to next to last for the 3rd, etc., but that's about it, I think. – Drew Jul 09 '15 at 21:44
  • @Drew: Given that it's talking about the operation of the cd - and cd -- commands, it's a very safe assumption that the intent is chronological. I guess if you're not familiar with the operation of those commands it may be less clear, but I think the example still shows what's going on... in any case, thanks for clarifying your answer :) – psmears Jul 09 '15 at 22:23
  • @psmears: Yes, that's true. Which means that all of that part of the OP is unclear - for this site. As a question about English, the question as posed is unclear wrt what is meant by last etc. This is not a site where people are expected to know what cd .. or cd - might mean, and in which shell, etc. – Drew Jul 09 '15 at 23:04
8

You may need something like the one before last:

Do X to go to the last [or previous] directory; do Y to go to the one before last.

Here's an example:

The two last chapters, which were not covered in the course proper, are perhaps less easily accessible: the one before last because it is rather technical, the last one because it requires some (elementary) knowledge of analytic (or algebraic) complex geometry.

(Complex Tori and Abelian Varieties, p. vii; emphasis added)

Matt Gutting
  • 6,220
  • I don't think I can use it in my case, because the ultimate directory is not known. – kenn Jul 09 '15 at 18:26
  • 5
    Instead of last, just use that: “Do X to go to the previous directory; do Y to go to the one before that”. Or alternatively, “Do X to go back one step; do Y to go back two steps”. – Janus Bahs Jacquet Jul 09 '15 at 18:27
  • @kenn It's used for chronological or logical sequence: the current directory is the one you're in right now; the last is the one you were in before now; the one before last is the one you were in before that. – Matt Gutting Jul 09 '15 at 18:28
  • 1
    @MattGutting this use of "last" is ambiguous and can be confusing. If you are at the 8th station of a transit line having 10 stations, and you just arrived from the 7th station, the phrase "last station" could denote the 7th station or the 10th. – phoog Jul 09 '15 at 18:57
7

Why not just say previous but one (or previous bar one)?

I find it self-explanatory (in analogy to last but one). Google gives me quite a lot of hits in exactly the requested sense. Example:

The core principle of renku is “link and shift”. “Link” signifies that each verse links somehow to its predecessor and “shift”, by contrast, means that each new verse must shift away from the previous-but-one verse, and have nothing in common with it. Thus, in any three consecutive verses A, B and C: B is to link to A and C links to B, but crucially C shifts right away from A.

(HAIKU SPIRIT: Guidelines to compose a renku, emphasis mine)

anemone
  • 6,216
5

I don't know of any commonly used terminology, but to specify this with ordinality you could use first antecedent (for cd -), second antecedent (cd --) and so on.

In the context of bash, you could perhaps go for second last history entry (cd --) etc, though since you seem to limit this to cd commands that is not quite right either. Second last directory visited perhaps?

Alok
  • 1,559
  • Alok, your approach is smartly. It grammatically sounds well. – kenn Jul 09 '15 at 18:35
  • 1
    @kenn unsolicited grammar advice: read up on copulative verbs (linking verbs). In both of your sentences, the last word should be an adjective, not an adverb (smart, good). Because of the nature of the verb, the word in that position describes the subject, not the verb. – phoog Jul 09 '15 at 19:01
  • @phoog thank you for correcting me. I ll never master English. By the way if you keep correcting my grammar errors you ll end up with proving infinite set theory – kenn Jul 09 '15 at 19:30
  • @kenn this is a mistake that many naive speakers make, generally not with to be but with others like sounds, looks, etc. One sentence to illustrate: A wet dog smells well, but a wet dog smells bad. – phoog Jul 09 '15 at 19:34
  • I thank you all who posted an answer or commented on my topic. I should pick up one of the answers here. Alok's answer looks functional though it sounds a bit unfamiliar at first glance. Since nobody criticise his answer I ll accept it. But I had better wait a while. – kenn Jul 10 '15 at 10:26
4

Wouldn't you be able to say, "the directory prior to the previous directory', etc. I'm not sure if it's mathematically clear, but it would be very clear to me if I were the user who was trying to follow your instructions.

  • You are right in that context. It's possible to define it in a number of ways semantically. I wondered if there were any ordinal phrase I could replace previous of previous – kenn Jul 09 '15 at 19:17
3

Before, or two before

In fluent English you'd probably say, "Use cd - to go to the last directory, or cd -- to get to the one before that." You can then refer to it inline as the "before-last" directory.

You should also consider describing them with reference to the present directory as the directory before and the directory two before the current one. If you need to scale to larger numbers, you should definitely use this: it has the distinct advantage that you can refer to the directory fifty-eight before the current directory, and nobody has any ambiguity about what that means. The equivalent "previous-of-previous-of-previous-of..." will be unsustainable after 5 or 6 iterations.

CR Drost
  • 457
  • Chris, I think you are a programmer and native English speaker. You presented a universal way to describe ordinality too. It's clear and precise. – kenn Jul 10 '15 at 18:01
  • @CR Drost: Not relevant to the OP's question but Chris are you sure cd -- works as you said ? – digital_infinity Feb 25 '19 at 14:39
  • @digital_infinity I mean it probably depends on what shell you're using but at least in Bash and Zsh it appears to do that:

    bash-3.2$ pwd

    /Users/cdrost

    bash-3.2$ cd /tmp

    bash-3.2$ cd /var

    bash-3.2$ cd --

    bash-3.2$ pwd

    /Users/cdrost

    – CR Drost Feb 26 '19 at 18:04
  • @CR Drost. -- means usually in gnu commands: "stop reading options, the following arguments are file names, not options". In your case there is zero following arguments so cd -- is equal to cd. It is interpreted as "go the user's home directory". See (https://unix.stackexchange.com/questions/11376/what-does-double-dash-mean-also-known-as-bare-double-dash/11382#11382) and (https://askubuntu.com/questions/711390/what-does-cd-do-i-used-it-and-im-now-stuck-in-a-directory) – digital_infinity Feb 27 '19 at 11:08
  • @digital_infinity oh, now that is interesting. I thought bare cd didn't change your directory. You're right that my test was inadequate and they do in fact take us back to the home directory. – CR Drost Feb 27 '19 at 16:23
0

Instead of previous use, "one level up", previous of previous use "two levels up". unless is going back in to navigation history, then this would not work.

montelof
  • 109
  • 1
    Per the Bash documentation, "If directory is ‘-’, it is converted to $OLDPWD". OLDPWD is "The previous working directory as set by the cd builtin.". It's not the parent directory; it's the previous directory. – recognizer Jul 10 '15 at 17:01
  • @recognizer Yes, you are right about it. Thank you for clarification. Some posts such as parent, grandparent directory get meaningless. But montelof's approach is logical. He paraphrases the sentence. – kenn Jul 10 '15 at 17:11
  • in that case it could be history -1, History -2, History -3, etc. or just print the path as it would be. instead. like /home/Downloads, /home/Videos. and thats it. – montelof Jul 21 '15 at 19:13
-1

I'm not a programmer, but in any other context, I would probably use "former" and "latter".

Wad Cheber
  • 1,142