ASSORTED UNIX COMMANDS
1. mkdir -p
If the parent directories don't exist, the -p
argument creates them.
Example: $ mkdir -p unitedstates/illinois/chicago
2. /
Brings you to the absolute root folder.
Example: $ cd /
3. ~
Brings you to the relative user account home folder.
Example: $ cd ~
4. pushd & popd
The pushd
and popd
commands work just like array methods, allowing you to easily navigate between multiple directories. If you're at your desktop
, use pushd
and pass it the path to chicago
to change to chicago
. When you want to go back to your desktop
, just use popd
, (without a parameter) to take chicago
of the stack. You can do this for multiple folders, and it just pushes them on the end of an "array" of directories and pops them off as you need them, first in, first out. Note that pushd
can also be used without a parameter to swap between directories already on the stack.
Example:
$ cd desktop
$ mkdir -p unitedstates/illinois/chicago
$ pushd unitedstates/illinois/chicago
~/desktop/unitedstates/illinois/chicago ~/desktop
$ popd
~/desktop
$ pwd
~/desktop
And for a little fun I have to admit something. I have a horrible irrational fear that my cat is going to somehow walk across my laptop when I've left terminal open and type rm -rf /
!