2.4. Files and directories#
This section includes an introduction to your home directory, files, directories, and their functions, the root filesystem and a how-to on transferring files between systems.
2.4.1. Your home directory#
When you log in to the desktop and open Files, it will display your home directory (Fig. 33).
The following directories will be present in your home directory by default: Desktop, Documents, Downloads, Music, Pictures, Public, Templates, and Videos.
Notes#
/home/user#
The complete (or absolute) path to your home
directory will be of the form /home/user
,
where user
is your username on the system.
$HOME#
The HOME
environment variable will automatically be
set to the complete path to your home directory in the
filesystem.
Hence, you can substitute /home/user
with $HOME
in your commands or scripts.
2.4.3. Important files in home directory#
.bashrc
#
This is the configuration file used by Bash, the default
shell for user accounts. You will mostly use this
file, when you need to set or modify
environment variables like PATH
.
.bash_aliases
#
You can use the .bash_aliases
file to set aliases
for commands.
For example, here is a commonly used alias:
alias l='ls -l'
This means when you type l
at the command-line, the
bash shell will execute ls -l
, which will output a
long listing of files, instead of the default.
Note
To learn more about the ls
command, read
the List files and directories: ls section.
2.4.4. File and directory names are case-sensitive#
One thing you will need to remember is that file and directory names in Linux are case-sensitive.
For example, a file named:
sequence.txt
is different from:
Sequence.txt
Similarly, Documents
and documents
are two
different directories.
Both these files or directories mentioned above, can exist in the same directory and can have different contents.
2.4.5. Accessing the root filesystem#
To access the root filesystem (/
), click on
File System in the sidebar of
file manager (Fig. 35).
Directories under /
and their functions#
/etc
— stores configuration files of applications
/home
— contains home directories of users
/media
— locations where devices like external disks will be mounted i.e., made available
/root
— home directory of
root
user (administrator)/tmp
— temporary files created by applications
/usr
— applications and libraries are installed here along with their data and documentation
/var
— storage for log files, application cache, databases etc.,
Root file system and root home directory are different#
/
is the root filesystem#
All users on the system can access files and directories here, provided they have the appropriate permissions.
/root
is home directory of root#
Only root will have access to it.
2.4.6. Transferring files between systems#
One useful feature of Files is the ability to connect to remote systems using protocols like SSH, FTP, SMB and Webdav. Once connected, you can transfer files from your Linux desktop to the remote system or vice-versa.
To connect to a remote system, use the following menu entry in Files (Fig. 36):
Connecting to an SSH server#
Open Fig. 37):
and follow the steps below (In the field corresponding to Server, enter the domain name or IP address of the server you are connecting to
Port 22 is the default for SSH, so you do not need to change that usually
From the Type drop-down box, select SSH
Under Folder, you can specify a directory (optional) to open, once connection is successful
Enter the username and password of your account on the server
Click on the Connect button
Once the remote directory is open in Files, you can start transferring files from your desktop or vice-versa.
Comments