Mounting network file systems and retrieving files in Linux

In this article, we are going to learn about the mount command. To mount a file system onto the file system tree, use the mount command. This command will instruct the kernel to mount the file system found on a particular device. There is a mount point in the tree for each partition that is mounted.

Prerequisites

Besides having a terminal open, make sure you have necessary files and directories present to mount

How to do it

We are going to use the mount command to mount the file system. Then, we are going to use the ro and noexec options to mount:

$ mount -t ext4 /directorytobemounted /directoryinwhichitismounted -o ro,noexec

We can mount the device with default options too. Run the following command to mount a device using the default options:

$ mount -t ext4 /directorytobemounted /directoryinwhichitismounted -o defaults

The scp command is used to securely transfer files between two hosts. We can transfer files from our localhost to a remote host, and also between two remote hosts. Run the following command to transfer files from a remote host to our local host:

$ scp from_host_name:filename /local_directory_name

How it works

  • We used the ext4 file system. In the mount command, we first specified which directory we wanted to mount, followed by the directory in which we will mount it with the ro and noexec options.
  • We mounted the directories using the default options.
  • We used the scp command to copy files from a remote host to the local host.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

4 × four =

Related Articles