AFNI Message Board

History of AFNI updates  

|
April 15, 2021 09:07AM
Hi, Jessica-

Yes, those lines are what should be copy+pasted.

----------------------- preamble to removing directories

Firstly, I can*not* stress enough that removing files/directories with the "rm" command does not put them into a trash bin, but instead removes them permanently. If you later change your mind or make a mistake you can*not* get them back... They gone, gone, gone. So:
1) be really sure you want to delete something.
2) be really sure you have specified that/those thing(s) correctly.

If you have the space currently, I would recommend moving the files/directories first, and go to remove them later. To check your disk space on the terminal, there is:
df -mh
... and you can navigate to the main "Filesystem" in question (it probably starts with /dev/SOMETHING).

Additionally, it is possible to use the "Files" application in Ubuntu to navigate through a GUI of directories structures (like you would in Windows, for example), you can select a directory name, right-click it, and move it to the trash, and then empty your trash. If you have lots of directories to remove, this can become tedious, though.

Finally, using wildcard characters can speed up the process of selecting files or directories with similar names. Sometimes we use that with listing things, such as listing all files or directories in your home directory that start with "AFNI_data" and might have any other characters after that start, including not having any more characters (the "-d" option means that it will only list items in the base directory, and not recursively lists contents of any directories that might start with "AFNI_data"):
ls -d ~/AFNI_data*
These are useful to select a lot of files/directories systematically and efficiently, *but* if you use them while removing, you reeeeeally want to be sure you are only selecting exactly what you want. I would *not* use wildcards in combination with removing unless you are very comfortable with them and shell commands.

Note Linux-wise, Rick has a nice tutorial on getting comfortable with command line (shell) syntax, which I would recommend everyone read and practice with:
[afni.nimh.nih.gov]
Linux commands are really useful, and this is a nice intro to start getting comfortable and practicing with them.

------------------- ok, to the question at hand:

Removing files and directories has slightly different syntax.

To delete a *file* in the terminal, you would type:
rm FILE_NAME
or, if you have several, you can remove more than one at a time:
rm FILE_NAME1 FILE_NAME2 FILE_NAME3 ...

You could use while cards to specify your list of FILE_NAME* values, like "remove all files that start with pineapple":
rm pineapple*
... and be sure that you know what exactly files start with pineapple, so that if you just wanted to remove "pineapple_tmp.txt" and "pineapple_old.txt", but NOT "pineapple_thekeytolife.txt", that you do not use the wildcard like this, but instead specify individual files...

To remove a *directory*, you would specify the directory name and provide an option to say to recursively remove everything in it, too.
rm -r DIR_NAME
Note: if you type the wrong directory name, the terminal won't check with you, and the shell will remove stuff. Sooo, be very careful that DIR_NAME is not mistyped---putting accidental spaces would separate the name into multiple apparent directories, and the shell will try to remove each piece, which could be very bad depending on how the pieces split. You can use wildcards here, too, but I would not recommend that until you are very comfortable with the shell syntax, because it is too easy to remove too much (an accidental space before a wildcard can be catastrophic).

Again, I don't mean to be scary, and playing around with Linux/shell commands is the only way to get better with them and to feel comfortable. It is just that the "rm" is quite powerful and not forgiving, and so one really just has to be careful and sure of what is being specified to remove in this way. I guess everyone has removed something they reeeeaallly didn't want to at some time, and been very sad afterward, as part of the learning curve---I know I certainly have :(.

--pt
Subject Author Posted

No FT file under AFNI_analysis Attachments

jessicademirjian April 12, 2021 04:13AM

Re: No FT file under AFNI_analysis

ptaylor April 12, 2021 09:03AM

Re: No FT file under AFNI_analysis

jessicademirjian April 14, 2021 12:49PM

Re: No FT file under AFNI_analysis

ptaylor April 14, 2021 01:26PM

Re: No FT file under AFNI_analysis

jessicademirjian April 15, 2021 05:21AM

Re: No FT file under AFNI_analysis

ptaylor April 15, 2021 09:07AM

Re: No FT file under AFNI_analysis

jessicademirjian April 16, 2021 06:01AM

Re: No FT file under AFNI_analysis Attachments

jessicademirjian May 03, 2021 11:57AM

Re: No FT file under AFNI_analysis

ptaylor May 03, 2021 02:11PM

Re: No FT file under AFNI_analysis Attachments

jessicademirjian May 05, 2021 07:03AM

Re: No FT file under AFNI_analysis

ptaylor May 05, 2021 09:03AM

Re: No FT file under AFNI_analysis

jessicademirjian May 05, 2021 09:23AM

Re: No FT file under AFNI_analysis

ptaylor May 05, 2021 09:40AM

Re: No FT file under AFNI_analysis

jessicademirjian May 05, 2021 09:51AM

Re: No FT file under AFNI_analysis

ptaylor May 05, 2021 10:01AM

Re: No FT file under AFNI_analysis

jessicademirjian May 05, 2021 10:30AM

Re: No FT file under AFNI_analysis

ptaylor May 05, 2021 10:59AM

Re: No FT file under AFNI_analysis

jessicademirjian May 05, 2021 11:21AM

Re: No FT file under AFNI_analysis

rick reynolds April 12, 2021 10:08AM



Sorry, only registered users may post in this forum.

Click here to login