Interpretation of OP's question
My guess is that OP doesn't want to see all of OSX's folders in the $HOME
directory when they're in the terminal (like ~/Pictures
, ~/Documents
, etc.). Those folders are friendly for GUI users but they get in the way for CLI users.
I don't recommend moving any folders that GUI apps create from the Mac Home directory. This would probably break some things. Pogue's answer is very interesting, but it will probably hide those folders in Finder.
Solution: Just using a different folder as your CLI workspace
I offer a simple BASH command to make using the CLI friendlier on OSX.
Solution: Examples of usage
- Type
w
and hit <Enter>
from your Terminal to instantly cd ~/workspace
and ls ~/workspace
.
- (Whenever you open a shell) You'll automatically navigate to
~/workspace
and list the contents.
Why this solution?
As a CLI user, I'm constantly typing cd
to return to $HOME
, and then doing ls
to find the folder I'm looking for. This does both of those things with 4 fewer keystrokes, while being simple and benign.
Full details: Installing the script and explaining what it does.
If you want to have these helper commands be available every time you open a terminal, you can paste this code into the ~/.bashrc
file for BASH or ~/.zshrc
file for ZSH.
# Configure this however you want.
export WORKSPACE=${HOME}/workspace
mkdir -p ${WORKSPACE}
# This is a BASH function. It works in a similar way to
# executing a program that is in your $PATH (for example, `ls`)
# If the BASH function was loaded into your shell then it will
# be available to run as a command.
w() {
cd ${WORKSPACE}
ls ${WORKSPACE}
}
# Run the command every time a shell is opened.
w
Regarding my previous script
The old script was complicated and involved creating a temporary directory whenever you run ls
from $HOME
, symlinking all files in $HOME
to inside of that directory, and then running ls
there. Goal was to make ls
pretend that those folders weren't there but also keep CLI colors in the output. Kind of a mouthful but if you're curious, you can see it in the edits of this answer.
chflags hidden <folder>
to hide any of them in Finder. This won't move them of course but I like to hidePublic
folder, for instance.