Open files and mount drives from the terminal

This page teaches you to open files and mount drives from the terminal. Or the TTY mode. The best known command is cd instead of the traditional file manager. You will also learn to ride (command mount) External storage units.

If you want to know more details on this and the terminal Deepin visit Frequently Asked questions.

basic actions

Open files and scan folders

As have the file manager graphically test cd:

cd /[nombre de la carpeta]/

Go back


File List

If you want to know the files are in the folder we turn to ls:

ls -l

To see the file type, use instead:

ls -F

Read only text files

To view the contents of the file we use more. However, what we see is only the plain text. It is also useful to know what's inside the file as "executable" before installing.

The options have to read the file more to show up and down, head to go to the start and tail for the end:

more archivo
head archivo
head -20 archivo
tail archivo
tail -20 archivo

Copying and moving files

To copy and move files use cp Y mv. For example, if I want to move archivo.txt to /home/datos/ We do the following:

cp archivo.txt /home/datos/
mv archivo.txt /home/datos/

delete file

You can not recuerar files once deleted! Escrbir sure the file name correctly. ' To delete files we write the dreaded rm:

rm [nombre del archivo]

external drives

Mount the USB device

  1. If you want to open the USB device (flash memory) we have to locate the partition and create unity /media/usb
mkdir /media/usb
ls -l /dev/sd*
  1. To mount use the command mount and we wrote the following, considering that usb partition in the example is /dev/sdb1 and type of format is vfat FAT (or ntfs NTFS):
mount -t vfat /dev/sdb1 /media/usb
  1. Now go to the USB drive, to find the file we continue with cd
ls /media/usb

Change permissions to read and write

To change the permissions we use this option:

sudo mount / -o remount,rw

further reading

Would you recommend this article?