25.10.2014 Views

Introduction to Bio-Linux

Introduction to Bio-Linux

Introduction to Bio-Linux

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

There are many different ways <strong>to</strong> accomplish the above. If you have problems, or would like <strong>to</strong> know if you have<br />

done it in the most efficient way, then please ask a demonstra<strong>to</strong>r.<br />

Removing files and direc<strong>to</strong>ries<br />

To remove a file or files, use the rm command followed by the name of the file(s) you wish <strong>to</strong> delete.<br />

rm file1<br />

rm file2 file3 file4<br />

rm cat*<br />

remove all files starting with the letters cat<br />

Note<br />

On <strong>Bio</strong>-<strong>Linux</strong> the command rm has been aliased <strong>to</strong> rm –i.<br />

This means the system will ask you if you really mean <strong>to</strong> delete the file you have just asked <strong>to</strong> delete, and you<br />

must answer yes if you do. Other <strong>Linux</strong>/Unix systems may not be so polite, and unlike Windows systems, the files<br />

you delete are not s<strong>to</strong>red in a trash can for you <strong>to</strong> retrieve – they’re gone! (Unless the file has been there for some<br />

time and you are making proper backups….which you should be!)<br />

If you have a lot of files <strong>to</strong> delete, confirming each one can be tedious. You can escape this safety feature by using<br />

a backslash in front of the rm command.<br />

\rm files<br />

To remove an empty direc<strong>to</strong>ry, you can use the rmdir command:<br />

rmdir thisdir<br />

If that direc<strong>to</strong>ry contains any files, you will not able <strong>to</strong> delete the direc<strong>to</strong>ry using rmdir until you have deleted all<br />

the files within it.<br />

To delete a direc<strong>to</strong>ry and all the files in it, use the rm command with the options -rf<br />

rm –rf fulldir<br />

You may be prompted <strong>to</strong> confirm that you wish <strong>to</strong> delete each file.<br />

If this is <strong>to</strong>o tedious, and you are certain that you want <strong>to</strong> delete all the files in that direc<strong>to</strong>ry as well as the<br />

direc<strong>to</strong>ry itself, remember that you can “escape” this safety feature using the backslash:<br />

Exercise<br />

\rm –rf fulldir<br />

Delete one of the files you created earlier with pico or nedit.<br />

Delete the entire testdir direc<strong>to</strong>ry.<br />

13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!