Blog → Post


(TIP) NOT-Replacing Familiar Tools: cd..
easing the move to Linux.
by @admin, june 22, 2019, 12:10am utc

OK, we are a little torn on this tip.

There are a number of CLI things such as ls not dir, cat not type, mkdir not md, that take some time to get used to when shifting over to Linux.

It is not unlike how you may mistakenly write the prior year's year on checks and documents, for 6 months a few days after the calendar changes to January 1st.


One of those tough to forget items is that on Windows, either cd .. or cd.. will move you up a level in the folder tree. If you're really used to cd.., well, that one doesn't work on Linux. Linux treats cd.. as a unique command and of course, you'll get a "command not found" when trying that on Linux.

The torn aspect is – that there is a way on Linux to create an alias for commands, so that by typing cd.. cd .. is executed instead.

BUT – is that the right thing to do? Given a little bit of time, you'll shift to doing it "the Linux way" – it is just that the first bit of time getting used to it can be annoying.

BUT BUT! – if you're switching to Linux long-term, you might as well learn to do things the right way. Plus it will be potentially embarrassing to go to a colleague's Linux computer and be trying to DIR, MD, CD..-ing your way around.

That's our quandary.

So -- we will show you how to create an alias and let you decide how to approach this. We do so next by using leafpad, a simple notepad-ish text editor to open the hidden file bashrc. bashrc contains properties for how your bash session looks and behaves. (A '.' in front of a file or folder makes it hidden, by default).

/home/lv/home-tree-structure ~$ cd music ~/music$ cd.. bash: cd..: command not found ~/music$ leafpad .bashrc ~/music$ leafpad /home/lv/.bashrc ~/music$ # add alias cd..='cd ..' to the end of .bashrc ~/music$ # ~/music$ source .bashrc bash: .bashrc: No such file or directory ~/music$ source /home/lv/.bashrc ~$ cd home-tree-structure bash: cd: home-tree-structure: No such file or directory ~$ cd home-tree-structure bash: cd: home-tree-structure: No such file or directory ~$ pwd /home/lv/home-tree-structure/music ~$ cd.. ~$ pwd /home/lv/home-tree-structure ~$
tags: All users, Tips
Footer done in Inkscape