Where should I keep my personal files while keeping the pathname short?
What is the purpose of these directories?
- lib: kernel modules and those shared library images (the C programming code library) needed to boot the system and run the commands in the root filesystem
- etc: configuration files
- var: files to which the system writes data during the course of its operation
- tmp: temporary files
- mnt: the temporary mount points for mounting storage devices
Is there any way to shorten the file path ?
Instead of call /home/shifar
you can use ~/
Is it good to keep my project files in the above mentioned directory? Or is there any convention ? like Personal files must be stored there... Softwares is better stored in there... like that.
/home/shifar
is your home dir and dedicated for your personal uses. You can store your personal dirs, files in any dirs in it. ~/Documents
may be a good place for Projects. ~/Public
is normally shared to anyone in the network. So if you do not want to share, put your files in another dirs instead.
The previous answers are all good. I would just add a few points.
Later, (not now!) when you're more comfortable with Linux, you may want to create a separate partition for data - especially if you have big files like lots of music or video. If you add too many of these to your home partition, you can fill it up and then other things stop working because they can't get the disk space they need.
If you fill up a data partition, it doesn't affect anything else.
Also, when you want to backup your data, you can just do it any time. /home has things which change all the time, so you can't normally "freeze" it to get a copy where everything is in sync. With a separate data partition, you can make a perfect backup any time.
As far as paths go, if you are working from the command line, you can define a bash alias (in ~/.bashrc
or in ~/.bash_aliases
) to shorten any path or even to change into the directory.
alias proj='cd /home/shifar/Public/Projects'
and then just type proj
to switch to that directory.
When you get more comfortable with bash, you can do even more with functions. But, we'll leave that till later.
Another approach would be to add a line to ~/.bashrc
like
export PROJ='/home/shifar/Public/Projects'
That would make an environment variable PROJ
available for use and you could do things like:
ls "${PROJ}"
cd "${PROJ}"
cp mynewfile "${PROJ}"
It will also work without the export
in front of it, but then it would only be defined at the top level of your shell, not in any subshell you might run from there.
You don't strictly need the quotes or braces in the example above either, but they protect you from things like embedded blanks and also allow you to use PROJ
as part of a word - like ${PROJ}ect
.