/home
users’ own files/home is where people keep their files. Each user has a directory named after them, and inside it they may create, change and delete whatever they like. It is written ~ for short, and it is the one part of the tree that belongs to you rather than to the system.
The system owns the rest of the tree. This part is yours.
Why it exists
Every directory at the top of the tree is there for a reason. This is the problem /home solves.
Each home directory is owned by its user. One person’s files are not another’s to change, and on many systems not even to read.
With /home on its own partition, the operating system can be replaced while the documents and settings stay where they are.
Personal configuration is stored as hidden files in the home directory, so each user gets their own shell and application setup.
What you find inside
Not everything, but the entries worth recognising. Each is marked as a directory, a file, a link or a device.
- userdirectoryOne user’s home directory. Yours is named after your login.
- user/DocumentsdirectoryOrdinary folders, as on any desktop system.
- user/.bashrcfileCommands run each time a shell starts: aliases, the prompt, PATH.
- user/.sshdirectorySSH keys and the list of known hosts.
- user/.configdirectoryPer-user settings for most applications.
- user/.bash_historyfileThe commands typed in earlier sessions.
At the terminal
Four commands that show what this directory is doing on a real machine.
cd ~Go to your home directory. Plain cd does the same.
echo $HOMEPrint the full path of your home directory.
ls -la ~List everything in it, including the hidden files that begin with a dot.
du -sh ~/* | sort -hFind what is taking the space in your home directory.
Handle with care
What goes wrong here, and what someone securing or attacking the machine looks at.
A private key is a way in to every machine that trusts it. The directory should be readable by you alone — SSH refuses to use keys that are not.
A password passed on the command line ends up in .bash_history in plain text. It is one of the first files read on a compromised account.
.bashrc is executed at every login. A line added there by someone else runs as you, each time you open a terminal.