TP 2.1: Files and directories
Goal: Move inside tree structure.
The purpose of this practice is to put you in situation: You have launched some calculations on work space and must organize and store results inside your personal save space. In the save space, fasta files will be stored into data directory and blast files will be stored into blast directory.
Reminder
Current state of your directories:
/home/<username>: configuration files/save/user/<username>: backup space, empty/work/user/<username>: working space, files resulting from analysis
Prerequisite¶
Before starting this practice, please type the following command:
Create a project directory¶
Question
In you save space, create a folder called tp_linux, and go in this folder.
/home/<username>
├── save <- go there
│ └── tp_linux
└── work
Solution
<username> by your username)cd ~/save/# Create the directory tp_linuxmkdir tp_linux# Go into the new directorycd tp_linuxStructure the projet¶
Question
Create the sub-directories data and blast_result in tp_linux.
/home/<username>
├── save
│ └── tp_linux
│ ├── blast_result
│ └── data
└── work
Solution
or in one line
Visualize the content of your working directory¶
Question
List all the files inside the work directory.
Solution
Many possibilities (not exaustive):
- by going inside the directory
- by using the absolute path
- by passing by the home directory shortcut.
- the same, but using the shortcut
~that go to the home directory.
Organize data¶
Question
- Move the files
*.fastainside directorytp_linux/data; check that none exists inworkdirectory. - Copy blast result files (
*.blast) inside directorytp_linux/blast_result.
/home/<username>
├── save
│ └── tp_linux
│ ├── blast_result
│ └── data
└── work
├── *.blast
└── *.fasta
/home/<username>
├── save
│ └── tp_linux
│ ├── blast_result
│ │ └── *.blast
│ └── data
│ └── *.fasta
└── work
└── *.blast
Solution
- For 1:
- For 2:
Create symbolic link (shortcut)¶
Question
In order to avoid multiple copies of a file, a good practice is to use symbolic link (shortcut) pointing on this file.
Go in the directory ~/work and create a symbolic link that points to the file ~/save/tp_linux/data/ab005233.fasta.
/home/<username>
├── save
│ └── tp_linux
│ ├── blast_result
│ │ └── *.blast
│ └── data
│ ├── ab005233.fasta
│ └── *.fasta ^
└── work │
├── ab005233.fasta -----/ link
└── *.blast
List in detailled manner the files inside your space work.
Solution
One solution
or an equivalent solution